Examples of HttpServletRequestWrapper


Examples of javax.servlet.http.HttpServletRequestWrapper

            will(returnValue("/"));
            allowing(req).getPathInfo();
            will(returnValue("/test"));
        }});
       
        final HttpServletRequestWrapper wrapper = new HttpServletRequestWrapper(req);
        final HttpServletRequestWrapper wrapper2 = new HttpServletRequestWrapper(wrapper);
        final SlingHttpServletRequestImpl slingRequest = new SlingHttpServletRequestImpl(null, wrapper2);
        final HttpServletRequestWrapper slingWrapper = new HttpServletRequestWrapper(slingRequest);
       
        ServletRequest unwrapped = ExternalServletContextWrapper.
            RequestDispatcherWrapper.unwrapServletRequest(slingWrapper);
       
        assertEquals(wrapper2, unwrapped);
View Full Code Here

Examples of javax.servlet.http.HttpServletRequestWrapper

    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        RequestDispatcher rd = getServletContext().getRequestDispatcher(req.getRequestURI());
        req.setAttribute("org.apache.catalina.jsp_file", req.getRequestURI());
       
        // Wrap ServletPath with an empty value to avoid Guice's null getServletPath() bug from within a filter/servlet chain
        HttpServletRequest wrapped = new HttpServletRequestWrapper(req) {
            public String getServletPath() {
                return "";
            }
        };
View Full Code Here

Examples of javax.servlet.http.HttpServletRequestWrapper

  }

  @Override
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
  {
    request = new HttpServletRequestWrapper((HttpServletRequest) request);
    chain.doFilter(request, response);
  }
View Full Code Here

Examples of javax.servlet.http.HttpServletRequestWrapper

    protected Request findRequest(Object o) {
        if (o instanceof Request) {
            return (Request) o;
        }
        if (o instanceof HttpServletRequestWrapper) {
            HttpServletRequestWrapper wrapper = (HttpServletRequestWrapper) o;
            return findRequest(wrapper.getRequest());
        }
        return null;
    }
View Full Code Here

Examples of javax.servlet.http.HttpServletRequestWrapper

    }

    private HttpServletRequest wrapRequest(final HttpServletRequest request,
        final Locale locale)
    {
        return new HttpServletRequestWrapper(request)
        {
            /**
             * @see javax.servlet.ServletRequestWrapper#getLocale()
             */
            public Locale getLocale()
View Full Code Here

Examples of javax.servlet.http.HttpServletRequestWrapper

        final Map<String, String[]> filteredParams = Collections.unmodifiableMap(removeVowels(request.getParameterMap()));

        // Here, we wrap the request so that the servlet (and other filters further down the chain)
        // will see our filteredParams rather than the original request's parameters. Wrappers can be
        // as benign or as crazy as you like. Use your imagination!
        HttpServletRequestWrapper wrappedRequest = new HttpServletRequestWrapper((HttpServletRequest) request) {
            @Override
            public Map<String, String[]> getParameterMap() {
                return filteredParams;
            }
View Full Code Here

Examples of javax.servlet.http.HttpServletRequestWrapper

            // check for problematic application servers like WebSphere
            // where path info and servlet path is set wrong SLING-2410
            final HttpServletRequest request = (HttpServletRequest) req;
            if ( request.getPathInfo() == null && request.getServletPath() != null
                    && request.getServletPath().endsWith(".jsp") ) {
                req = new HttpServletRequestWrapper(request) {

                    @Override
                    public String getPathInfo() {
                        return request.getServletPath();
                    }
View Full Code Here

Examples of javax.servlet.http.HttpServletRequestWrapper

        @Override
        protected HttpServletRequest getServletRequest(PortletRequest request) {
            try {
                Method getRealReq = request.getClass().getMethod(
                        "getRealRequest");
                HttpServletRequestWrapper origRequest = (HttpServletRequestWrapper) getRealReq
                        .invoke(request);
                return origRequest;
            } catch (Exception e) {
                throw new IllegalStateException("GateIn request not detected",
                        e);
View Full Code Here

Examples of javax.servlet.http.HttpServletRequestWrapper

        if (LOG.isDebugEnabled()) {
            LOG.debug(relativePath);
        }

        HttpServletRequestWrapper requestWrapper = new HttpServletRequestWrapper(httpRequest) {
            @Override
            public String getRequestURI() {
                return relativePath;
            }
        };
View Full Code Here

Examples of javax.servlet.http.HttpServletRequestWrapper

    @Override
    public void doFilter(ServletRequest request, ServletResponse response,
        FilterChain filterChain) throws IOException, ServletException {
      final String userName = request.getParameter("user.name");
      ServletRequest requestModified =
        new HttpServletRequestWrapper((HttpServletRequest) request) {
        @Override
        public String getRemoteUser() {
          return userName;
        }
      };
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.