lcanals.tc.web.event
Interface EventHandler

All Known Implementing Classes:
AbstractEventHandler, SeeEstimatorEvent

public interface EventHandler

Interface for the handlers of web events. File "Event.properties" has a list of keys and names of class of EventHandlers in the next way:
NAME=lcanals.tc.web.model.AnEventHandler

Think that objects of this class will be called by several threads at time, so make it thread-safe


Field Summary
static java.lang.String DEFAULT_EVENT
          Event when no event is said
static java.lang.String ERROR_EVENT
          Event when an error occurs
 
Method Summary
 void forward(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Redirects the response to a specific view.
 void process(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request)
          Process the received parameters from the request.
 

Field Detail

DEFAULT_EVENT

public static final java.lang.String DEFAULT_EVENT
Event when no event is said

ERROR_EVENT

public static final java.lang.String ERROR_EVENT
Event when an error occurs
Method Detail

process

public void process(javax.servlet.ServletContext context,
                    javax.servlet.http.HttpServletRequest request)
             throws EventHandlerException
Process the received parameters from the request. If an error occurs, can throws a ServletException or stores it into the request as an attribute; then when forward were called, can be send to a specific error page which can permit correct the error (the case, for example, of misscompleted parameters in a form)
Throws:
EventHandlerException - when is no possible to process the request (usually due to crack intends)

forward

public void forward(javax.servlet.ServletContext context,
                    javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws java.io.IOException,
                    javax.servlet.ServletException
Redirects the response to a specific view. Fills up the session/request/context with the suitable beans for the view.
URLs can be read from a file A recommended behaviour, when error occurs, could be take the error from the request (as an attribute) and redirect to an error view.


Luis F. Canals. Supported by www.sourceforge.net