Check for action forwarding
We expect the request parameter to be of the form<br/>
forward=name<p>.

@param request  Needed to locate session
@return String  forward to here. null if no forward found.
@throws Throwable
484796
private String checkForwardto(final HttpServletRequest request) throws Throwable {
    String reqpar = request.getParameter("forwardto");
    return reqpar;
  }
276766
public static void setForwardedFormBean( ServletRequest request, ActionForm form )
    {
        if ( form == null )
        {
            request.removeAttribute( FORWARDED_FORMBEAN_ATTR );
        }
        else
        {
            request.setAttribute( FORWARDED_FORMBEAN_ATTR, form );
        }
    }
1041913
public static String getRequestURI(final HttpServletRequest request) {
		return (String) request.getSession(true).getAttribute(STORE_URI_KEY);
	}
946602
public static int getIntParam(final HttpServletRequest request, final String name)
      throws ServletException {
    final String p = getParam(request, name);
    return Integer.parseInt(p);
  }
1256930
public String DoPut(Request request) throws Exception {

        Unirest.setHttpClient(getHttpClient());

        if (request.client == null) {
            throw new Exception("client must NOT null");
        }

        String buf = "";
        if (request.client.GetEnableCrypto()) {
            buf = request.crypto.signAndEncrypt(request.body.toString().getBytes());
        } else {
            buf = request.body.toString();
        }

        Map<String, String> mapHeader = Utils.JsonToMap(request.header);
        mapHeader.put(Headers.APIKeyHeader, request.client.GetApiKey());

        if (request.client.GetRouteTag() != "") {
            mapHeader.put(Headers.FabioRouteTagHeader, request.client.GetRouteTag());
            mapHeader.put(Headers.RouteTagHeader, request.client.GetRouteTag());
        }

        HttpResponse<String> res = Unirest.put(request.url).headers(mapHeader).body(buf).asString();

        String respData = res.getBody();

        System.out.println("Got remote cipher response: " + respData);

        String oriData = "";
        if (request.client.GetEnableCrypto()) {
            oriData = request.crypto.decryptAndVerify(respData.getBytes());
        } else {
            oriData = respData;
        }
        return oriData;

    }
1329367
public static int getPage(final HttpServletRequest request) {
        int ret = 1;
        final String p = request.getParameter("p");
        if (Strings.isNumeric(p)) {
            try {
                ret = Integer.parseInt(p);
            } catch (final Exception e) {
                // ignored
            }
        }

        if (1 > ret) {
            ret = 1;
        }

        return ret;
    }
1008393
public GetSessionTokenResponse getSessionToken(GetSessionTokenRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");
        checkIsTrue(request.getDurationSeconds() > 0, "the durationSeconds parameter should be greater than zero");

        InternalRequest internalRequest = new InternalRequest(HttpMethodName.POST,
                HttpUtils.appendUri(this.getEndpoint(), URL_PREFIX, GET_SESSION_TOKEN_PATH));
        if (request.getDurationSeconds() != null) {
            internalRequest.addParameter("durationSeconds", String.valueOf(request.getDurationSeconds()));
        }
        internalRequest.setCredentials(request.getRequestCredentials());
        internalRequest.addHeader(Headers.CONTENT_LENGTH,
                String.valueOf(request.getAcl() == null ? 0 : request.getAcl().length()));
        internalRequest.addHeader(Headers.CONTENT_TYPE, "application/json");
        if (request.getAcl() != null) {
            internalRequest.setContent(RestartableInputStream.wrap(request.getAcl().getBytes()));
        }
        return this.invokeHttpClient(internalRequest, GetSessionTokenResponse.class);
    }
359787
private String doAction(HttpServletRequest request)
        throws IOException
    {
        String action=request.getParameter("A");
        if ("exit all servers".equalsIgnoreCase(action))
        {
            new Thread(new Runnable()
                {
                    public void run()
                    {
                        try{Thread.sleep(1000);}
                        catch(Exception e){LogSupport.ignore(log,e);}
                        log.info("Stopping All servers");
                        Iterator s=_servers.iterator();
                        while(s.hasNext())
                        {
                            HttpServer server=(HttpServer)s.next();
                            try{server.stop();}
                            catch(Exception e){LogSupport.ignore(log,e);}
                        }
                        log.info("Exiting JVM");
                        System.exit(1);
                    }
                }).start();
            
            throw new HttpException(HttpResponse.__503_Service_Unavailable);
        }
        
        boolean start="start".equalsIgnoreCase(action);
        String id=request.getParameter("ID");

        StringTokenizer tok=new StringTokenizer(id,":");
        int tokens=tok.countTokens();
        String target=null;
        
        try{
            target=tok.nextToken();
            int t=Integer.parseInt(target);
            Iterator s=_servers.iterator();
            HttpServer server=null;
            while(s.hasNext() && t>=0)
                if (t--==0)
                    server=(HttpServer)s.next();
                else
                    s.next();
            
            if (tokens==1)
            {
                // Server stop/start
                if (start) server.start();
                else server.stop();
            }
            else if (tokens==3)
            {
                // Listener stop/start
                String l=tok.nextToken()+":"+tok.nextToken();

                HttpListener[] listeners=server.getListeners();
                for (int i2=0;i2<listeners.length;i2++)
                {
                    HttpListener listener = listeners[i2];
                    if (listener.toString().indexOf(l)>=0)
                    {
                        if (start) listener.start();
                        else listener.stop();
                    }
                }
            }
            else
            {
                String host=tok.nextToken();
                if ("null".equals(host))
                    host=null;
                
                String contextPath=tok.nextToken();
                target+=":"+host+":"+contextPath;
                if (contextPath.length()>1)
                    contextPath+="/*";
                int contextIndex=Integer.parseInt(tok.nextToken());
                target+=":"+contextIndex;
                HttpContext
                    context=server.getContext(host,contextPath,contextIndex);
                
                if (tokens==4)
                {
                    // Context stop/start
                    if (start) context.start();
                    else context.stop();
                }
                else if (tokens==5)
                {
                    // Handler stop/start
                    int handlerIndex=Integer.parseInt(tok.nextToken());
                    HttpHandler handler=context.getHandlers()[handlerIndex];
                    
                    if (start) handler.start();
                    else handler.stop();
                }
            }
        }
        catch(Exception e)
        {
            log.warn(LogSupport.EXCEPTION,e);
        }
        catch(Error e)
        {
            log.warn(LogSupport.EXCEPTION,e);
        }
        
        return target;
    }
966157
protected String checkLogOut(final HttpServletRequest request,
                               final UtilActionForm form)
               throws Throwable {
    final String reqUser = request.getRemoteUser();

    final boolean forceLogout =
            !Util.equalsString(reqUser, form.getCurrentUser());

    final String temp = request.getParameter(requestLogout);


    if (forceLogout || (temp != null)) {
      final HttpSession sess = request.getSession(false);

      if ((sess != null) && logOutCleanup(request, form)) {
        sess.invalidate();
      }
      return forwardLoggedOut;
    }

    return null;
  }
349274
@Override
	public void process(Request request)
	{
		String name = getRouteName(request);

		if (name == null || name.isEmpty()) return;

		if (!ROUTE_TIMERS.containsKey(name))
		{
			ROUTE_TIMERS.putIfAbsent(name, metrics.timer(getTimerName(name)));
		}

		if (!EXCEPTION_COUNTERS_BY_ROUTE.containsKey(name))
		{
			EXCEPTION_COUNTERS_BY_ROUTE.putIfAbsent(name, metrics.counter(getExceptionCounterName(name)));
		}
	}
786524
public PauseSessionResponse pauseSession(PauseSessionRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");
        checkStringNotEmpty(request.getSessionId(), "The parameter sessionId should NOT be null or empty string.");
        InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_SESSION,
                request.getSessionId());
        internalRequest.addParameter(PAUSE, null);
        return invokeHttpClient(internalRequest, PauseSessionResponse.class);
    }
9590
public static String getHeader(HttpServletRequest request, String header) {

		// noting to search in or nothing to be found
		if (request == null || StringUtils.isNullOrEmptyTrimmed(header)) {
			return null;
		}

		return request.getHeader(header);
	}
256800
@Override
	public void handleRequest(final Request request) {
		if (isDisabled()) {
			// Protect against client-side tampering of disabled/read-only fields.
			return;
		}

		if (isMenuPresent(request)) {
			String requestValue = request.getParameter(getId());

			if (requestValue != null) {
				// Only process on a POST
				if (!"POST".equals(request.getMethod())) {
					LOG.warn("Menu item on a request that is not a POST. Will be ignored.");
					return;
				}

				// Execute associated action, if set
				final Action action = getAction();

				if (action != null) {
					final ActionEvent event = new ActionEvent(this, this.getActionCommand(), this.
							getActionObject());

					Runnable later = new Runnable() {
						@Override
						public void run() {
							action.execute(event);
						}
					};

					invokeLater(later);
				}
			}
		}
	}
39396
public static ServletRequest getOuterServletRequest( ServletRequest request )
    {
        ScopedRequest scopedRequest = unwrapRequest( request );
        return scopedRequest != null ? scopedRequest.getOuterRequest() : request;
    }
166327
public static String getParameter(final Request request, final String parameterName)
	{
		String parameterValue = request.getRequestParameters().getParameterValue(parameterName)
			.toString();
		if ((parameterValue == null) || parameterValue.isEmpty())
		{
			parameterValue = request.getPostParameters().getParameterValue(parameterName)
				.toString();
		}
		if ((parameterValue == null) || parameterValue.isEmpty())
		{
			parameterValue = request.getQueryParameters().getParameterValue(parameterName)
				.toString();
		}
		if ((parameterValue == null) || parameterValue.isEmpty())
		{
			parameterValue = request.getRequestParameters().getParameterValue(parameterName)
				.toString();
		}
		return parameterValue;
	}
329820
private String getRequestURI(final HttpServletRequest request) {
        String ret = (String) request.getAttribute(Keys.HttpRequest.REQUEST_URI);
        if (StringUtils.isBlank(ret)) {
            ret = request.getRequestURI();
        }

        return ret;
    }
633090
protected String getMethod(HttpServletRequest request) {
        String uri = request.getRequestURI();
        String q = uri.substring((request.getContextPath()+request.getServletPath()).length()+1);
        int i = q.indexOf(".");
        String method = null;
        if(i>0){
            method = q.substring(i+1);
        }
        return method;
    }