コード例 #1
0
 @Override
 protected void doGet(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
   StringBuffer buffer = new StringBuffer();
   buffer.append(ServletUtil.createHeader("Pickupnet Driver added"));
   InputStream resource = getClass().getResourceAsStream("/html/addDriver.html");
   String content = ServletUtil.readFromStream(resource);
   buffer.append(content);
   buffer.append(ServletUtil.createFooter());
   resp.getWriter().write(buffer.toString());
 }
コード例 #2
0
 @Override
 protected void doPost(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
   StringBuffer buffer = new StringBuffer();
   buffer.append(ServletUtil.createHeader("Pickupnet Driver added"));
   String name = req.getParameter("name");
   Driver driver = PickupnetFactory.eINSTANCE.createDriver();
   driver.setName(name);
   Pickupnet.STATION_1.registerDriver(driver);
   buffer.append("Driver added with Id " + driver.getId());
   buffer.append(ServletUtil.createFooter());
   resp.getWriter().write(buffer.toString());
 }