Java代码
- @Override
- protected void service(HttpServletRequest httpServletRequest, HttpServletResponse httpServletRespo
- nse) throws ServletException, IOException {
- Logger.trace("ServletWrapper>service " + httpServletRequest.getRequestURI());
- Request request = null;
- try {
- request = parseRequest(httpServletRequest);
- Logger.trace("ServletWrapper>service, request: " + request);
- Response response = new Response();
- Response.current.set(response);
- response.out = new ByteArrayOutputStream();
- boolean raw = false;
- for (PlayPlugin plugin : Play.plugins) {
- if (plugin.rawInvocation(request, response)) {
- raw = true;
- break;
- }
- }
- if (raw) {
- copyResponse(Request.current(), Response.current(), httpServletRequest, httpServletResponse);
- } else {
- Invoker.invokeInThread(new ServletInvocation(request, response, httpServletRequest, httpServletResponse));
- }
- } catch (NotFound e) {
- Logger.trace("ServletWrapper>service, NotFound: " + e);
- serve404(httpServletRequest, httpServletResponse, e);
- return;
- } catch (RenderStatic e) {
- Logger.trace("ServletWrapper>service, RenderStatic: " + e);
- serveStatic(httpServletResponse, httpServletRequest, e);
- return;
- } catch (Throwable e) {
- throw new ServletException(e);
- }
- }