You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by cristi <cr...@medialab.sissa.it> on 2005/07/15 11:34:25 UTC
Re: Copying an HttpServletRequest
> Can you tell us what you are trying to achieve? There is almost
> certainly an alternative way of getting to the same end without having
> to copy requests but, until you give us a bit more detail, we can't help
> you.
We have a software project up an running but some modifications are
required.
The requirement of making a copy of the HttpServletRequest is
generated by the fact that the former programmers have used (in a
natural manner):
1) the HttpServletRequest.setAttributes() to send data to the jsp
pages creating the response. ( These data is the servlet
computation result).
2) within the jsp pages creating the result various methods of the
HttpServletRequest (other than HttpServletRequest.getAttributes() )
object are used to get information from the request object.
Now there is the requirement that in the second request sent to the
servlet we have to use the computation result of the first request
(that is those data that you could find using the
HttpServletRequest.getAttributes() applied to the request object sent
in the first request ) to create the final HTML page.
Let's supose now that in the second request we have a way of finding
the computation result of the first request. This is not enough to
satisfy the second request because in order to render the HTML page of
the second request we also need other information which can be found
in the request object sent during the first request
(e.g. HttpServletRequest.getParameter() );
I hope that I was explicit enough.
Final word: We knew it from the start that a solution exists (saving
and using all the data that we need between the requests
but this is not an easy task now since we have to
analyze - and to write - a lot of code), but since all
this data can be found in the request object sent to the
servlet with the first request we thought that making a
copy of the request object should be very easy (and very
natural at the same time).
Thx
C r i s t i Z o i c a s.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Copying an HttpServletRequest
Posted by cristi <cr...@medialab.sissa.it>.
> I got a doubt .
> is your problem is not solved by putting the data computed by first
> JSP in the session object ??
> or putting all the required data in a bean (which is created by
> <jsp:useBean> in first jsp) with session scope and accessing that bean
> in second jsp ??
> with out seeing the entirety of your problem I can say that copying
> HttpRequest attributes into a bean (which in turn may store attributes
> and values in a hashmap) and setting it in Session and reusing it in
> second jsp should not take much time.
>
Ok. Your solution is what I proposed in my last paragraph, the only
difference is that you are more explicit.
The example below explains what is difficult :
EX1 :
Imagine that we have a set of servlets forwarding to the same jsp page.
After we do the modification to our system some of these servlets
must store the data temporarly (as you said, in the session).
Now the JSP rendering the result must have a way of distinguishing who
forwarded to it. If the forward was performed by one of our modified
servlets then it must read the results from the session. Otherwise
it can read the results from the place where it used to read.
We don't want to introduce such kind of dependency in our system.
Without analyzing the problem in detail I believe I can provide
you with other (more or less) inconvenient problems.
regards
cristi
> O n 7/15/05, cristi <cr...@medialab.sissa.it> wrote:
>
>>>Can you tell us what you are trying to achieve? There is almost
>>>certainly an alternative way of getting to the same end without having
>>>to copy requests but, until you give us a bit more detail, we can't help
>>>you.
>>
>>We have a software project up an running but some modifications are
>>required.
>>
>>The requirement of making a copy of the HttpServletRequest is
>>generated by the fact that the former programmers have used (in a
>>natural manner):
>>
>>1) the HttpServletRequest.setAttributes() to send data to the jsp
>> pages creating the response. ( These data is the servlet
>> computation result).
>>
>>2) within the jsp pages creating the result various methods of the
>> HttpServletRequest (other than HttpServletRequest.getAttributes() )
>> object are used to get information from the request object.
>>
>>Now there is the requirement that in the second request sent to the
>>servlet we have to use the computation result of the first request
>>(that is those data that you could find using the
>>HttpServletRequest.getAttributes() applied to the request object sent
>>in the first request ) to create the final HTML page.
>>
>>Let's supose now that in the second request we have a way of finding
>>the computation result of the first request. This is not enough to
>>satisfy the second request because in order to render the HTML page of
>>the second request we also need other information which can be found
>>in the request object sent during the first request
>>(e.g. HttpServletRequest.getParameter() );
>>
>>I hope that I was explicit enough.
>>
>>Final word: We knew it from the start that a solution exists (saving
>> and using all the data that we need between the requests
>> but this is not an easy task now since we have to
>> analyze - and to write - a lot of code), but since all
>> this data can be found in the request object sent to the
>> servlet with the first request we thought that making a
>> copy of the request object should be very easy (and very
>> natural at the same time).
>>
>>Thx
>>C r i s t i Z o i c a s.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Copying an HttpServletRequest
Posted by Peddireddy Srikanth <pe...@gmail.com>.
I got a doubt .
is your problem is not solved by putting the data computed by first
JSP in the session object ??
or putting all the required data in a bean (which is created by
<jsp:useBean> in first jsp) with session scope and accessing that bean
in second jsp ??
with out seeing the entirety of your problem I can say that copying
HttpRequest attributes into a bean (which in turn may store attributes
and values in a hashmap) and setting it in Session and reusing it in
second jsp should not take much time.
O n 7/15/05, cristi <cr...@medialab.sissa.it> wrote:
> > Can you tell us what you are trying to achieve? There is almost
> > certainly an alternative way of getting to the same end without having
> > to copy requests but, until you give us a bit more detail, we can't help
> > you.
>
> We have a software project up an running but some modifications are
> required.
>
> The requirement of making a copy of the HttpServletRequest is
> generated by the fact that the former programmers have used (in a
> natural manner):
>
> 1) the HttpServletRequest.setAttributes() to send data to the jsp
> pages creating the response. ( These data is the servlet
> computation result).
>
> 2) within the jsp pages creating the result various methods of the
> HttpServletRequest (other than HttpServletRequest.getAttributes() )
> object are used to get information from the request object.
>
> Now there is the requirement that in the second request sent to the
> servlet we have to use the computation result of the first request
> (that is those data that you could find using the
> HttpServletRequest.getAttributes() applied to the request object sent
> in the first request ) to create the final HTML page.
>
> Let's supose now that in the second request we have a way of finding
> the computation result of the first request. This is not enough to
> satisfy the second request because in order to render the HTML page of
> the second request we also need other information which can be found
> in the request object sent during the first request
> (e.g. HttpServletRequest.getParameter() );
>
> I hope that I was explicit enough.
>
> Final word: We knew it from the start that a solution exists (saving
> and using all the data that we need between the requests
> but this is not an easy task now since we have to
> analyze - and to write - a lot of code), but since all
> this data can be found in the request object sent to the
> servlet with the first request we thought that making a
> copy of the request object should be very easy (and very
> natural at the same time).
>
> Thx
> C r i s t i Z o i c a s.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org