cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rice Yeh" <rice...@gmail.com>
Subject Re: Parameters in request get lost when using servlet: protocol
Date Wed, 04 Apr 2007 07:04:40 GMT
Not only  request.getParameter(String name) has problem but
request.getLocale() has problem too. So I decide to modify some methods in
BlockCallHttpServletRequest. My logic is as follows:

For parameters:
  First ask the request in the current call frame. If a parameter is not
found in the current request,  ask the request in the previous call frame.

For locale:
  Directly ask the request in previous call frame and eventually the request
in the first call frame, which is not an instance of
BlockCallHttpServletRequest,   answer the question.

With such logic, a parameter in current request can override the previous
one for the time in current call frame. Once leaving current call frame, the
overriding effect disappear.

I test it in my application. It works for me now. But do not know such logic
applies to others' use cases.

Rice

On 4/3/07, Alexander Klimetschek <alexander.klimetschek@mindquarry.com>
wrote:
>
> Rice Yeh schrieb:
> > Thank you for your solution. But I still feel weird for a brand new
> request
> > being created for a called block (servlet), at least for a super block
> > (servlet). Having a look at the source code, each new brand request and
> > response are supposed to be stored in its call frame (actually, this
> > feature
> > is not implemented yet, but api for retrieving these two objects are
> > provided). If such design is intended, why not just treat request and
> > response as part of servlet (block) context. And a way for passing a
> > request's attributes or parameters must be provided. My real opinion is
> > that
> > request should be pass through all servlets invoked, instead of creating
> a
> > new one.
>
> You are right, as far Cocoon's internal blocks with Sitemap servlets are
> involved. In that case one can optimize the calls and provide the original
> context (request, sitemap parameters etc.) to the callee. The only problem
> you have is how to handle the different parameter levels you have: you
> might
> want to have global but sometimes only local parameters, eg. when setting
> some value in a called block, you don't want it to override a parameter
> with
> the same name in the calling block.
>
> The advantage of the servlet protocol internally is that you can mount any
> servlet as a block, not only cocoon's sitemap servlet. We for example have
> mounted the Solr servlets (for indexing and searching with lucene) as
> normal
> blocks. This is a nice feature that allows you to manage your complex web
> application solely with Cocoon and Spring.
>
> Alex
>
> --
> Alexander Klimetschek
> http://www.mindquarry.com
>
>

Mime
View raw message