org.openmdx.security.auth.servlet.spi
Class AbstractHandler

java.lang.Object
  extended by org.openmdx.security.auth.servlet.spi.AbstractHandler
All Implemented Interfaces:
ServletConfig, HttpHandler
Direct Known Subclasses:
AbstractAuthenticationHandler, AbstractCallbackHandler, AbstractSubjectHandler, InsecureExceptionHandler, SimplePrivateKeyProvider

public abstract class AbstractHandler
extends Object
implements HttpHandler, ServletConfig

Abstract Handler


Constructor Summary
protected AbstractHandler()
          Constructor
 
Method Summary
protected  boolean debugDefault()
          Provide the "debug" default value.
 void destroy()
          Called by the servlet to indicate to a HTTP handler that the servlet is being taken out of service.
protected  void endBody(Writer html)
          Write the BODY's start tag.
protected  void endDocument(Writer html)
          End a document
protected  void endHead(Writer html)
          Write the HEAD's end tag.
 String getInitParameter(String name)
           
protected  boolean getInitParameter(String name, boolean defaultValue)
          Retrieve an init parameter or its default value
protected  int getInitParameter(String name, int defaultValue)
          Retrieve an init parameter or its default value
protected  long getInitParameter(String name, long defaultValue)
          Retrieve an init parameter or its default value
protected  String getInitParameter(String name, String defaultValue)
          Retrieve an init parameter or its default value
 Enumeration getInitParameterNames()
           
 ServletContext getServletContext()
           
 String getServletName()
           
protected  void init()
          A convenience method which can be overridden so that there's no need to call super.init(config).
 void init(ServletConfig configuration)
          Use the Servlet's configuration to initialize the handler.
protected  boolean isDebug()
          Tells whether debugging is enabled or not.
protected  void log(String message)
           
protected  void log(String message, Throwable throwable)
           
protected  void startBody(Writer html)
          Write the BODY's start tag.
protected  Writer startDocument(HttpServletResponse response)
          Start a document
protected  void startHead(Writer html)
          Write the HEAD's start tag including its META element.
protected static void writeEncoded(Writer html, String text)
          Apply HTTP encoding to the text before writing it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractHandler

protected AbstractHandler()
Constructor

Method Detail

isDebug

protected boolean isDebug()
Tells whether debugging is enabled or not.

Returns:
true if debugging is enabled

init

public void init(ServletConfig configuration)
          throws ServletException
Use the Servlet's configuration to initialize the handler.

Specified by:
init in interface HttpHandler
Parameters:
configuration - TODO
Throws:
ServletException

init

protected void init()
             throws ServletException
A convenience method which can be overridden so that there's no need to call super.init(config).

Instead of overriding init(ServletConfig), simply override this method and it will be called by AbstractHandler.init(ServletConfig).

Throws:
ServletException

getInitParameter

protected final String getInitParameter(String name,
                                        String defaultValue)
Retrieve an init parameter or its default value

Parameters:
name - the parameter name
defaultValue - the parameter's default value
Returns:
the init parameter or its default value if it where null

getInitParameter

protected final int getInitParameter(String name,
                                     int defaultValue)
Retrieve an init parameter or its default value

Parameters:
name - the parameter name
defaultValue - the parameter's default value
Returns:
the init parameter or ist default value if it where null

getInitParameter

protected final long getInitParameter(String name,
                                      long defaultValue)
Retrieve an init parameter or its default value

Parameters:
name - the parameter name
defaultValue - the parameter's default value
Returns:
the init parameter or ist default value if it where null

getInitParameter

protected final boolean getInitParameter(String name,
                                         boolean defaultValue)
Retrieve an init parameter or its default value

Parameters:
name - the parameter name
defaultValue - the parameter's default value
Returns:
the init parameter or ist default value if it where null

getInitParameter

public final String getInitParameter(String name)
Specified by:
getInitParameter in interface ServletConfig

getInitParameterNames

public final Enumeration getInitParameterNames()
Specified by:
getInitParameterNames in interface ServletConfig

getServletContext

public final ServletContext getServletContext()
Specified by:
getServletContext in interface ServletConfig

getServletName

public final String getServletName()
Specified by:
getServletName in interface ServletConfig

destroy

public void destroy()
Description copied from interface: HttpHandler
Called by the servlet to indicate to a HTTP handler that the servlet is being taken out of service. This method is only called once all threads within the servlet's service method have exited or after a timeout period has passed. After the servlet calls this method, it will not call any of the handler's methods again.$

This method gives the HTTP hanlder an opportunity to clean up any resources that are being held (for example, memory, file handles, threads) and make sure that any persistent state is synchronized with the handler's current state in memory.

Specified by:
destroy in interface HttpHandler

log

protected void log(String message,
                   Throwable throwable)

log

protected void log(String message)

startDocument

protected Writer startDocument(HttpServletResponse response)
                        throws IOException
Start a document

Parameters:
response -
Returns:
a Writer for the document
Throws:
IOException

endDocument

protected void endDocument(Writer html)
                    throws IOException
End a document

Parameters:
html -
Throws:
IOException

startHead

protected void startHead(Writer html)
                  throws IOException
Write the HEAD's start tag including its META element.

Parameters:
html -
Throws:
IOException

endHead

protected void endHead(Writer html)
                throws IOException
Write the HEAD's end tag.

Parameters:
html -
Throws:
IOException

startBody

protected void startBody(Writer html)
                  throws IOException
Write the BODY's start tag.

Parameters:
html -
Throws:
IOException

endBody

protected void endBody(Writer html)
                throws IOException
Write the BODY's start tag.

Parameters:
html -
Throws:
IOException

writeEncoded

protected static void writeEncoded(Writer html,
                                   String text)
                            throws IOException
Apply HTTP encoding to the text before writing it.

Parameters:
html -
text -
Throws:
IOException
NullPointerException - if html is null

debugDefault

protected boolean debugDefault()
Provide the "debug" default value.

Returns:
the "debug" default value


This software is published under the BSD license. Copyright © 2003-2007, OMEX AG, Switzerland, All rights reserved. Use is subject to license terms.