On 3/21/13 10:51 AM, Riccardo Cohen wrote:
> Hello
> I'm refactoring my url requests processing and need some advice. I've
> learnt mostly by myself, and I'm not sure to make the good choices.
> Presently my request processing is a mixing of servlet configurations like :
> <servlet-mapping url-pattern="*.jsp" servlet-name="resin-jsp"/>
> <servlet-mapping url-pattern="/fr/*" servlet-name="urlmanager"/>
> and some java code in UrlManager.java servlet, analysing the url
> request, processing the request, and calling at the end :
> req.getRequestDispatcher("/page.jsp").forward(req,res);
> When I call req.getRequestDispatcher("/page.jsp").forward(req,res); this
> goes through a certain process depending on resin.xml conf (first line
> above), analysing the pseudo-request "/page.jsp", and finally calling
> service() of the instance of com.caucho.jsp.JspServlet created by resin.
> I was wondering how to call directly the JspServlet instance myself ? It
> would be much quicker because I know this is a jsp page (systematic
> final step of the processing).

Since all that processing is cached, the cost is really just a hash map 
lookup, which
probably isn't noticeable.

You could also use ServletContext.getRequestDispatcher("...") in an 
init() method (or lazily) and save the RequestDispatcher object. The 
RequestDispatcher is reusable.

So calling directly shouldn't actually be a measurable gain.

> What I would like is having a better control on requests, by gathering
> all the processing in one point, not half configuration, half java code.
> My solution would be to have all requests handled by my unique
> urlmanager servlet, and I would dispatch them myself with built-in resin
> servlets. Any suggestion will be appreciated, as long as performance is
> "very" good.

Someone else would be in a better position to answer, but that sounds 
like a reasonable
architecture to me.

-- Scott

> I must say I'm a bit afraid of these big frameworks like spring/struts
> that brings many features that already exists in Resin, like
> persistency, tag library, dependency injection etc. One of the reason I
> like resin, apart from performances, is that there is everything in it.
> Thanks for your help.

resin-interest mailing list

Reply via email to