Service a request.

@param request the http request facade
@param response the http response facade
493283
@Override
  public boolean service(RequestBaratine request)
  {
    request.status(HttpStatus.NOT_FOUND);
    
    request.write("Not found: " + request.uri() + "\n");
    request.ok();
    
    return true;
  }
79295
public void service(HttpServletRequest req, HttpServletResponse res) 
        throws ServletException, IOException
    {
    	if ((proxyURLPrefix == null) || (proxyURLPrefix.length() == 0))
    	{	// No proxy specified
        	super.service(req, res);
    		return;
    	}
		ServletOutputStream streamOut = res.getOutputStream();
    	try {
    		String proxyURLString = getProxyURLString(req);
    		HttpRequestBase httpRequest = getHttpRequest(req, proxyURLString);
    		addHeaders(req, httpRequest);
    		this.getDataFromClient(httpRequest, streamOut);
		} catch (Exception e) {
			displayErrorInHtml(streamOut, e);
		}
    }
848045
public static boolean isSaneRequest(HttpServletRequest request) {
        if (request != null && request.getMethod() != null) {
            return true;
        }
        return false;
    }
820277
@Override
	public void serviceRequest(final Request request) {
		// Only apply for POST
		if ("POST".equals(request.getMethod())) {
			// Apply Controls (Use values on request)
			SubordinateControlHelper.applyRegisteredControls(request, true);
		}

		// Service Request
		super.serviceRequest(request);
	}
704437
@RequestMapping
    public void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setHeader("Pragma", "no-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);

        // create the redirect URL, adding fname and args parameters if necessary
        String redirectTarget = null;

        final String refUrl = request.getParameter(REFERER_URL_PARAM);
        final URL redirectLocation = parseLocalRefUrl(request, refUrl);
        if (redirectLocation != null) {
            redirectTarget = redirectLocation.toString();
        }

        if (redirectTarget == null) {
            /* Grab the target functional name, if any, off the login request.
             * Also any arguments for the target. We will pass them  along after authentication.
             */
            String targetFname = request.getParameter("uP_fname");

            if (targetFname == null) {
                final IPortalUrlBuilder defaultUrl = this.portalUrlProvider.getDefaultUrl(request);
                redirectTarget = defaultUrl.getUrlString();
            } else {
                try {
                    final IPortalUrlBuilder urlBuilder =
                            this.portalUrlProvider.getPortalUrlBuilderByPortletFName(
                                    request, targetFname, UrlType.RENDER);

                    Enumeration<String> e = request.getParameterNames();
                    while (e.hasMoreElements()) {
                        String paramName = e.nextElement();
                        if (!paramName.equals("uP_fname")) {
                            urlBuilder.addParameter(
                                    paramName, request.getParameterValues(paramName));
                        }
                    }

                    redirectTarget = urlBuilder.getUrlString();
                } catch (IllegalArgumentException e) {
                    final IPortalUrlBuilder defaultUrl =
                            this.portalUrlProvider.getDefaultUrl(request);
                    redirectTarget = defaultUrl.getUrlString();
                }
            }
        }

        IPerson person = null;

        final Object authError =
                request.getSession(false).getAttribute(LoginController.AUTH_ERROR_KEY);
        if (authError == null || !((Boolean) authError)) {
            person = this.personManager.getPerson(request);
        }

        if (person == null || !person.getSecurityContext().isAuthenticated()) {
            if (request.getMethod().equals("POST"))
                request.getSession(false).setAttribute(AUTH_ATTEMPTED_KEY, "true");
            // Preserve the attempted username so it can be redisplayed to the user
            String attemptedUserName = request.getParameter("userName");
            if (attemptedUserName != null)
                request.getSession(false)
                        .setAttribute(ATTEMPTED_USERNAME_KEY, request.getParameter("userName"));
        }

        final String encodedRedirectURL = response.encodeRedirectURL(redirectTarget);

        if (log.isDebugEnabled()) {
            log.debug("Redirecting to " + redirectTarget);
        }

        response.sendRedirect(encodedRedirectURL);
    }
416242
JsonNode requestResponse(final JsonNode request) {
        try {

            // write request
            String str = request.toString();
            this.stdin.write(str + "\n");
            this.stdin.flush();

            // read response
            JsonNode resp = readNextResponse();

            // throw if this is an error response
            if (resp.has("error")) {
                return processErrorResponse(resp);
            }

            // process synchronous callbacks (which 'interrupt' the response flow).
            if (resp.has("callback")) {
                return processCallbackResponse(resp);
            }

            // null "ok" means undefined result (or void).
            return resp.get("ok");

        } catch (IOException e) {
            throw new JsiiException("Unable to send request to jsii-runtime: " + e.toString(), e);
        }
    }
307914
public void onRequest(HttpServletRequest request, HttpServletResponse response) {
        AbstractHttpServletActivity activity = null;

        final HttpServletRequestWrapper requestWrapper = new HttpServletRequestWrapper(request);
        final HttpSessionWrapper sessionWrapper = (HttpSessionWrapper) requestWrapper.getSession(false);
        final HttpServletRequestEvent requestEvent = new HttpServletRequestEventImpl(requestWrapper, response, this);
        final FireableEventType eventType = eventIdCache.getEventType(eventLookup, requestEvent, sessionWrapper);

        response.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED);

        if (eventIDFilter.filterEvent(eventType)) {
            if (tracer.isInfoEnabled()) {
                tracer.info("Request event filtered: " + requestEvent);
            }
            // dude, get out of here
            return;
        }

        boolean createActivity = true;
        if (sessionWrapper == null) {
            // create request activity
            activity = new HttpServletRequestActivityImpl();
        } else {
            activity = new HttpSessionActivityImpl(sessionWrapper);
            if (sessionWrapper.getResourceEntryPoint() != null) {
                createActivity = false;
            }
        }

        if (createActivity) {
            // we have a session but its not activity yet, add it
            try {
                if (sessionWrapper != null) {
                    sessionWrapper.setResourceEntryPoint(this.name);
                }
                sleeEndpoint.startActivity(activity, activity);
            } catch (ActivityAlreadyExistsException e) {
                if (tracer.isFineEnabled()) {
                    tracer.fine("Failed to add activity " + activity, e);
                }
                // proceed, may be due to fail over
            } catch (Throwable e) {
                tracer.severe("Failed to add activity " + activity, e);
                return;
            }
        }

        if (tracer.isFineEnabled()) {
            tracer.fine("Firing event " + requestEvent + " in activity " + activity);
        }

        final Object lock = requestLock.getLock(requestEvent);
        synchronized (lock) {
            try {
                sleeEndpoint.fireEvent(activity, eventType, requestEvent, null, null, EventFlags.REQUEST_EVENT_UNREFERENCED_CALLBACK);
                // block thread until event has been processed
                lock.wait(httpRequestTimeout);
                // the event was unreferenced or 15s timeout, if the activity is the request then end it
                if (sessionWrapper == null) {
                    endActivity(activity);
                }
            } catch (Throwable e) {
                tracer.severe("Failure while firing event " + requestEvent + " on activity " + activity, e);
            }
        }
    }
1259529
@Override
    public void handleRequest(HttpServletRequest request, HttpServletResponse response) {
        handleRequest(request, response, null, null, false);
    }
1024280
@Override
	public void serviceRequest(final Request request) {
		// Reset the focus for this new request.
		UIContext uic = UIContextHolder.getCurrent();
		uic.setFocussed(null, null);

		// We've hit the action phase, so we do want focus on this app.
		uic.setFocusRequired(true);

		super.serviceRequest(request);
	}
1308319
public static ServiceContext createServiceContext(ServletRequest request) {
        if (!(request instanceof HttpServletRequest)) {
            throw new IllegalArgumentException("Expected HttpServletRequest");
        }
        return createServiceContext((HttpServletRequest) request);
    }
440762
public void doWithRequest(
                    final ClientHttpRequest request
                    )
    throws IOException
    {
        HttpHeaders  headers = request.getHeaders();
        headers.setContentType( _mediaType );

        long  size = IoUtil.copy( _input, new OutputStreamWriter( request.getBody() ) );
        headers.setContentLength( size );
    }
385960
@Override
  public void service(RequestWeb request)
  {
    try {
      if (! request.method().equals("OPTIONS")) {
        request.ok();
        return;
      }
      
      if (_crossOrigin.allowCredentials())
        request.header(ALLOW_CREDENTIALS, "true");

      //allow-origin
      String[] origin = _crossOrigin.value();

      if (origin.length == 0)
        origin = _crossOrigin.allowOrigin();

      if (origin.length > 0)
        request.header(ALLOW_ORIGIN, join(origin));

      //allow methods
      HttpMethod[] methods = _crossOrigin.allowMethods();

      if (methods.length > 0) {
        request.header(ALLOW_METHODS, join(methods));
      }
      else if (_httpMethod != null) {
        request.header(ALLOW_METHODS, _httpMethod.toString());
      }

      //allow headers
      String[] allowHeaders = _crossOrigin.allowHeaders();
      if (allowHeaders.length > 0)
        request.header(ALLOW_HEADERS, join(allowHeaders));

      //expose headers
      String[] exposeHeaders = _crossOrigin.exposeHeaders();
      if (exposeHeaders.length > 0)
        request.header(EXPOSE_HEADERS, join(exposeHeaders));

      //max age
      request.header(MAX_AGE, Long.toString(_crossOrigin.maxAge()));

      request.ok();
      request.halt();
    } catch (Exception e) {
      log.log(Level.WARNING, e.toString(), e);
    }
  }
1087378
@Override
	public void handleRequest(final Request request) {
		super.handleRequest(request);

		// Check if window in request
		boolean targeted = isPresent(request);
		setTargeted(targeted);

		if (getState() == ACTIVE_STATE && isTargeted()) {
			getComponentModel().wrappedContent.serviceRequest(request);
		}
	}
587403
public static void init(H.Request request, H.Response response) {
        H.Request.current(request);
        H.Response.current(response);
        resolveSession(request);
        resolveFlash(request);
    }
278139
@Override
  public boolean service(RequestBaratine request)
  {
    /*
    try {
      _service.open((WebRequest) request);
    } catch (Exception e) {
      log.log(Level.WARNING, e.toString(), e);
    }
    */

    ServiceWebSocket<T, S> service = _factory.apply(request);

    WebSocketManager wsManager = request.webApp().wsManager();
    WebSocketBaratineImpl<T,S> ws
      = new WebSocketBaratineImpl<>(wsManager, service, _type);
    
    try {
      if (ws.handshake(request)) {
        return true;
      }
      else {
        log.fine("WebSocket handshake failed for " + request);
        return false;
      }
    } catch (Throwable e) {
      log.log(Level.WARNING, e.toString(), e);
      e.printStackTrace();
      
      request.fail(e);
      
      return true;
    }
    //request.flush();
  }
61365
private CompletableFuture<RestoreResponse> restore(RestoreRequest request) {
    return getService(request).thenCompose(service -> service.restore(request));
  }
198224
public static void doGet(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    String handler = getHandler(request);
    if (handler.startsWith(COMMAND_PATH)) {
      if (!checkForAjax(request, response)) {
        return;
      }
      StatusHandler.handleCommand(handler.substring(COMMAND_PATH.length() + 1), request, response);
    } else {
      handleStaticResources(handler, response);
    }
  }