<p>
Checks whether the request processing can be delegated to one of registered {@link RequestDelegationService}s.
</p>
<p>
<p>
If not, delegates processing to {@link #doFilterWarp(HttpServletRequest, HttpServletResponse, FilterChain)}.
</p>
765583
private void doFilterHttp(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
        throws IOException, ServletException {

        request.setAttribute(ARQUILLIAN_MANAGER_ATTRIBUTE, manager);

        boolean isDelegated = delegator.tryDelegateRequest(request, response, filterChain);

        if (!isDelegated) {
            doFilterWarp(request, response, filterChain);
        }
    }
1051584
@Override
  public boolean service(RequestBaratine request)
  {
    try {
      if (! _predicate.test(request)) {
        return false;
      }
    
      request.route(this);
      /*
      request.requestProxy(_proxy);
      
      request.views(_views);
      */

      if (_services.length > 1) {
        RequestFilter requestChain = new RequestFilter(request, _services);
        requestChain.ok();
        
        return true;
      }
      else {
        _service.service((RequestWeb) request);
      }
    } catch (Exception e) {
      log.log(Level.WARNING, e.toString(), e);
    }
    
    return true;
  }
246448
public static boolean process(final URI uri, final SpanFilterType type) {
        final String methodName = "process";

        boolean result = true;

        // Copy the static reference locally so that it doesn't matter if the static list
        // is updated while we're processing since that will just overwrite the reference
        final SpanFilter[] filters = allFilters;

        for (int i = 0; i < filters.length; i++) {
            result = filters[i].process(result, uri, type);

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, methodName, "filter " + filters[i] + " set result to " + result);
            }
        }

        return result;
    }
341942
public void doFilter(ServletRequest request,
                         ServletResponse response,
                         FilterChain chain)
	throws IOException, ServletException
    {
        String path=((HttpServletRequest)request).getServletPath();
        if (welcome!=null && path.endsWith("/"))
            request.getRequestDispatcher(path+welcome).forward(request,response);
        else
            chain.doFilter(request, response);
    }
802911
@Override
    public void doFilter(ActionRequest request, ActionResponse response, FilterChain chain) throws IOException,
            PortletException {
        doCommonFilter(request, response, chain);
    }
739809
private boolean canDelegate(RequestDelegationService delegate, HttpServletRequest request) {
        try {
            return delegate.canDelegate(request);
        } catch (Exception e) {
            log.log(Level.SEVERE,
                String.format("The delegation service can't check the delegability of the request: %s", e.getCause()),
                e.getCause());
            return false;
        }
    }
993889
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
		HttpServletRequest hreq = (HttpServletRequest)request;
		HttpServletResponse hresp = (HttpServletResponse)response;
		String perm = aaf_type+hreq.getPathInfo()+'|'+hreq.getMethod();
		if(hreq.isUserInRole(perm)) {
			chain.doFilter(request, response);
		} else {
			log.audit("PathFilter has denied",hreq.getUserPrincipal().getName(),"access to",perm);
			hresp.sendError(403,not_authorized_msg);
		}
	}
877818
private boolean isProcessTriggerOnly(final ComponentWithContext triggerWithContext,
			final AjaxOperation operation) {

		// Target container implies only process the trigger or is Internal Ajax
		if (operation.getTargetContainerId() != null || operation.isInternalAjaxRequest()) {
			return true;
		}

		WComponent trigger = triggerWithContext.getComponent();

		// Check if trigger is a polling AJAX control
		if (trigger instanceof WAjaxControl) {
			// Get user context
			UIContext uic = triggerWithContext.getContext();
			UIContextHolder.pushContext(uic);
			try {
				WAjaxControl ajax = (WAjaxControl) trigger;
				// Is a polling region so only process trigger
				if (ajax.getDelay() > 0) {
					return true;
				}
			} finally {
				UIContextHolder.popContext();
			}
		}

		return false;
	}
432608
public void doFilter(ServletRequest request,
                         ServletResponse response,
                         FilterChain chain)
	throws IOException, ServletException
    {
        HttpServletRequest  srequest  = (HttpServletRequest)request;
        HttpServletResponse sresponse = (HttpServletResponse)response;
        Request requestWrapper=null;
        Response responseWrapper=null;
        boolean root_filter=false;
        

        // Do we need a root wrapper?
        ThreadState state = state();
        if (_unwrappedDispatchSupported || LazyList.size(_requestAttributeListeners)>0 )
        {
            if (srequest instanceof ServletHttpRequest)
            {
                request=state.rootRequest=requestWrapper=new Request(srequest);
                response=state.rootResponse=responseWrapper=new Response(sresponse);
                root_filter=true;
            }
            else
            {
                requestWrapper=state.rootRequest;
                responseWrapper=state.rootResponse;
            }
        }
        
        // Is this the first time this request has been in this _context?
        boolean first_in_context=root_filter ||
        	requestWrapper!=null && 
        	requestWrapper.getRequest()!=null && requestWrapper.getRequest() instanceof Dispatcher.DispatcherRequest &&
        	((Dispatcher.DispatcherRequest)requestWrapper.getRequest()).crossContext();
        
        if (first_in_context)
        {
            requestInitialized(request);
            
            if (requestWrapper!=null && LazyList.size(_requestAttributeListeners)>0)
                requestWrapper.addContextFilter(this);
        }
        
        // setup dispatch
        boolean dispatch=false;
        if (_unwrappedDispatchSupported && state.dispatchRequest!=null)
        {
            dispatch=true;
            requestWrapper.pushWrapper(state.dispatchRequest);
            responseWrapper.pushWrapper(state.dispatchResponse);
            state.dispatchRequest=null;
            state.dispatchResponse=null;
        }
        
        try
        {
            chain.doFilter(request, response);   
        }
        finally
        {
            if (first_in_context)
            {
                requestDestroyed(request);
                if (requestWrapper!=null && LazyList.size(_requestAttributeListeners)>0)
                    requestWrapper.delContextFilter(this);
            }
            
            if (root_filter)
                state.clear();
            
            if (dispatch)
            {
                requestWrapper.popWrapper();
                responseWrapper.popWrapper();
            }
        }
    }
242176
@Override
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {

		if (!(request instanceof HttpServletRequest)){
			chain.doFilter(request, response);
			return;
		}

		HttpServletRequest httpServletRequest = ((HttpServletRequest) request);
		HttpServletResponse httpServletResponse = ((HttpServletResponse) response);

		if(WebUIConfig.getInstance().getAuthentication().isAuthenticationEnabled()
				&& !isAuthAction(httpServletRequest.getRequestURI())) {
			// Means current page is protected by authorization

			if (isAuthorized(httpServletRequest)) {
				httpServletRequest.setAttribute("mskIsAuthorized", true); // Enables logout button
			} else {

				// Reset auth cookie for cases it was corrupted (encryption key is changed or something like that)
				Cookie authCookie = new Cookie(AuthConstants.AUTH_COOKIE_NAME, "");
				authCookie.setMaxAge(0);
				httpServletResponse.addCookie(authCookie);

				// User be redirected to this url after success authorization
				httpServletRequest.getSession().setAttribute(
						AuthConstants.LOGIN_REFER_PAGE_SESSION_ATTR_NAME,
						httpServletRequest.getRequestURL().toString()
				);
				// Redirect to login page
				httpServletResponse.sendRedirect("mskSignIn");
				return;

			}

		}

		super.doFilter(request, response, chain);

	}
284564
protected void process( HttpServletRequest request, HttpServletResponse response )
        throws IOException, ServletException
    {
        //
        // First wrap the request with an object that contains request-scoped values that our runtime uses.  This
        // is faster than sticking everything into attributes on the request (then basically reading from a HashMap).
        //
        PageFlowRequestWrapper requestWrapper = PageFlowRequestWrapper.wrapRequest( request );
        request = requestWrapper;
        
        ServletContext servletContext = getServletContext();
        String modulePath = PageFlowUtils.getModulePathForRelativeURI( InternalUtils.getDecodedServletPath( request ) );
        ModuleConfig registeredApp;
        
        //
        // Get the registered Struts module for the request.
        //
        registeredApp = getModuleConfig( modulePath, request, response );
        
        //
        // If we've dynamically registered a module, then we need to override the base process() behavior to select the
        // module.  Note that we don't want to synchronize the call to process().
        //
        if ( registeredApp != null )
        {
            //
            // Try to select the appropriate Struts module and delegate to its RequestProcessor.
            //
            ModuleConfig moduleConfig = InternalUtils.selectModule( modulePath, request, servletContext );
            
            // If this module came from an abstract page flow controller class, send an error.
            ControllerConfig cc = moduleConfig.getControllerConfig();
            if (cc instanceof PageFlowControllerConfig && ((PageFlowControllerConfig) cc).isAbstract()) {
                InternalUtils.sendDevTimeError( "PageFlow_AbstractPageFlow", null, HttpServletResponse.SC_NOT_FOUND, 
                                                request, response, servletContext,
                                                new Object[]{ modulePath } );
                return;
            }
                    
            RequestProcessor requestProcessor = getRequestProcessor( moduleConfig );
            requestProcessor.process( request, response );
        }
        else
        {
            //
            // Here, we're checking to see if this was a module that was registered externally by Struts (not by this
            // servlet).  This is the same as the base process() behavior, but it checks for a missing
            // module-configuration.
            //
            ModuleConfig moduleConfig = null;
            
            if ( InternalUtils.getModuleConfig( RequestUtils.getModuleName( request, servletContext ), servletContext ) != null )
            {
                String modulePrefix = RequestUtils.getModuleName( request, servletContext );
                moduleConfig = InternalUtils.selectModule( modulePrefix, request, servletContext );
            }
            
            String servletPath = InternalUtils.getDecodedServletPath( request );
            RequestProcessor rp = moduleConfig != null ? getRequestProcessor( moduleConfig ) : null;
            
            if ( rp != null && moduleCanHandlePath( moduleConfig, rp, servletPath ) )
            {
                rp.process( request, response );
            }
            else
            {
                //
                // Initialize the ServletContext in the request.  Often, we need access to the ServletContext when we only
                // have a ServletRequest.
                //
                InternalUtils.setServletContext( request, getServletContext() );
                
                if ( processUnhandledAction( request, response, servletPath ) ) return;
                
                String originalServletPath = requestWrapper.getOriginalServletPath();
                if ( originalServletPath != null )
                {
                    servletPath = originalServletPath;
                    modulePath = PageFlowUtils.getModulePathForRelativeURI( originalServletPath );
                }
                
                if ( _log.isErrorEnabled() )
                {
                    InternalStringBuilder msg = new InternalStringBuilder( "No module configuration registered for " );
                    msg.append( servletPath ).append( " (module path " ).append( modulePath ).append( ")." );
                    _log.error( msg.toString() );
                }

                //
                // If we're not in production mode, send a diagnostic on the response; otherwise, simply send a 404.
                //
                if ( modulePath.length() == 0 ) modulePath = "/";
                InternalUtils.sendDevTimeError( "PageFlow_NoModuleConf", null, HttpServletResponse.SC_NOT_FOUND, 
                                                request, response, servletContext,
                                                new Object[]{ servletPath, modulePath } );
            }
        }
    }
115735
@Override
    public final void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain chain) throws IOException, ServletException {
        if (ProcessingPosition.PRE == this.processingPosition || ProcessingPosition.BOTH == this.processingPosition) {
            this.doProcessing(servletRequest);
        }

        chain.doFilter(servletRequest, servletResponse);

        if (ProcessingPosition.POST == this.processingPosition || ProcessingPosition.BOTH == this.processingPosition) {
            this.doProcessing(servletRequest);
        }
    }
865273
protected boolean requiresAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) {
    //copied from org.springframework.security.ui.AbstractProcessingFilter.requiresAuthentication
    String uri = request.getRequestURI();
    int pathParamIndex = uri.indexOf(';');

    if (pathParamIndex > 0) {
      // strip everything after the first semi-colon
      uri = uri.substring(0, pathParamIndex);
    }

    if ("".equals(request.getContextPath())) {
      return uri.endsWith(filterProcessesUrl);
    }

    boolean match = uri.endsWith(request.getContextPath() + filterProcessesUrl);
    if (log.isDebugEnabled()) {
      log.debug(uri + (match ? " matches " : " does not match ") + filterProcessesUrl);
    }
    return match;
  }
1225145
protected void doFilterImpl(ServletRequest pRequest, ServletResponse pResponse, FilterChain pChain) throws IOException, ServletException {
        // TODO: Max size configuration, to avoid DOS attacks? OutOfMemory

        // Size parameters
        int width = ServletUtil.getIntParameter(pRequest, sizeWidthParam, -1);
        int height = ServletUtil.getIntParameter(pRequest, sizeHeightParam, -1);
        if (width > 0 || height > 0) {
            pRequest.setAttribute(ImageServletResponse.ATTRIB_SIZE, new Dimension(width, height));
        }

        // Size uniform/percent
        boolean uniform = ServletUtil.getBooleanParameter(pRequest, sizeUniformParam, true);
        if (!uniform) {
            pRequest.setAttribute(ImageServletResponse.ATTRIB_SIZE_UNIFORM, Boolean.FALSE);
        }
        boolean percent = ServletUtil.getBooleanParameter(pRequest, sizePercentParam, false);
        if (percent) {
            pRequest.setAttribute(ImageServletResponse.ATTRIB_SIZE_PERCENT, Boolean.TRUE);
        }

        // Area of interest parameters
        int x = ServletUtil.getIntParameter(pRequest, regionLeftParam, -1); // Default is center
        int y = ServletUtil.getIntParameter(pRequest, regionTopParam, -1);  // Default is center
        width = ServletUtil.getIntParameter(pRequest, regionWidthParam, -1);
        height = ServletUtil.getIntParameter(pRequest, regionHeightParam, -1);
        if (width > 0 || height > 0) {
            pRequest.setAttribute(ImageServletResponse.ATTRIB_AOI, new Rectangle(x, y, width, height));
        }

        // AOI uniform/percent
        uniform = ServletUtil.getBooleanParameter(pRequest, regionUniformParam, false);
        if (uniform) {
            pRequest.setAttribute(ImageServletResponse.ATTRIB_SIZE_UNIFORM, Boolean.TRUE);
        }
        percent = ServletUtil.getBooleanParameter(pRequest, regionPercentParam, false);
        if (percent) {
            pRequest.setAttribute(ImageServletResponse.ATTRIB_SIZE_PERCENT, Boolean.TRUE);
        }

        super.doFilterImpl(pRequest, pResponse, pChain);
    }
334834
public boolean validateCSeq(MobicentsSipServletRequest sipServletRequest) {
		final Request request = (Request) sipServletRequest.getMessage();
		final long localCseq = cseq;
		final long remoteCSeq =  ((CSeqHeader) request.getHeader(CSeqHeader.NAME)).getSeqNumber();
		final String method = request.getMethod();
		final boolean isAck = Request.ACK.equalsIgnoreCase(method);
		final boolean isPrackCancel= Request.PRACK.equalsIgnoreCase(method) || Request.CANCEL.equalsIgnoreCase(method);
		boolean resetLocalCSeq = true;

		if(isAck && isAckReceived(remoteCSeq)) {
			// Filter out ACK retransmissions for JSIP patch for http://code.google.com/p/mobicents/issues/detail?id=766
			logger.debug("ACK filtered out as a retransmission. This Sip Session already has been ACKed.");
			return false;
		}
		if(isAck) {
			if(logger.isDebugEnabled()) {
				logger.debug("localCSeq : " + localCseq + ", remoteCSeq : " + remoteCSeq);
			}
			setAckReceived(remoteCSeq, true);
		}
		if(localCseq == remoteCSeq && !isAck) {
			logger.debug("dropping retransmission " + request + " since it matches the current sip session cseq " + localCseq);
			return false;
		}
		if(localCseq > remoteCSeq) {
			if(!isAck && !isPrackCancel) {
				logger.error("CSeq out of order for the following request " + sipServletRequest);
				if(Request.INVITE.equalsIgnoreCase(method)) {
					setAckReceived(remoteCSeq, false);
				}
				final SipServletResponse response = sipServletRequest.createResponse(Response.SERVER_INTERNAL_ERROR, "CSeq out of order");
				try {
					response.send();
				} catch (IOException e) {
					logger.error("Can not send error response", e);
				}
				return false;
			} else {
				// Issue 1714 : if the local cseq is greater then the remote one don't reset the local cseq
				resetLocalCSeq= false;
			}
		}
		if(logger.isDebugEnabled()) {
			logger.debug("resetLocalCSeq : " + resetLocalCSeq);
		}
		if(resetLocalCSeq) {
			setCseq(remoteCSeq);
			if(Request.INVITE.equalsIgnoreCase(method)) {
				setAckReceived(remoteCSeq, false);
			}
		}
		return true;
	}
590912
private void checkHandler(SipServletRequest request) {
		MobicentsSipSession sipSessionImpl = (MobicentsSipSession)request.getSession();
		if(sipSessionImpl.getHandler() == null) {
			try {
				sipSessionImpl.setHandler(sipContext.getServletHandler());
//				((SipApplicationSessionImpl)sipSessionImpl.getApplicationSession()).setSipContext(sipContext);
			} catch (ServletException se) {
				//should never happen
				logger.error("Impossible to set the default handler on the newly created request "+ request.toString(),se);
			} 
		}
	}
677417
public synchronized boolean tryDelegateResponseHandling(Response<ByteArray, Object> response) {
        if(responseHandlingCutoff) {
            return false;
        } else {
            responseQueue.offer(response);
            this.notifyAll();
            return true;
        }
    }