My filter handle the rewrite and parameter parsing, and dispatch to
according controller/action with a wrapped http request.

1. user hit the url: /user/1354
2. filter knows that user request the
UserController/UserServlet/UserAction/view-user.jsp with a param value 1354
(corresponding param should be the first pre-configed param, which should be
id)
3. the filter wrap the http request to add param name/value pair (id=1354)
4. (optional) call your Controller/Action for additional processing using
the wrapped request(probably a wrapped response for gzip/caching purpose)
5. dispatch to /UserServlet or /view-user.jsp using the wrapped
request(probably a wrapped response for gzip/caching purpose)

2009/10/31 <d.lo...@uib.es>

> And why is it that a servlet filter is "outside the application"? I
> consider it to be part of the application; it is simply a matter that
> those services are not provided directly by the framework used to
> implement the logic.
> Otherwise each framework would have to provide that capability.
>
> I have seen both approaches (Cocoon uses the later approach) and both
> have their strong/weak points.
>
> In any case, I don't think there's "a good answer and a bad one".
> S!
> D.
>
> S'està citant Riccardo Cohen <r...@architectedulogiciel.fr>:
>
> > I understand your point of view : separate url management and
> > application logic. It seems a good practice.
> >
> > In the same time this probably comes from the idea that search engine
> > friendly urls are "added" to the application, which basically does not
> > need it.
> > On one hand it is true. The url "/user/name" is an alias of
> > "/servlet?command=showuser&id=1354" in a functionnal point of view.
> > On the other hand, you may think of the SEF url as a request by itself,
> > and the controller is in charge of handling requests, of any syntax. So
> > if my controller parses the url "/servlet?command=showuser&id=1354", why
> > couldn't it parse the url "/user/name" instead directly ? This removes
> > from the application one level of control and complexity .
> >
> >
> > Am-I right ?
> >
> >
> > Wesley Wu wrote:
> >> Not recommended.
> >>
> >> I think filter should handle this, which is not relative to business
> logic.
> >>
> >> 2009/10/30 Riccardo Cohen <r...@architectedulogiciel.fr
> >> <mailto:r...@architectedulogiciel.fr>>
> >>
> >>     Thanks Wesley I'll try to use filter.
> >>     Now in term of performance, isn't it better to integrate the url
> >>     processing directly into the controller servlet ?
> >>
> >>     Wesley Wu wrote:
> >>      > You may use http://tuckey.org/urlrewrite/ UrlRewriteFilter.
> >>      >
> >>      > I wrote a similar filter doing the same thing which loads rewrite
> >>     config
> >>      > from database.
> >>      >
> >>      > 2009/10/30 Riccardo Cohen <r...@architectedulogiciel.fr
> >>     <mailto:r...@architectedulogiciel.fr>
> >>      > <mailto:r...@architectedulogiciel.fr
> >>     <mailto:r...@architectedulogiciel.fr>>>
> >>      >
> >>      >     Hello
> >>      >
> >>      >     I didn't have yet the opportunity to work with search engine
> >>     friendly
> >>      >     urls with resin (I did it with apache/php). I suppose that
> >>     there must be
> >>      >     a set of <servlet-mapping> and <rewrite-dispatch> in conf and
> >>     some
> >>      >     url-dedicated servlets in the application.
> >>      >
> >>      >     I wonder if there is any kind of "good practice" with resin
> >>      >     configuration to build SEF web sites.
> >>      >
> >>      >     In the wiki I found rewrite rules for php CMS, but not for
> >>     java apps.
> >>      >     (I use resin 3,2,0)
> >>      >
> >>      >     Thanks a lot.
> >>      >     --
> >>      >     Riccardo Cohen
> >>      >     Architecte du Logiciel
> >>      >     http://www.architectedulogiciel.fr
> >>      >     +33 (0)6.09.83.64.49
> >>      >     Membre du réseau http://www.reflexe-conseil-centre.org
> >>      >
> >>      >
> >>      >
> >>      >
> >>      >     _______________________________________________
> >>      >     resin-interest mailing list
> >>      >     resin-interest@caucho.com <mailto:resin-interest@caucho.com>
> >>     <mailto:resin-interest@caucho.com <mailto:resin-interest@caucho.com
> >>
> >>      >     http://maillist.caucho.com/mailman/listinfo/resin-interest
> >>      >
> >>      >
> >>      >
> >>      >
> >>
> ------------------------------------------------------------------------
> >>      >
> >>      > _______________________________________________
> >>      > resin-interest mailing list
> >>      > resin-interest@caucho.com <mailto:resin-interest@caucho.com>
> >>      > http://maillist.caucho.com/mailman/listinfo/resin-interest
> >>
> >>     --
> >>     Riccardo Cohen
> >>     Architecte du Logiciel
> >>     http://www.architectedulogiciel.fr
> >>     +33 (0)6.09.83.64.49
> >>     Membre du réseau http://www.reflexe-conseil-centre.org
> >>
> >>
> >>
> >>
> >>     _______________________________________________
> >>     resin-interest mailing list
> >>     resin-interest@caucho.com <mailto:resin-interest@caucho.com>
> >>     http://maillist.caucho.com/mailman/listinfo/resin-interest
> >>
> >>
> >>
> >> ------------------------------------------------------------------------
> >>
> >> _______________________________________________
> >> resin-interest mailing list
> >> resin-interest@caucho.com
> >> http://maillist.caucho.com/mailman/listinfo/resin-interest
> >
> > --
> > Riccardo Cohen
> > Architecte du Logiciel
> > http://www.architectedulogiciel.fr
> > +33 (0)6.09.83.64.49
> > Membre du réseau http://www.reflexe-conseil-centre.org
> >
> >
> >
> >
> > _______________________________________________
> > resin-interest mailing list
> > resin-interest@caucho.com
> > http://maillist.caucho.com/mailman/listinfo/resin-interest
> >
>
>
>
> ----------------------------------------------------------------
>
>
>
>
>
> _______________________________________________
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest
>
_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to