From a4682ceae6774956461edd03b2485bbacea445f4 Mon Sep 17 00:00:00 2001 From: mharmsen Date: Tue, 4 Oct 2011 01:17:41 +0000 Subject: Bugzilla Bug #688225 - (dogtagIPAv2.1) TRACKER: of the Dogtag fixes for freeIPA 2.1 git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/tags/IPA_v2_RHEL_6_2_20111003@2252 c9f7a03b-bd48-0410-a16d-cbbf54688b0b --- pki/base/ca/shared/webapps/ROOT/index.jsp | 94 +++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 pki/base/ca/shared/webapps/ROOT/index.jsp (limited to 'pki/base/ca/shared/webapps/ROOT/index.jsp') diff --git a/pki/base/ca/shared/webapps/ROOT/index.jsp b/pki/base/ca/shared/webapps/ROOT/index.jsp new file mode 100644 index 000000000..85a4654c3 --- /dev/null +++ b/pki/base/ca/shared/webapps/ROOT/index.jsp @@ -0,0 +1,94 @@ + +<% + // establish acceptable schemes + final String HTTP_SCHEME = "http"; + final String HTTPS_SCHEME = "https"; + + // establish known ports + final int EE_HTTP_PORT = [PKI_UNSECURE_PORT]; + final int AGENT_HTTPS_PORT = [PKI_AGENT_SECURE_PORT]; + final int EE_HTTPS_PORT = [PKI_EE_SECURE_PORT]; + final int ADMIN_HTTPS_PORT = [PKI_ADMIN_SECURE_PORT]; + + // establish known paths + final String ADMIN_PATH = "/[PKI_SUBSYSTEM_TYPE]/services"; + final String AGENT_PATH = "/[PKI_SUBSYSTEM_TYPE]/agent/[PKI_SUBSYSTEM_TYPE]"; + final String EE_PATH = "/[PKI_SUBSYSTEM_TYPE]/ee/[PKI_SUBSYSTEM_TYPE]"; + final String ERROR_PATH = "/[PKI_SUBSYSTEM_TYPE]/404.html"; + + // retrieve scheme from request + String scheme = request.getScheme(); + + // retrieve client hostname on which the request was sent + String client_hostname = request.getServerName(); + + // retrieve client port number on which the request was sent + int client_port = request.getServerPort(); + + // retrieve server hostname on which the request was received + String server_hostname = request.getLocalName(); + + // retrieve server port number on which the request was received + int server_port = request.getLocalPort(); + + // uncomment the following lines to write to 'catalina.out' + //System.out.println( "scheme = '" + scheme + "'" ); + //System.out.println( "client hostname = '" + client_hostname + "'" ); + //System.out.println( "client port = '" + client_port + "'" ); + //System.out.println( "server hostname = '" + server_hostname + "'" ); + //System.out.println( "server port = '" + server_port + "'" ); + + // compose the appropriate URL + String URL = ""; + + if( scheme.equals( HTTP_SCHEME ) ) { + if( server_port == EE_HTTP_PORT ) { + URL = scheme + "://" + client_hostname + ":" + client_port + EE_PATH; + } else { + // unknown HTTP server port: should never get here + URL = scheme + "://" + client_hostname + ":" + client_port + ERROR_PATH; + + // uncomment the following line to write to 'catalina.out' + //System.out.println( "Unknown HTTP server port: '" + server_port + "'" ); + } + } else if( scheme.equals( HTTPS_SCHEME ) ) { + if( server_port == AGENT_HTTPS_PORT ) { + URL = scheme + "://" + client_hostname + ":" + client_port + AGENT_PATH; + } else if( server_port == EE_HTTPS_PORT ) { + URL = scheme + "://" + client_hostname + ":" + client_port + EE_PATH; + } else if( server_port == ADMIN_HTTPS_PORT ) { + URL = scheme + "://" + client_hostname + ":" + client_port + ADMIN_PATH; + } else { + // unknown HTTPS server port: should never get here + URL = scheme + "://" + client_hostname + ":" + client_port + ERROR_PATH; + + // uncomment the following line to write to 'catalina.out' + //System.out.println( "Unknown HTTPS server port: '" + server_port + "'" ); + } + } else { + // unacceptable scheme: should never get here + URL = scheme + "://" + client_hostname + ":" + client_port + ERROR_PATH; + + // uncomment the following line to write to 'catalina.out' + //System.out.println( "Unacceptable scheme: '" + scheme + "'" ); + } + + // respond (back to browser) with the appropriate redirected URL + response.sendRedirect( URL ); +%> -- cgit