org.baswell.routes
Class RoutesEngine

java.lang.Object
  extended by org.baswell.routes.RoutesEngine

public class RoutesEngine
extends java.lang.Object

Routes process engine. Reponsible for finding route method matches and executing matched methods. Used by RoutesFilter and RoutesServlet.

If no match is found on a call to process it is the responsibility of the caller to do something with the HTTP response. For example:

 if (!routesEngine.process(servletRequest, servletResponse))
 {
   servletResponse.setStatus(404);
 }
 
 


Constructor Summary
RoutesEngine(RoutingTable routingTable)
          If the routingTable has not already been built the RoutingTable.build() method will be called on the first request received.
 
Method Summary
 boolean process(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse)
          Looks for route matches for the given HTTP request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoutesEngine

public RoutesEngine(RoutingTable routingTable)
If the routingTable has not already been built the RoutingTable.build() method will be called on the first request received.

Parameters:
routingTable -
Method Detail

process

public boolean process(javax.servlet.http.HttpServletRequest servletRequest,
                       javax.servlet.http.HttpServletResponse servletResponse)
                throws java.io.IOException,
                       javax.servlet.ServletException
Looks for route matches for the given HTTP request. If a match is found the HTTP request is processed by the route method and true is returned. Otherwise no action is performed on the request and false is returned.

Parameters:
servletRequest - The HTTP request.
servletResponse - The HTTP response.
Returns:
True if the request has been processed by the Routes engine. False if no match was found and the request has not been processed.
Throws:
java.io.IOException - If an input or output error occurs while the servlet is handling the HTTP request.
javax.servlet.ServletException - If the HTTP request cannot be handled.