Package javax.servlet.http

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


  }

  @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

    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

    }

    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

        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

            // 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

        @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

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

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

    @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

    @Override
    public void doFilter(ServletRequest request,
                         ServletResponse response,
                         FilterChain chain
                         ) throws IOException, ServletException {
      HttpServletRequestWrapper quoted =
        new RequestQuoter((HttpServletRequest) request);
      final HttpServletResponse httpResponse = (HttpServletResponse) response;

      // Infer the content type based on the path of the request.
      String path = ((HttpServletRequest)request).getRequestURI();
View Full Code Here

TOP

Related Classes of javax.servlet.http.HttpServletRequestWrapper

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.