Examples of RequestInfo


Examples of br.com.caelum.vraptor.core.RequestInfo

      logger.trace("Request: {}", req);

      VRaptorRequest mutableRequest = new VRaptorRequest(baseRequest);
      VRaptorResponse mutableResponse = new VRaptorResponse(baseResponse);

      final RequestInfo request = new RequestInfo(servletContext, chain, mutableRequest, mutableResponse);

      try {
        encodingHandler.setEncoding(baseRequest, baseResponse);
        provider.provideForRequest(request);
        newRequestEvent.fire(new NewRequest());
View Full Code Here

Examples of com.google.api.ads.common.lib.soap.RequestInfo

   * Logs the XML messages from a given SOAP interaction.
   *
   * @param soapCallReturn information on the SOAP call to be logged
   */
  public void logSoapXml(SoapCallReturn soapCallReturn) {
    RequestInfo request = soapCallReturn.getRequestInfo();
    ResponseInfo response = soapCallReturn.getResponseInfo();
    if (soapXmlLogger.isInfoEnabled() ||
        (soapXmlLogger.isWarnEnabled() && soapCallReturn.getException() != null)) {
      String prettyRequest = "SOAP Request:\n" +
          prettyPrinter.prettyPrint(request.getSoapRequestXml());
      String prettyResponse = "SOAP Response:\n" +
          prettyPrinter.prettyPrint(response.getSoapResponseXml());
      if (soapCallReturn.getException() == null) {
        soapXmlLogger.info(prettyRequest);
        soapXmlLogger.info(prettyResponse);
View Full Code Here

Examples of com.hbasebook.hush.servlet.RequestInfo

      } else if (isQrCode) {
        // show QRCode if requested
        sendQRCode(httpResponse, surl.getLongUrl());
      } else {
        // increment counters and redirect!
        rm.getCounters().incrementUsage(shortId, new RequestInfo(httpRequest));
        String refShortId = surl.getRefShortId();
        if (refShortId != null) {
          // increment the aggregate link
          rm.getCounters().incrementUsage(refShortId,
            new RequestInfo(httpRequest));
        }
        httpResponse.sendRedirect(surl.getLongUrl());
      }
    }
  }
View Full Code Here

Examples of com.lissenberg.blog.domain.RequestInfo

    public Statistics getStatistics(Long blogId) {
        ExternalContext ctx = getCurrentInstance().getExternalContext();
        String userAgent = ctx.getRequestHeaderMap().get(USER_AGENT);
        String referer = ctx.getRequestHeaderMap().get(REFERER);
        RequestInfo request = new RequestInfo(blogId, referer, userAgent);
        return statsService.updateStatistics(blogId, request);
    }
View Full Code Here

Examples of com.onpositive.gae.profiling.rpc.RPCAttachment.RequestInfo

        .getAttachment(MemCacheStorageAttachment.class);
    infoMap = attachment.infoMap;
  }

  public RequestInfo storedInfo(RequestInfo inf) {
    RequestInfo requestInfo = infoMap.get(inf);
    if (requestInfo == null) {
      infoMap.put(inf, inf);
      return inf;
    }
    return requestInfo;
View Full Code Here

Examples of com.scooterframework.web.route.RequestInfo

     */
  public ActionProperties prepareActionProperties(String requestPath,
      String requestHttpMethod, HttpServletRequest request) {
      ActionProperties aps = super.prepareActionProperties(requestPath, requestHttpMethod, request);
     
        RequestInfo requestInfo = new RequestInfo(requestPath, requestHttpMethod);
        log.debug("  requestInfo: " + requestInfo);
       
        RouteInfo routeInfo = MatchMaker.getInstance().match(requestInfo);
        log.debug("matched route: " + routeInfo);
       
View Full Code Here

Examples of com.sun.grizzly.tcp.RequestInfo

        if( log.isLoggable(Level.FINEST) )
            log.finest( "Invoke " + req + " " + res + " " + req.requestURI().toString());
       
        res.setNote( epNote, ep );
        ep.setStatus( MsgContext.JK_STATUS_HEAD );
        RequestInfo rp = req.getRequestProcessor();
        rp.setStage(Constants.STAGE_SERVICE);
        try {
            adapter.service( req, res );
        } catch( Exception ex ) {
            log.log(Level.INFO, "Error servicing request " + req,ex);
        }
        if(ep.getStatus() != MsgContext.JK_STATUS_CLOSED) {
            res.finish();
        }

        req.recycle();
        req.updateCounters();
        res.recycle();
        ep.recycle();
        if( ep.getStatus() == MsgContext.JK_STATUS_ERROR ) {
            return ERROR;
        }
        ep.setStatus( MsgContext.JK_STATUS_NEW );
        rp.setStage(Constants.STAGE_KEEPALIVE);
        return OK;
    }
View Full Code Here

Examples of net.caprazzi.minima.framework.RequestInfo

      FilterChain chain) throws IOException, ServletException {

    HttpServletRequest req = (HttpServletRequest) request;
    HttpServletResponse resp = (HttpServletResponse) response;
   
    RequestInfo info = RequestInfo.fromRequest(req);
   
    boolean hasSession = (req.getSession(false) != null);
   
    boolean allowEdit = !requireSessionToEdit || hasSession;
    boolean allowView = allowEdit || (!requireSessionToView || hasSession);
   
    request.setAttribute("minima.readonly", !allowEdit);
   
    // redirect /index to /login if login required
    if (info.isGet("{ctx}/index") && !allowView) {
      resp.sendRedirect(req.getContextPath() + "/login");
      return;
    }

    // redirect /login to /index if login not required
    if (info.isGet("{ctx}/login") && allowEdit && allowView) {
      resp.sendRedirect(req.getContextPath() + "/index");
      return;
    }
   
    // let pass requests to /login if login is required
    if (info.isPath("{ctx}/login") && (!allowView || !allowEdit)) {
      chain.doFilter(request, response);
      return;
    }
   
    // only show logout if there is a session
    if (info.isGet("{ctx}/logout") && !hasSession) {
      resp.sendRedirect(req.getContextPath() + "/index");
      return;
    }
   
    // stop all other reads if view is not allowed
    if (info.isRead() && !allowView) {
      resp.sendError(403);
      return;
    }
   
    // stop all other writes if view is not required
    if (info.isWrite() && !allowEdit) {
      resp.sendError(403);
      return;
    }
   
    chain.doFilter(request, response);
View Full Code Here

Examples of org.apache.coyote.RequestInfo

     * @throws IOException error during an I/O operation
     */
    @Override
    public SocketState process(SocketWrapper<S> socketWrapper)
        throws IOException {
        RequestInfo rp = request.getRequestProcessor();
        rp.setStage(org.apache.coyote.Constants.STAGE_PARSE);

        // Setting up the I/O
        setSocketWrapper(socketWrapper);
        getInputBuffer().init(socketWrapper, endpoint);
        getOutputBuffer().init(socketWrapper, endpoint);

        // Flags
        error = false;
        keepAlive = true;
        comet = false;
        openSocket = false;
        sendfileInProgress = false;
        readComplete = true;
        if (endpoint.getUsePolling()) {
            keptAlive = false;
        } else {
            keptAlive = socketWrapper.isKeptAlive();
        }

        if (disableKeepAlive()) {
            socketWrapper.setKeepAliveLeft(0);
        }

        while (!error && keepAlive && !comet && !isAsync() &&
                httpUpgradeHandler == null && !endpoint.isPaused()) {

            // Parsing the request header
            try {
                setRequestLineReadTimeout();

                if (!getInputBuffer().parseRequestLine(keptAlive)) {
                    if (handleIncompleteRequestLineRead()) {
                        break;
                    }
                }

                if (endpoint.isPaused()) {
                    // 503 - Service unavailable
                    response.setStatus(503);
                    error = true;
                } else {
                    // Make sure that connectors that are non-blocking during
                    // header processing (NIO) only set the start time the first
                    // time a request is processed.
                    if (request.getStartTime() < 0) {
                        request.setStartTime(System.currentTimeMillis());
                    }
                    keptAlive = true;
                    // Set this every time in case limit has been changed via JMX
                    request.getMimeHeaders().setLimit(endpoint.getMaxHeaderCount());
                    // Currently only NIO will ever return false here
                    if (!getInputBuffer().parseHeaders()) {
                        // We've read part of the request, don't recycle it
                        // instead associate it with the socket
                        openSocket = true;
                        readComplete = false;
                        break;
                    }
                    if (!disableUploadTimeout) {
                        setSocketTimeout(connectionUploadTimeout);
                    }
                }
            } catch (IOException e) {
                if (getLog().isDebugEnabled()) {
                    getLog().debug(
                            sm.getString("http11processor.header.parse"), e);
                }
                error = true;
                break;
            } catch (Throwable t) {
                ExceptionUtils.handleThrowable(t);
                UserDataHelper.Mode logMode = userDataHelper.getNextMode();
                if (logMode != null) {
                    String message = sm.getString(
                            "http11processor.header.parse");
                    switch (logMode) {
                        case INFO_THEN_DEBUG:
                            message += sm.getString(
                                    "http11processor.fallToDebug");
                            //$FALL-THROUGH$
                        case INFO:
                            getLog().info(message);
                            break;
                        case DEBUG:
                            getLog().debug(message);
                    }
                }
                // 400 - Bad Request
                response.setStatus(400);
                getAdapter().log(request, response, 0);
                error = true;
            }

            if (!error) {
                // Setting up filters, and parse some request headers
                rp.setStage(org.apache.coyote.Constants.STAGE_PREPARE);
                try {
                    prepareRequest();
                } catch (Throwable t) {
                    ExceptionUtils.handleThrowable(t);
                    if (getLog().isDebugEnabled()) {
                        getLog().debug(sm.getString(
                                "http11processor.request.prepare"), t);
                    }
                    // 400 - Internal Server Error
                    response.setStatus(400);
                    getAdapter().log(request, response, 0);
                    error = true;
                }
            }

            if (maxKeepAliveRequests == 1) {
                keepAlive = false;
            } else if (maxKeepAliveRequests > 0 &&
                    socketWrapper.decrementKeepAlive() <= 0) {
                keepAlive = false;
            }

            // Process the request in the adapter
            if (!error) {
                try {
                    rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
                    getAdapter().service(request, response);
                    // Handle when the response was committed before a serious
                    // error occurred.  Throwing a ServletException should both
                    // set the status to 500 and set the errorException.
                    // If we fail here, then the response is likely already
                    // committed, so we can't try and set headers.
                    if(keepAlive && !error) { // Avoid checking twice.
                        error = response.getErrorException() != null ||
                                (!isAsync() &&
                                statusDropsConnection(response.getStatus()));
                    }
                    setCometTimeouts(socketWrapper);
                } catch (InterruptedIOException e) {
                    error = true;
                } catch (HeadersTooLargeException e) {
                    error = true;
                    // The response should not have been committed but check it
                    // anyway to be safe
                    if (!response.isCommitted()) {
                        response.reset();
                        response.setStatus(500);
                        response.setHeader("Connection", "close");
                    }
                } catch (Throwable t) {
                    ExceptionUtils.handleThrowable(t);
                    getLog().error(sm.getString(
                            "http11processor.request.process"), t);
                    // 500 - Internal Server Error
                    response.setStatus(500);
                    getAdapter().log(request, response, 0);
                    error = true;
                }
            }

            // Finish the handling of the request
            rp.setStage(org.apache.coyote.Constants.STAGE_ENDINPUT);

            if (!isAsync() && !comet) {
                if (error) {
                    // If we know we are closing the connection, don't drain
                    // input. This way uploading a 100GB file doesn't tie up the
                    // thread if the servlet has rejected it.
                    getInputBuffer().setSwallowInput(false);
                }
                if (response.getStatus() < 200 || response.getStatus() > 299) {
                    if (expectation) {
                        // Client sent Expect: 100-continue but received a
                        // non-2xx response. Disable keep-alive (if enabled) to
                        // ensure the connection is closed. Some clients may
                        // still send the body, some may send the next request.
                        // No way to differentiate, so close the connection to
                        // force the client to send the next request.
                        getInputBuffer().setSwallowInput(false);
                        keepAlive = false;
                    }
                }
                endRequest();
            }

            rp.setStage(org.apache.coyote.Constants.STAGE_ENDOUTPUT);

            // If there was an error, make sure the request is counted as
            // and error, and update the statistics counter
            if (error) {
                response.setStatus(500);
            }
            request.updateCounters();

            if (!isAsync() && !comet || error) {
                getInputBuffer().nextRequest();
                getOutputBuffer().nextRequest();
            }

            if (!disableUploadTimeout) {
                if(endpoint.getSoTimeout() > 0) {
                    setSocketTimeout(endpoint.getSoTimeout());
                } else {
                    setSocketTimeout(0);
                }
            }

            rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE);

            if (breakKeepAliveLoop(socketWrapper)) {
                break;
            }
        }

        rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);

        if (error || endpoint.isPaused()) {
            return SocketState.CLOSED;
        } else if (isAsync() || comet) {
            return SocketState.LONG;
View Full Code Here

Examples of org.apache.coyote.RequestInfo

            } catch (IllegalStateException x) {
                registerForEvent(true, false);
            }
        }

        RequestInfo rp = request.getRequestProcessor();
        try {
            rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
            error = !getAdapter().asyncDispatch(request, response, status);
            resetTimeouts();
        } catch (InterruptedIOException e) {
            error = true;
        } catch (Throwable t) {
            ExceptionUtils.handleThrowable(t);
            getLog().error(sm.getString("http11processor.request.process"), t);
            error = true;
        }

        rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);

        if (error) {
            return SocketState.CLOSED;
        } else if (isAsync()) {
            return SocketState.LONG;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.