Example usage for javax.servlet RequestDispatcher FORWARD_PATH_INFO

List of usage examples for javax.servlet RequestDispatcher FORWARD_PATH_INFO

Introduction

In this page you can find the example usage for javax.servlet RequestDispatcher FORWARD_PATH_INFO.

Prototype

String FORWARD_PATH_INFO

To view the source code for javax.servlet RequestDispatcher FORWARD_PATH_INFO.

Click Source Link

Document

The name of the request attribute under which the original path info is made available to the target of a #forward(ServletRequest,ServletResponse) forward

Usage

From source file:org.eclipse.orion.server.servlets.XSRFPreventionFilter.java

private boolean isEntryPoint(ServletRequest req, String path) {
    if (entryPointList.contains(path))
        return true;
    // Self-hosting check
    return entryPointList.contains((String) req.getAttribute(RequestDispatcher.FORWARD_PATH_INFO));
}

From source file:org.eclipse.orion.server.servlets.XSRFPreventionFilter.java

private boolean isException(ServletRequest req, String path) {
    if (exceptionList.contains(path))
        return true;
    // Self-hosting check
    return exceptionList.contains((String) req.getAttribute(RequestDispatcher.FORWARD_PATH_INFO));
}

From source file:org.ireland.jnetty.webapp.RequestDispatcherImpl.java

private void doForward(HttpServletRequest request, HttpServletResponse response, HttpInvocation invocation)
        throws ServletException, IOException {

    // Reset any output that has been buffered, but keep headers/cookies
    response.resetBuffer(); // Servlet-3_1-PFD 9.4

    //Wrap the request
    ForwardRequest wrequest = new ForwardRequest(request, response, invocation);

    // If we have already been forwarded previously, then keep using the established
    // original value. Otherwise, this is the first forward and we need to establish the values.
    // Note: the established value on the original request for pathInfo and
    // for queryString is allowed to be null, but cannot be null for the other values.
    if (request.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI) == null) {
        // ??,//from w w w.  j av a  2  s  .c  o m
        wrequest.setAttribute(RequestDispatcher.FORWARD_REQUEST_URI, request.getRequestURI());

        wrequest.setAttribute(RequestDispatcher.FORWARD_CONTEXT_PATH, request.getContextPath());
        wrequest.setAttribute(RequestDispatcher.FORWARD_SERVLET_PATH, request.getServletPath());
        wrequest.setAttribute(RequestDispatcher.FORWARD_PATH_INFO, request.getPathInfo());
        wrequest.setAttribute(RequestDispatcher.FORWARD_QUERY_STRING, request.getQueryString());
    }

    boolean isValid = false;

    try {

        invocation.getFilterChainInvocation().service(wrequest, response);

        isValid = true;
    } finally {
        if (request.getAsyncContext() != null) {
            // An async request was started during the forward, don't close the
            // response as it may be written to during the async handling
            return;
        }

        // server/106r, ioc/0310
        if (isValid) {
            finishResponse(response);
        }
    }
}