Package javax.servlet

Examples of javax.servlet.FilterChain


        coordinator.addRegistryShutdownListener(l);

        MockControl requestControl = newControl(HttpServletRequest.class);
        HttpServletRequest request = (HttpServletRequest) requestControl.getMock();
        HttpServletResponse response = (HttpServletResponse) newMock(HttpServletResponse.class);
        FilterChain chain = new RebuildRegistryChainFixture();

        request.setAttribute(HiveMindFilter.REQUEST_KEY, r);

        request.setAttribute(HiveMindFilter.REBUILD_REQUEST_KEY, Boolean.TRUE);
View Full Code Here


      MockHttpServletRequest request = new MockHttpServletRequest(application, null, null);
      request.setURL(request.getContextPath() + request.getServletPath() +
        "/wicket/resource/" + Application.class.getName() + "/foo.gif");
      setIfModifiedSinceToNextWeek(request);
      MockHttpServletResponse response = new MockHttpServletResponse(request);
      filter.doFilter(request, response, new FilterChain()
      {
        public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
          throws IOException, ServletException
        {
        }
View Full Code Here

            Resource resource = requestData.initResource(resolver);
            requestData.initServlet(resource);

            Filter[] filters = requestFilterChain.getFilters();
            if (filters != null) {
                FilterChain processor = new RequestSlingFilterChain(this,
                    filters);

                processor.doFilter(request, response);

            } else {

                // no filters, directly call resource level filters and servlet
                processRequest(request, response);
View Full Code Here

        // 2.0 Set Content from mappedURL
        // ContentData contentData = null;

        Filter filters[] = innerFilterChain.getFilters();
        if (filters != null) {
            FilterChain processor = new SlingComponentFilterChain(filters);

            processor.doFilter(request, response);
        } else {
            log.debug("service: No Resource level filters, calling servlet");
            RequestData.service(request, response);
        }
    }
View Full Code Here

            super(target, request, response, dispatch);
        }

        public void invoke() throws ClusteredInvocationException {
            WebInvocation invocation = new WebInvocation();
            FilterChain chainAdapter = new FilterChain() {
                public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
                    try {
                        invokeLocally();
                    } catch (ClusteredInvocationException e) {
                        throw (IOException) new IOException().initCause(e);
View Full Code Here

        final Map old_role_map=base_request.getRoleMap();
       
        try
        {
            ServletHolder servlet_holder=null;
            FilterChain chain=null;
           
            // find the servlet
            if (target.startsWith("/"))
            {
                // Look for the servlet by path
                PathMap.Entry entry=getHolderEntry(target);
                if (entry!=null)
                {
                    servlet_holder=(ServletHolder)entry.getValue();
                    base_request.setServletName(servlet_holder.getName());
                    base_request.setRoleMap(servlet_holder.getRoleMap());
                    if(Log.isDebugEnabled())Log.debug("servlet="+servlet_holder);
                   
                    String servlet_path_spec=(String)entry.getKey();
                    String servlet_path=entry.getMapped()!=null?entry.getMapped():PathMap.pathMatch(servlet_path_spec,target);
                    String path_info=PathMap.pathInfo(servlet_path_spec,target);
                   
                    if (type==INCLUDE)
                    {
                        base_request.setAttribute(Dispatcher.__INCLUDE_SERVLET_PATH,servlet_path);
                        base_request.setAttribute(Dispatcher.__INCLUDE_PATH_INFO, path_info);
                    }
                    else
                    {
                        base_request.setServletPath(servlet_path);
                        base_request.setPathInfo(path_info);
                    }
                   
                    if (servlet_holder!=null && _filterMappings!=null && _filterMappings.length>0)
                        chain=getFilterChain(type, target, servlet_holder);
                }     
            }
            else
            {
                // look for a servlet by name!
                servlet_holder=(ServletHolder)_servletNameMap.get(target);
                if (servlet_holder!=null && _filterMappings!=null && _filterMappings.length>0)
                {
                    base_request.setServletName(servlet_holder.getName());
                    chain=getFilterChain(type, null,servlet_holder);
                }
            }

            if (Log.isDebugEnabled())
            {
                Log.debug("chain="+chain);
                Log.debug("servlet holder="+servlet_holder);
            }

            // Do the filter/handling thang
            if (servlet_holder!=null)
            {
                base_request.setHandled(true);
                if (chain!=null)
                    chain.doFilter(request, response);
                else
                    servlet_holder.handle(request,response);
            }
            else
                notFound(request, response);
View Full Code Here

        }
       
        if (filters==null)
            return null;
       
        FilterChain chain = null;
        if (_filterChainsCached)
        {
            if (LazyList.size(filters) > 0)
                chain= new CachedChain(filters, servletHolder);
            synchronized(this)
View Full Code Here

    @Test
    public void doFilterShouldSpanUnitOfWork()
        throws Exception
    {
        // given
        final FilterChain chain = mock( FilterChain.class );
        final InOrder inOrder = inOrder( persistenceUnitsContainer, chain );

        final ServletRequest request = mock( ServletRequest.class );
        final ServletResponse response = mock( ServletResponse.class );
View Full Code Here

    @Test(expected = RuntimeException.class)
    public void doFilterShouldEndUnitOfWorkInCaseOfException()
        throws Exception
    {
        // given
        final FilterChain chain = mock( FilterChain.class );
        final InOrder inOrder = inOrder( persistenceUnitsContainer, chain );

        final ServletRequest request = mock( ServletRequest.class );
        final ServletResponse response = mock( ServletResponse.class );
View Full Code Here

        SampleFilter filter = new SampleFilter();
        config.setInitParameter("header", "<h1>header</h1>");
        config.setInitParameter("footer", "<h1>footer</h1>");
        filter.init(config);

        FilterChain mockFilterChain = new FilterChain()
        {
            public void doFilter(ServletRequest theRequest,
                ServletResponse theResponse) throws IOException, ServletException
            {
                PrintWriter writer = theResponse.getWriter();
View Full Code Here

TOP

Related Classes of javax.servlet.FilterChain

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.