Package javax.servlet.http

Examples of javax.servlet.http.HttpServletResponseWrapper


        setAttribute(HttpServletRequest.class, servletRequest);

        // note that a HttpServlet*Wrapper is needed for injection of
        // singletons that had a @Context HttpServlet*; see [WINK-73]
        setAttribute(HttpServletRequestWrapper.class, new HttpServletRequestWrapper(servletRequest));
        HttpServletResponseWrapper responseWrapper =
            new WrappedResponse(servletRequest, servletResponse, configuration.getMediaTypeMapper());
        setAttribute(HttpServletResponse.class, responseWrapper);
        setAttribute(HttpServletResponseWrapper.class, responseWrapper);
        setAttribute(ServletContext.class, configuration.getServletContext());
        setAttribute(ServletConfig.class, configuration.getServletConfig());
View Full Code Here


            /*
             * start wrapping the OutputStream here in the hope that it will be
             * called during logFinishResponse
             */
            HttpServletResponseWrapper response =
                context.getAttribute(HttpServletResponseWrapper.class);
            if (response == null) {
                logger.debug("Could not find the HTTP Servlet Response to wrap.");
                // this is a really bad path that should probably be an error,
                // but just in case
View Full Code Here

      }
    }

    // Use response wrapper for Servlet 2.5 compatibility where
    // the getHeader() method does not exist
    super.doOptions(request, new HttpServletResponseWrapper(response) {
      @Override
      public void setHeader(String name, String value) {
        if ("Allow".equals(name)) {
          value = (StringUtils.hasLength(value) ? value + ", " : "") + RequestMethod.PATCH.name();
        }
View Full Code Here

  }

  @Test
  public void decoratedNativeRequest() {
    HttpServletRequest decoratedRequest = new HttpServletRequestWrapper(servletRequest);
    HttpServletResponse decoratedResponse = new HttpServletResponseWrapper(servletResponse);
    ServletWebRequest request = new ServletWebRequest(decoratedRequest, decoratedResponse);
    assertSame(decoratedRequest, request.getNativeRequest());
    assertSame(decoratedRequest, request.getNativeRequest(ServletRequest.class));
    assertSame(decoratedRequest, request.getNativeRequest(HttpServletRequest.class));
    assertSame(servletRequest, request.getNativeRequest(MockHttpServletRequest.class));
View Full Code Here

    }

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
    {
        HttpServletResponse servletResponse = (HttpServletResponse) response;
        HttpServletResponseWrapper responseWrapper = new HttpServletResponseWrapper(servletResponse)
        {

            @Override
            public void sendRedirect(String location) throws IOException
            {
View Full Code Here

                    @Override
                    public String getPathInfo() {
                        return "/j_spring_security_check";
                    }
                }, new HttpServletResponseWrapper(res) {
                    @Override
                    public void sendRedirect(String location) throws IOException {
                    }
                }, WEB_LOGIN_CHAIN_NAME);
View Full Code Here

        }
       
        /* ------------------------------------------------------------ */
        public void popWrapper()
        {
            HttpServletResponseWrapper wrapper=(HttpServletResponseWrapper)getResponse();
            HttpServletResponse response=(HttpServletResponse)wrapper.getResponse();
            setResponse(response);
        }
View Full Code Here

    public void doGet(HttpServletRequest sreq, HttpServletResponse sres) throws ServletException, IOException
    {
        if (sreq.getParameter("wrap") != null)
        {
            sreq= new HttpServletRequestWrapper(sreq);
            sres= new HttpServletResponseWrapper(sres);
        }
       
        if (sreq.getParameter("session") != null)
            sreq.getSession(true);
View Full Code Here

                (PrintWriter)envOut :
                new PrintWriter(envOut);
            // Otherwise, create a response wrapper that will pass the
            // env writer, potentially first wrapping it in a print
            // writer when it ain't one already.
            wrappedResponse = new HttpServletResponseWrapper(response) {
                @Override
                public PrintWriter getWriter() {
                    return printWriter;
                }
            };
View Full Code Here

    public void include(String url, boolean flush) throws ServletException, IOException {
        if(flush) {
            jspOut.flush();
        }
        final PrintWriter pw = new PrintWriter(jspOut);
        request.getRequestDispatcher(url).include(request, new HttpServletResponseWrapper(response) {
            public PrintWriter getWriter() {
                return pw;
            }
           
            public ServletOutputStream getOutputStream() {
View Full Code Here

TOP

Related Classes of javax.servlet.http.HttpServletResponseWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.