Package javax.servlet

Examples of javax.servlet.FilterChain


        };
        // Add some parameters to test passthrough
        String [] fooParams = {"bar"};
        request.getParameterMap().put("foo", fooParams);
        ServletResponse response = new MockHttpServletResponse();
        FilterChain chain = new FilterChain()
        {

            public void doFilter(ServletRequest request, ServletResponse response)
                    throws IOException, ServletException
            {
View Full Code Here


    config.setProxyReceptor("/proxy/receptor");
    filter.setConfig(config);
    MockHttpServletRequest request = new MockHttpServletRequest();
    MockHttpServletResponse response = new MockHttpServletResponse();
    request.setRequestURI("/demo/proxy/receptor");
    FilterChain chain = mock(FilterChain.class);
    filter.setProxyGrantingTicketStorage(mock(ProxyGrantingTicketStorage.class));
    filter.doFilterHttp(request, response, chain);
    verifyZeroInteractions(chain);
    request.setRequestURI("/other");
    filter.doFilterHttp(request, response, chain);
View Full Code Here

  }

  public void doFilter(ServletRequest request, ServletResponse response)
    throws ServletException, IOException
  {
    FilterChain next = _nextFilterChainMapper.map(_uri,
                                                  _queryString,
                                                  _accept);

    next.doFilter(request, response);
  }
View Full Code Here

      DispatchRule rule = _rules[index];
   
      uri = rule.rewriteUri(uri, queryString);

      FilterChain next = mapChain(index + 1, type, uri, queryString, chain);

      return rule.map(type, uri, queryString, next, chain);
    } catch (ServletException e) {
      throw ConfigException.create(e);
    }
View Full Code Here

                         String queryString,
                         FilterChain next)
    throws ServletException
  {
    if (_regexp == null || (_regexp.matcher(uri)).find()) {
      FilterChain chain = createFilterChain(uri, queryString, next);

      for (int i = _filters.length - 1; i >= 0; i--) {
        chain = _filters[i].map(uri, queryString, chain);
      }
View Full Code Here

    Matcher matcher = null;

    if (_regexp == null || (matcher = _regexp.matcher(uri)).find()) {
      String target = rewriteTarget(matcher, uri, queryString);

      FilterChain chain = createDispatch(type, uri, queryString, target, tail);

      for (int i = _filters.length - 1; i >= 0; i--) {
        chain = _filters[i].map(uri, queryString, chain);
      }
View Full Code Here

                               DispatcherType type,
                               String uri, String queryString,
                               FilterChain chain)
    throws ServletException
  {
    FilterChain next = chain;
   
    int size = _ruleList.size();
   
    if (size <= index)
      return next;
View Full Code Here

  @Override
  public Invocation buildInvocation(Invocation invocation)
    throws ConfigException
  {
    if (_configException != null) {
      FilterChain chain = new ExceptionFilterChain(_configException);
      invocation.setFilterChain(chain);
      invocation.setDependency(AlwaysModified.create());

      return invocation;
    }
    else if (! _lifecycle.waitForActive(_startWaitTime)) {
      log.fine(this + " container is not active");
     
      int code = HttpServletResponse.SC_SERVICE_UNAVAILABLE;
      FilterChain chain = new ErrorFilterChain(code);
      invocation.setFilterChain(chain);

      invocation.setWebApp(getErrorWebApp());

      invocation.setDependency(AlwaysModified.create());

      return invocation ;
    }

    FilterChain chain;
   
    WebAppController controller = getWebAppController(invocation);
   
    WebApp webApp = getWebApp(invocation, controller, true);

    boolean isAlwaysModified;

    if (webApp != null) {
      invocation = webApp.buildInvocation(invocation);
      chain = invocation.getFilterChain();
      isAlwaysModified = false;
    }
    else if (controller != null){
      int code = HttpServletResponse.SC_SERVICE_UNAVAILABLE;
      chain = new ErrorFilterChain(code);
      ContextFilterChain contextChain = new ContextFilterChain(chain);
      contextChain.setErrorPageManager(getErrorPageManager());
      chain = contextChain;
      invocation.setFilterChain(contextChain);
      isAlwaysModified = true;
    }
    else {
      int code = HttpServletResponse.SC_NOT_FOUND;
      chain = new ErrorFilterChain(code);
      ContextFilterChain contextChain = new ContextFilterChain(chain);
      contextChain.setErrorPageManager(getErrorPageManager());
      chain = contextChain;
      invocation.setFilterChain(contextChain);
      isAlwaysModified = true;
    }

    if (_rewriteDispatch != null) {
      String uri = invocation.getURI();
      String queryString = invocation.getQueryString();

      FilterChain rewriteChain = _rewriteDispatch.map(DispatcherType.REQUEST,
                                                      uri,
                                                      queryString,
                                                      chain);

      if (rewriteChain != chain) {
View Full Code Here

  {
    if (! _lifecycle.waitForActive(_startWaitTime)) {
      UnavailableException e;
      e = new UnavailableException(invocation.getURI());

      FilterChain chain = new ExceptionFilterChain(e);
      invocation.setFilterChain(chain);
      invocation.setDependency(AlwaysModified.create());
      return null;
    }

    WebAppController appController = getWebAppController(invocation);

    if (appController == null) {
      String url = invocation.getURI();

      FileNotFoundException e = new FileNotFoundException(url);

      FilterChain chain = new ExceptionFilterChain(e);
      invocation.setFilterChain(chain);
      invocation.setDependency(AlwaysModified.create());
      return null;
    }

    WebApp webApp = appController.subrequest();

    if (webApp == null) {
      UnavailableException e;
      e = new UnavailableException(invocation.getURI());

      FilterChain chain = new ExceptionFilterChain(e);
      invocation.setFilterChain(chain);
      invocation.setDependency(AlwaysModified.create());
      return null;
    }
View Full Code Here

  public void handleAlarm(Alarm alarm)
  {
    try {
      log.fine(this + " cron");

      FilterChain chain = createServletChain();

      ServletRequest req = new StubServletRequest();
      ServletResponse res = new StubServletResponse();

      chain.doFilter(req, res);
    } catch (Throwable e) {
      log.log(Level.WARNING, e.toString(), e);
    } finally {
      long now = Alarm.getCurrentTime();
      long nextTime = nextTimeout(now);
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.