[opencms-dev] Request Handlers

Jason Schatz jes at urbancode.com
Fri Aug 13 18:50:07 CEST 2004


I've checked out the HEAD from cvs and have been playing around with 
request handlers.  I am using the request handlers to process requests 
submitted from HTML forms.  Ideally, I would like all form requests go 
to compiled Java code (such as the request handlers) and I would then 
like the ability for the response to be rendered using a standard VFS 
resource (so that the rendering of the response can take advantage of 
the templates and other stuff I already have set up in OpenCMS).  In MVC 
terms, the request handler acts as my Controller that can hook up with 
and manipulate my Model and then pass off the rendering of the response 
to the View which is a standard OpenCMS resource.

In order to achieve the last piece, the ability for the handler to use 
an existing resource to render the response, I had to add a method with 
the following signature to the OpenCmsCore object:

public void showResource(HttpServletRequest req, HttpServletResponse 
res, String viewPath)

which allows the request handler to process the request and the provide 
a path to a jsp to display the response.
I would like to know whether the way that I'm using request handlers is 
one of the intended uses or whether I should be using some other 
mechanism.  The bigger question is whether this means of accomplishing 
MVC is consistent with your direction for OpenCMS.  If so, would you 
accept a patch with the changes outlined above.
Eventually I would like to be able to add request handlers during 
runtime rather then having to specify them beforehand in the 
opencms-system.xml file.  I would be willing to work on a patch to 
achieve this behavior as well.
--Jason



More information about the opencms-dev mailing list