protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { req = new HttpServletRequestWrapper(req); ClassLoader old = Thread.currentThread().getContextClassLoader(); WorkContext workContext = WorkContextCache.getAndResetThreadWorkContext(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); workContext.setHeader("fabric3.httpRequest", req); workContext.setHeader("fabric3.httpResponse", res); if (servlet == null || servlet.getWebComponent() == null) { // not yet initialized res.setStatus(404); return; } servlet.service(req, res); } catch (ServletException | IOException se) { se.printStackTrace(); throw se; } catch (Throwable t) { t.printStackTrace(); throw new ServletException(t); } finally { Thread.currentThread().setContextClassLoader(old); workContext.reset(); } }
protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { req = new HttpServletRequestWrapper(req); ClassLoader old = Thread.currentThread().getContextClassLoader(); WorkContext workContext = WorkContextCache.getAndResetThreadWorkContext(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); workContext.setHeader("fabric3.httpRequest", req); workContext.setHeader("fabric3.httpResponse", res); if (servlet == null || servlet.getWebComponent() == null) { // not yet initialized res.setStatus(404); return; } servlet.service(req, res); } catch (ServletException | IOException se) { se.printStackTrace(); throw se; } catch (Throwable t) { t.printStackTrace(); throw new ServletException(t); } finally { Thread.currentThread().setContextClassLoader(old); workContext.reset(); } }