use of org.apache.openejb.server.httpd.HttpRequest in project tomee by apache.
the class WsServlet method service.
@Override
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
HttpListener service = getService();
if (service == null)
throw new ServletException("WebServiceContainer has not been set");
ServletEndpointContext context = getContext();
ENDPOINT_CONTENT.set(new InvocationContext((HttpServletRequest) req));
try {
res.setContentType("text/xml");
HttpRequest httpRequest = new ServletRequestAdapter((HttpServletRequest) req, (HttpServletResponse) res, config.getServletContext());
HttpResponse httpResponse = new ServletResponseAdapter((HttpServletResponse) res);
if (pojo != null) {
req.setAttribute(WsConstants.POJO_INSTANCE, pojo);
}
try {
service.onMessage(httpRequest, httpResponse);
} catch (IOException | ServletException e) {
throw e;
} catch (Exception e) {
throw new ServletException("Error processing webservice request", e);
}
} finally {
ENDPOINT_CONTENT.set(context);
}
}
use of org.apache.openejb.server.httpd.HttpRequest in project tomee by apache.
the class RsServlet method service.
@Override
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
if (listener == null) {
throw new ServletException("RESTServiceContainer has not been set");
}
HttpRequest httpRequest = new ServletRequestAdapter(req, res, servletConfig.getServletContext());
HttpResponse httpResponse = new ServletResponseAdapter(res);
try {
listener.onMessage(httpRequest, httpResponse);
} catch (IOException | ServletException e) {
throw e;
} catch (Exception e) {
throw new ServletException("Error processing webservice request", e);
}
}
Aggregations