at.knowcenter.wag.egov.egiz.web
Class LocalRequestHelper

java.lang.Object
  extended byat.knowcenter.wag.egov.egiz.web.LocalRequestHelper

public abstract class LocalRequestHelper
extends Object

Contains commonly used helper functions for the local request procedure.

Author:
wprinz

Field Summary
static String LOCAL_CONNECTION_PAGE_JSP
          The resource of the local connection page jsp.
protected static org.apache.commons.logging.Log logger
          The logger.
static String NULL_REQUEST_PAGE_JSP
          The resource of the null request page jsp.
static String REDIRECT_REFRESH_PAGE_JSP
          The resource of the redirect refresh page jsp.
 
Constructor Summary
LocalRequestHelper()
           
 
Method Summary
protected static void formatBKUOkResponse(HttpServletResponse response)
          Formats the OK response from the web application back to the local BKU.
static String getConnectorValueFromProfile(SettingsReader settings, String profile, String key)
          Reads the configuration entry given by the key, first from the given profile, if not found from the defaults.
static String getLocalContextAddress(HttpServletRequest request, HttpServletResponse response)
           
static String getLocalServerAddress(HttpServletRequest request, HttpServletResponse response)
           
static String getLocalServiceAddress(String profile, String device)
          Returns the URL for accessing the local service.
static String makeStringHTMLReady(String input)
           
static void prepareDispatchToLocalConnectionPage(LocalRequest local_request, HttpServletRequest request, HttpServletResponse response)
          Prepares the dispatch to the local data connection page.
static String processLocalSign(SignSessionInformation si, HttpServletRequest request, HttpServletResponse response)
          Sets up the local sign procedure.
static String processLocalVerify(VerifySessionInformation si, List holders_to_verify, HttpServletRequest request, HttpServletResponse response)
          Sets up the local verify procedure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.apache.commons.logging.Log logger
The logger.


NULL_REQUEST_PAGE_JSP

public static final String NULL_REQUEST_PAGE_JSP
The resource of the null request page jsp.

See Also:
Constant Field Values

LOCAL_CONNECTION_PAGE_JSP

public static final String LOCAL_CONNECTION_PAGE_JSP
The resource of the local connection page jsp.

See Also:
Constant Field Values

REDIRECT_REFRESH_PAGE_JSP

public static final String REDIRECT_REFRESH_PAGE_JSP
The resource of the redirect refresh page jsp.

See Also:
Constant Field Values
Constructor Detail

LocalRequestHelper

public LocalRequestHelper()
Method Detail

processLocalSign

public static String processLocalSign(SignSessionInformation si,
                                      HttpServletRequest request,
                                      HttpServletResponse response)
                               throws IOException,
                                      PresentableException
Sets up the local sign procedure.

Parameters:
response - The HttpServletResponse the local request page is written to.
Throws:
IOException - Forwarded exception.
PresentableException - Forwarded exception.

processLocalVerify

public static String processLocalVerify(VerifySessionInformation si,
                                        List holders_to_verify,
                                        HttpServletRequest request,
                                        HttpServletResponse response)
                                 throws SignatureException,
                                        NormalizeException,
                                        IOException,
                                        ConnectorFactoryException,
                                        SettingsException,
                                        ConnectorException
Sets up the local verify procedure.

Parameters:
response - The HttpServletResponse the local request page is written to.
Returns:
Returns the JSP location where the calling servlet should dispatch to.
Throws:
SignatureException - Forwarded exception.
NormalizeException - Forwarded exception.
IOException - Forwarded exception.
ConnectorFactoryException - Forwarded exception.
SettingsException
ConnectorException

formatBKUOkResponse

protected static void formatBKUOkResponse(HttpServletResponse response)
                                   throws IOException
Formats the OK response from the web application back to the local BKU.

As stated in the BKU tutorial, this response must be plain text "". Otherwise BKU will assume a failure.

Parameters:
response - The HttpServletResponse to answer to.
Throws:
IOException - Forwarded exception.

prepareDispatchToLocalConnectionPage

public static void prepareDispatchToLocalConnectionPage(LocalRequest local_request,
                                                        HttpServletRequest request,
                                                        HttpServletResponse response)
                                                 throws IOException,
                                                        SignatureException,
                                                        NormalizeException
Prepares the dispatch to the local data connection page.

The calling servlet just has to dispatch to the jsp after calling this method.

Parameters:
local_request - The local request. Basically this contains the local service's target URL and the XML request string.
response - The HttpServletResponse to write this page to.
Throws:
IOException - Forwarded exception.
SignatureException - Forwarded exception.
NormalizeException - Forwarded exception.

makeStringHTMLReady

public static String makeStringHTMLReady(String input)

getLocalServerAddress

public static String getLocalServerAddress(HttpServletRequest request,
                                           HttpServletResponse response)

getLocalContextAddress

public static String getLocalContextAddress(HttpServletRequest request,
                                            HttpServletResponse response)

getLocalServiceAddress

public static String getLocalServiceAddress(String profile,
                                            String device)
                                     throws SettingsException
Returns the URL for accessing the local service.

This information is taken from the profile and if not defined from the defaults.

E.g. http://127.0.0.1:3495/http-security-layer-request

Parameters:
profile - The profile to take the data from.
device - The service device to be accessed. E.g. bku.
Returns:
Returns the URL for accessing the local service.
Throws:
SettingsException - F.e.

getConnectorValueFromProfile

public static String getConnectorValueFromProfile(SettingsReader settings,
                                                  String profile,
                                                  String key)
Reads the configuration entry given by the key, first from the given profile, if not found from the defaults.

Parameters:
settings - The settings.
profile - The profile.
key - The configuration key.
Returns:
Returns the configuration entry.


Copyright © 2006-2010. All Rights Reserved.