Package org.apache.coyote.tomcat4

Examples of org.apache.coyote.tomcat4.CoyoteRequest


     */
    private static void addEasHeaders(HttpConnection connection, Request request)
        throws IOException {
        // GLASSFISH Request/Response does not extend HttpRequest/Response so
        // we need to cast to Coyote Request/Response
        CoyoteRequest cRequest = (CoyoteRequest) request;

        // The front-end will add a HTTP header with information required for
        // single signon
        // e.g. x-eas-usercentric-ipcontext:
        // clientip=1.2.3.4,clientport=5000,serverip=5.6.7.8,serverport=9080
        String contextValue = "clientip=" + cRequest.getRemoteAddr() +
            ",clientport=" + cRequest.getRemotePort() + ",serverip=" +
            cRequest.getLocalAddr() + ",serverport=" + cRequest.getLocalPort();

        connection.printLine("x-eas-usercentric-ipcontext: " + contextValue);

        // Send information to backend TrafficProcessor.
        connection.printLine(EAS_HEADER_FRONTEND_IS_SECURE + ": " +
            cRequest.isSecure());
        connection.printLine(EAS_HEADER_FRONTEND_LOCAL_ADDRESS + ": " +
            cRequest.getLocalAddr());
        connection.printLine(EAS_HEADER_FRONTEND_LOCAL_PORT + ": " +
            cRequest.getLocalPort());
    }
View Full Code Here


     */
    private static void sendInternalError(Request request, Response response,
        HttpHost host) throws IOException {
        // GLASSFISH Request/Response does not extend HttpRequest/Response so
        // we need to cast to Coyote Request/Response
        CoyoteRequest cRequest = (CoyoteRequest) request;
        CoyoteResponse cResponse = (CoyoteResponse) response;

        // If the reponse is still not committed...
        if (!cResponse.isCommitted()) {
            // Failed to proxy this request, inform client.
            if (log.isLoggable(Level.FINE)) {
                log.log(Level.FINE,
                    "The attempt to proxy '" + cRequest.getRequestURL() +
                    "' to '" + host + "' failed. " +
                    "Responding with 500 Internal Server Error.");
            }

            cResponse.sendError(CoyoteResponse.SC_INTERNAL_SERVER_ERROR);
View Full Code Here

                                HttpServletRequest request,
                                HttpServletResponse response)
    {
        // Need real request object not facade
       
        CoyoteRequest req = getUnwrappedCoyoteRequest(request);
        if (req == null) {
            return Boolean.valueOf(false);
        }
       
        // Try to login - this will set up security context on success
        LoginContextDriver.login(user, password, realm);

        // Create a WebPrincipal for tomcat and store in current request
        // This will allow programmatic authorization later in this request
        // to work as expected.

        SecurityContext secCtx = SecurityContext.getCurrent();
        assert (secCtx != null); // since login succeeded above

        WebPrincipal principal = new WebPrincipal(user, password, secCtx);
        req.setUserPrincipal(principal);
        req.setAuthType(WEBAUTH_PROGRAMMATIC);

        if(logger.isLoggable(Level.FINE)){
            logger.log(Level.FINE, "Programmatic login set principal in http request to: "+
                      user);
        }
View Full Code Here

    /**
     * Return the unwrapped <code>CoyoteRequest</code> object.
     */
    private static CoyoteRequest getUnwrappedCoyoteRequest(HttpServletRequest request){       
        CoyoteRequest req = null;
        ServletRequest servletRequest = request;
        try{

            ServletRequest prevRequest = null;
            while (servletRequest != prevRequest
View Full Code Here

    public static Boolean logout(HttpServletRequest request,
                                 HttpServletResponse response) throws Exception
    {
        // Need real request object not facade
       
        CoyoteRequest req = getUnwrappedCoyoteRequest(request);
        if (req == null) {
            return Boolean.valueOf(false);
        }
       
        // Logout - clears out security context

        LoginContextDriver.logout();
        // Remove principal and auth type from request

        req.setUserPrincipal(null);
        req.setAuthType(null);
        if(logger.isLoggable(Level.FINE)){
            logger.log(Level.FINE, "Programmatic logout removed principal from request.");
        }

        // Remove from session if possible.
View Full Code Here

TOP

Related Classes of org.apache.coyote.tomcat4.CoyoteRequest

Copyright © 2018 www.massapicom. 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.