org.barracudamvc.core.comp.helper
Class ComponentGateway

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.barracudamvc.core.comp.helper.ComponentGateway
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
BrowserCheck, BTemplateGateway, CompEx1, CompEx11, CompEx4, CompEx5, CompEx6, CompEx7, FindRendererBugTest, HelloWorld1, HelloWorld1a, HelloWorld1b, HelloWorld2, HelloWorld2a, HelloWorld2b, HelloWorld3, HelloWorld4, RedirectEx1, SystemResources

public abstract class ComponentGateway
extends javax.servlet.http.HttpServlet

The component gateway is a servlet that provides a very simple interface to the Barracuda component model

See Also:
Serialized Form

Field Summary
static String HTTP_SERVLET_REQUEST
           
static String HTTP_SERVLET_RESPONSE
           
protected static org.apache.log4j.Logger logger
           
 boolean recycleChildren
           
 
Constructor Summary
ComponentGateway()
           
 
Method Summary
protected  void doDelete(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          By default the DELETE request is mapped to the handleDefault method
protected  void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          By default the GET request is mapped to the handleDefault method
protected  void doOptions(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          By default the OPTIONS request is mapped to the handleDefault method
protected  void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          By default the POST request is mapped to the handleDefault method
protected  void doPut(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          By default the PUT request is mapped to the handleDefault method
protected  void doTrace(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          By default the TRACE request is mapped to the handleDefault method
 DOMWriter getDOMWriter()
          Get a DOMWriter.
 BlockIterator getIterator(String key)
          Get a block iterator (optional)
abstract  Document handleDefault(BComponent root, ViewContext vc, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Handle the default HttpRequest.
protected  void handleDefault(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
 void handleEventException(EventException e, ViewContext vc, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Handle an EventException.
 void handleRenderException(RenderException e, ViewContext vc, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Handle a RenderException.
 
Methods inherited from class javax.servlet.http.HttpServlet
doHead, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger

recycleChildren

public boolean recycleChildren

HTTP_SERVLET_REQUEST

public static final String HTTP_SERVLET_REQUEST

HTTP_SERVLET_RESPONSE

public static final String HTTP_SERVLET_RESPONSE
Constructor Detail

ComponentGateway

public ComponentGateway()
Method Detail

handleDefault

public abstract Document handleDefault(BComponent root,
                                       ViewContext vc,
                                       javax.servlet.http.HttpServletRequest req,
                                       javax.servlet.http.HttpServletResponse resp)
                                throws javax.servlet.ServletException,
                                       IOException,
                                       RenderException,
                                       EventException

Handle the default HttpRequest. This is the method developers will typically override. The developers shaould add any components to the root component and then return the underlying DOM Document (that backs their components) so it can be rendered

Parameters:
root - the root component which will get rendered as a result of this request
vc - the ViewContext object describes what features the client view is capable of supporting
req - the servlet request
resp - the servlet response
Returns:
the Document to be rendered
Throws:
javax.servlet.ServletException
IOException
RenderException
EventException

handleEventException

public void handleEventException(EventException e,
                                 ViewContext vc,
                                 javax.servlet.http.HttpServletRequest req,
                                 javax.servlet.http.HttpServletResponse resp)
                          throws javax.servlet.ServletException,
                                 IOException

Handle an EventException. Basically, this is where we handle the really bad, unexpected type of event exceptions. Generally, as you code, if you want to interrupt the dispatch and fire a new event, you should throw an InterruptDispatchException. Only throw EventExceptions in truly exceptional circumstances.

Parameters:
e - the EventException to handle
vc - the ViewContext object describes what features the client view is capable of supporting
req - the servlet request
resp - the servlet response
Throws:
javax.servlet.ServletException
IOException

handleRenderException

public void handleRenderException(RenderException e,
                                  ViewContext vc,
                                  javax.servlet.http.HttpServletRequest req,
                                  javax.servlet.http.HttpServletResponse resp)
                           throws javax.servlet.ServletException,
                                  IOException

Handle a RenderException. Basically, this is where we handle the really bad, unexpected type of errors that occur while unexpectedldy rendering the component hierarchy.

Parameters:
e - the RenderException to handle
vc - the ViewContext object describes what features the client view is capable of supporting
req - the servlet request
resp - the servlet response
Throws:
javax.servlet.ServletException
IOException

getDOMWriter

public DOMWriter getDOMWriter()

Get a DOMWriter. By default, we use a DefaultDOMWriter. If you'd like to use something else, override this method.

Returns:
a DOMWriter to be used to render the DOM

getIterator

public BlockIterator getIterator(String key)
Get a block iterator (optional)


doGet

protected void doGet(javax.servlet.http.HttpServletRequest req,
                     javax.servlet.http.HttpServletResponse resp)
              throws javax.servlet.ServletException,
                     IOException

By default the GET request is mapped to the handleDefault method

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
req - the servlet request
resp - the servlet response
Throws:
javax.servlet.ServletException
IOException

doPost

protected void doPost(javax.servlet.http.HttpServletRequest req,
                      javax.servlet.http.HttpServletResponse resp)
               throws javax.servlet.ServletException,
                      IOException

By default the POST request is mapped to the handleDefault method

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
req - the servlet request
resp - the servlet response
Throws:
javax.servlet.ServletException
IOException

doOptions

protected void doOptions(javax.servlet.http.HttpServletRequest req,
                         javax.servlet.http.HttpServletResponse resp)
                  throws javax.servlet.ServletException,
                         IOException

By default the OPTIONS request is mapped to the handleDefault method

Overrides:
doOptions in class javax.servlet.http.HttpServlet
Parameters:
req - the servlet request
resp - the servlet response
Throws:
javax.servlet.ServletException
IOException

doDelete

protected void doDelete(javax.servlet.http.HttpServletRequest req,
                        javax.servlet.http.HttpServletResponse resp)
                 throws javax.servlet.ServletException,
                        IOException

By default the DELETE request is mapped to the handleDefault method

Overrides:
doDelete in class javax.servlet.http.HttpServlet
Parameters:
req - the servlet request
resp - the servlet response
Throws:
javax.servlet.ServletException
IOException

doPut

protected void doPut(javax.servlet.http.HttpServletRequest req,
                     javax.servlet.http.HttpServletResponse resp)
              throws javax.servlet.ServletException,
                     IOException

By default the PUT request is mapped to the handleDefault method

Overrides:
doPut in class javax.servlet.http.HttpServlet
Parameters:
req - the servlet request
resp - the servlet response
Throws:
javax.servlet.ServletException
IOException

doTrace

protected void doTrace(javax.servlet.http.HttpServletRequest req,
                       javax.servlet.http.HttpServletResponse resp)
                throws javax.servlet.ServletException,
                       IOException

By default the TRACE request is mapped to the handleDefault method

Overrides:
doTrace in class javax.servlet.http.HttpServlet
Parameters:
req - the servlet request
resp - the servlet response
Throws:
javax.servlet.ServletException
IOException

handleDefault

protected void handleDefault(javax.servlet.http.HttpServletRequest req,
                             javax.servlet.http.HttpServletResponse resp)
                      throws javax.servlet.ServletException,
                             IOException
Throws:
javax.servlet.ServletException
IOException


Copyright © 2006 BarracudaMVC.org All Rights Reserved.