org.aselect.server.request
Class RequestHandlerFactory

java.lang.Object
  extended by org.aselect.server.request.RequestHandlerFactory

public class RequestHandlerFactory
extends java.lang.Object

Factory that invokes the appropriate request handler.

Description:
Using the request URL this Factory will try and match it with the configured regular expressions and invoke the associated request handler. The first match will process the request.

Concurrency issues:
- The factory is singleton

Author:
Alfa & Ariss

Method Summary
 void destroy()
          Destroys all objects created as class instance by this object.
static RequestHandlerFactory getHandle()
          Returns an instance of this object.
 java.util.Vector getRequestHandlers()
           
 void init(javax.servlet.ServletConfig oServletConfig, java.lang.Object oConfig)
          Initializes the Factory and the configured Request Handlers.
 void process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Processes an incoming Servlet request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

init

public void init(javax.servlet.ServletConfig oServletConfig,
                 java.lang.Object oConfig)
          throws ASelectException
Initializes the Factory and the configured Request Handlers.

Description:


Concurrency issues:
-

Preconditions:
Requires the following configuration:

<requests>
 <handlers>
  <handler
   id='[unique handler name]'
   class='[class name]'
   target='[regular expression]'>
    ...
  </handler>
 </handlers>
</requests>


Postconditions:
- All initialized request handlers will be stored in the _htRequestHandlers - The sequence that must be used while matching a request is stored in _vRequestHandlers

Parameters:
oServletConfig - The Servlet configuration of the Parent (Servlet) object
oConfig - The configuration object containing the request handler config
Throws:
ASelectException - if initalization fails

process

public void process(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws ASelectException
Processes an incoming Servlet request.

Description:
This function performs the following tasks:
Concurrency issues:
-

Preconditions:
-

Postconditions:
-

Parameters:
request - the HttpServletRequest containing the request
response - the HttpServletResponse were the response will be send
Throws:
ASelectException - if the matching request handler can't process the request

getHandle

public static RequestHandlerFactory getHandle()
Returns an instance of this object.

Description:
creates a new instance of the RequestHandlerFactory if the _oRequestHandlerFactory variable is null, else returns the object containing the _oRequestHandlerFactory object.

Concurrency issues:
-

Preconditions:
-

Postconditions:
- An instance of the class according the Singleton design pattern

Returns:
always the same RequestHandlerFactory instance

destroy

public void destroy()
Destroys all objects created as class instance by this object.

Description:
clears the class variables

Concurrency issues:
-

Preconditions:
-

Postconditions:
-


getRequestHandlers

public java.util.Vector getRequestHandlers()


Copyright © 2008 SURFnet BV. All Rights Reserved.