org.apache.beehive.netui.pageflow
Class DefaultServletContainerAdapter

Object
  extended by DefaultServletContainerAdapter
All Implemented Interfaces:
Adapter, ServletContainerAdapter

public abstract class DefaultServletContainerAdapter
extends Object
implements ServletContainerAdapter


Nested Class Summary
static class DefaultServletContainerAdapter.DefaultEventReporter
          Default event reporter.
 
Constructor Summary
protected DefaultServletContainerAdapter()
           
 
Method Summary
 void beginRequest(HttpServletRequest request, HttpServletResponse response)
          Called at the beginning of each processed request.
 ControlBeanContext createControlBeanContext(HttpServletRequest request, HttpServletResponse response)
          Get a context object to support Java Controls.
 boolean doSecurityRedirect(String uri, HttpServletRequest request, HttpServletResponse response)
          Cause the server to do a security check for the given URI.
 void endRequest(HttpServletRequest request, HttpServletResponse response)
          Called at the end of each processed request.
 void ensureFailover(String attrName, Object attrVal, HttpServletRequest request)
          This default implementation does nothing; the functionality (and the need for it) is server-specific.
 PageFlowEventReporter getEventReporter()
          Get an event reporter, which will be notified of events like "page flow created", "action raised", etc.
 String getFullContextPath(HttpServletRequest request)
          Return the webapp context path for the given request.
 int getListenPort(HttpServletRequest request)
          Get the non-secure server listen port.
 String getPlatformName()
          Get the name of the platform, which may be used to find platform-specific configuration files.
 int getSecureListenPort(HttpServletRequest request)
          Get the port on which the server is listening for secure connections.
 SecurityProtocol getSecurityProtocol(String uri, HttpServletRequest request)
          Tell whether a web application resource requires a secure transport protocol.
protected  ServletContext getServletContext()
           
 boolean isInProductionMode()
          Tell whether the system is in production mode.
 void login(String username, String password, HttpServletRequest request, HttpServletResponse response)
          Log in the user, using "weak" username/password authentication.
 void logout(boolean invalidateSessions, HttpServletRequest request, HttpServletResponse response)
          Log out the current user.
 void setContext(AdapterContext context)
          Set the generic AdapterContext.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface Adapter
accept
 

Constructor Detail

DefaultServletContainerAdapter

protected DefaultServletContainerAdapter()
Method Detail

isInProductionMode

public boolean isInProductionMode()
Tell whether the system is in production mode.

Specified by:
isInProductionMode in interface ServletContainerAdapter
Returns:
true if the system property "beehive.productionmode" is set to "true", or if asserts are disabled for this class in the case where the system property has no value; false if the system property is set to "false", or if asserts are enabled for this class in the case where the system property has no value.

getSecurityProtocol

public SecurityProtocol getSecurityProtocol(String uri,
                                            HttpServletRequest request)
Description copied from interface: ServletContainerAdapter
Tell whether a web application resource requires a secure transport protocol. This is determined from web.xml; for example, the following block specifies that all resources under /login require a secure transport protocol.
    <security-constraint>
        <web-resource-collection>
          <web-resource-name>Secure PageFlow - begin</web-resource-name> 
          <url-pattern>/login/*</url-pattern>
        </web-resource-collection>
        <user-data-constraint>
           <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>
 

Specified by:
getSecurityProtocol in interface ServletContainerAdapter
Parameters:
uri - a webapp-relative URI for a resource.
request - the current HttpServletRequest.
Returns:
Boolean.TRUE if a transport-guarantee of CONFIDENTIAL or INTEGRAL is associated with the given resource; Boolean.FALSE a transport-guarantee of NONE is associated with the given resource; or null if there is no transport-guarantee associated with the given resource.

doSecurityRedirect

public boolean doSecurityRedirect(String uri,
                                  HttpServletRequest request,
                                  HttpServletResponse response)
Description copied from interface: ServletContainerAdapter
Cause the server to do a security check for the given URI. If required, it does a redirect to change the scheme (http/https).

Specified by:
doSecurityRedirect in interface ServletContainerAdapter
Parameters:
uri - the URI on which to run security checks.
request - the current HttpServletRequest.
response - the current HttpServletResponse.
Returns:
true if a redirect occurred.

getListenPort

public int getListenPort(HttpServletRequest request)
Get the non-secure server listen port. This default implementation simply returns the current server port.

Specified by:
getListenPort in interface ServletContainerAdapter
Parameters:
request - the current HttpServletRequest.
Returns:
the port on which the server is listening for unsecure connections.

getSecureListenPort

public int getSecureListenPort(HttpServletRequest request)
Description copied from interface: ServletContainerAdapter
Get the port on which the server is listening for secure connections.

Specified by:
getSecureListenPort in interface ServletContainerAdapter
Parameters:
request - the current HttpServletRequest.
Returns:
the port on which the server is listening for secure connections.

login

public void login(String username,
                  String password,
                  HttpServletRequest request,
                  HttpServletResponse response)
           throws LoginException
Description copied from interface: ServletContainerAdapter
Log in the user, using "weak" username/password authentication.

Specified by:
login in interface ServletContainerAdapter
Parameters:
username - the user's login name.
password - the user's password.
request - the current HttpServletRequest.
response - the current HttpServletResponse.
Throws:
LoginException - if the authentication failed

logout

public void logout(boolean invalidateSessions,
                   HttpServletRequest request,
                   HttpServletResponse response)
Description copied from interface: ServletContainerAdapter
Log out the current user.

Specified by:
logout in interface ServletContainerAdapter
Parameters:
invalidateSessions - if true, the session is invalidated (on all single-signon webapps); otherwise the session and its data are left intact. To invalidate the session in only the current webapp, set this parameter to false and call invalidate() on the HttpSession.
request - the current HttpServletRequest.
response - the current HttpServletResponse.

getFullContextPath

public String getFullContextPath(HttpServletRequest request)
Description copied from interface: ServletContainerAdapter
Return the webapp context path for the given request. This differs from HttpServletRequest.getContextPath() only in that it will return a valid value even if the request is for the default webapp.

Specified by:
getFullContextPath in interface ServletContainerAdapter
Parameters:
request - the current HttpServletRequest.

ensureFailover

public void ensureFailover(String attrName,
                           Object attrVal,
                           HttpServletRequest request)
This default implementation does nothing; the functionality (and the need for it) is server-specific.

Specified by:
ensureFailover in interface ServletContainerAdapter
Parameters:
attrName - the name of the session attribute for which failover should be ensured.
attrVal - the value of the given session attribute.
request - the current HttpServletRequest.

beginRequest

public void beginRequest(HttpServletRequest request,
                         HttpServletResponse response)
Description copied from interface: ServletContainerAdapter
Called at the beginning of each processed request.

Specified by:
beginRequest in interface ServletContainerAdapter
Parameters:
request - the current HttpServletRequest.
response - the current HttpServletResponse.

endRequest

public void endRequest(HttpServletRequest request,
                       HttpServletResponse response)
Description copied from interface: ServletContainerAdapter
Called at the end of each processed request.

Specified by:
endRequest in interface ServletContainerAdapter
Parameters:
request - the current HttpServletRequest.
response - the current HttpServletResponse.

createControlBeanContext

public ControlBeanContext createControlBeanContext(HttpServletRequest request,
                                                   HttpServletResponse response)
Description copied from interface: ServletContainerAdapter
Get a context object to support Java Controls.

Specified by:
createControlBeanContext in interface ServletContainerAdapter
Parameters:
request - the current HttpServletRequest.
response - the current HttpServletResponse.
Returns:
a new ControlBeanContext.

getServletContext

protected ServletContext getServletContext()

setContext

public void setContext(AdapterContext context)
Description copied from interface: Adapter
Set the generic AdapterContext.

Specified by:
setContext in interface Adapter

getPlatformName

public String getPlatformName()
Description copied from interface: ServletContainerAdapter
Get the name of the platform, which may be used to find platform-specific configuration files.

Specified by:
getPlatformName in interface ServletContainerAdapter
Returns:
the name of the platform

getEventReporter

public PageFlowEventReporter getEventReporter()
Description copied from interface: ServletContainerAdapter
Get an event reporter, which will be notified of events like "page flow created", "action raised", etc.

Specified by:
getEventReporter in interface ServletContainerAdapter