public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { httpRequestContext.set(new HttpRequestContext(this, req, resp)); String pinfo = req.getPathInfo(); if (pinfo == null) return; try { callMethodForParam(req, resp); } catch (Exception e) { e.printStackTrace(); throw new ServletException(e); } }
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { httpRequestContext.set(new HttpRequestContext(this, req, resp)); try { String ctype = req.getContentType(); if (ctype != null) ctype = ctype.toLowerCase(); if (FileUpload.isMultipartContent(req)) { callMethodForMultiPart(req, resp); } else if (MIME_JSON.equals(ctype)) { // TODO: json-rpc } else { callMethodForParam(req, resp); } } catch (Exception e) { e.printStackTrace(); throw new ServletException(e); } }
public static HttpRequestContext getHttpRequestContext() { return httpRequestContext.get(); }