FileDocCategorySizeDatePackage
ProxyHandlerImpl.javaAPI DocGlassfish v2 API5181Fri May 04 22:36:02 BST 2007com.sun.enterprise.web

ProxyHandlerImpl

public class ProxyHandlerImpl extends com.sun.appserv.ProxyHandler
Default ProxyHandler implementation.

Fields Summary
Constructors Summary
Methods Summary
public java.lang.StringgetRemoteAddress(javax.servlet.http.HttpServletRequest request)
Gets the Internet Protocol (IP) source port of the client request that was intercepted by the proxy server.

param
request The request from which to retrieve the IP source port of the original client request
return
IP source port of the original client request, or null if this information is not available from the given request

        return request.getHeader("Proxy-ip");
    
public java.security.cert.X509Certificate[]getSSLClientCertificateChain(javax.servlet.http.HttpServletRequest request)
Gets the SSL client certificate chain with which the client had authenticated itself to the SSL offloader, and which the SSL offloader has added as a custom request header on the given request.

param
request The request from which to retrieve the SSL client certificate chain
return
Array of java.security.cert.X509Certificate instances representing the SSL client certificate chain, or null if this information is not available from the given request
throws
CertificateException if the certificate chain retrieved from the request header cannot be parsed


        X509Certificate[] certs = null;

        String clientCert = request.getHeader("Proxy-auth-cert");
        if (clientCert != null) {
            clientCert = clientCert.replaceAll("% d% a", "\n");
            clientCert = "-----BEGIN CERTIFICATE-----\n" + clientCert
                         + "\n-----END CERTIFICATE-----";
            byte[] certBytes = new byte[clientCert.length()];
            clientCert.getBytes(0, clientCert.length(), certBytes, 0);
            ByteArrayInputStream bais = new ByteArrayInputStream(certBytes);
            CertificateFactory cf = CertificateFactory.getInstance("X.509");
            certs = new X509Certificate[1];
            certs[0] = (X509Certificate) cf.generateCertificate(bais);
        }

        return certs;
    
public intgetSSLKeysize(javax.servlet.http.HttpServletRequest request)
Returns the SSL keysize with which the original client request that was intercepted by the SSL offloader has been protected, and which the SSL offloader has added as a custom request header on the given request.

param
request The request from which to retrieve the SSL key size
return
SSL keysize, or -1 if this information is not available from the given request


        int keySize = -1;

        String header = request.getHeader("Proxy-keysize");
        if (header != null) {
            keySize = Integer.parseInt(header);
        }

        return keySize;