You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mike Curwen <gb...@gb-im.com> on 2004/04/06 23:34:39 UTC

Wrapping Requests and jsp:include

Hello,

I'm just wanting to check if something is "consistent with Spec".  I've
tested code that performs the following, in tomcat 4.1.29, and it 'works
as expected'. So I'm curious if this is a 'guaranteed' behaviour across
all containers, or if this is one of those fuzzy areas, and it just
happily works in Tomcat.
 
I am using com.oreilly.servlet to upload files and I'm using them
through a file upload filter and MultipartRequestWrapper class
(borrowing heavily from those available in cos).
 
in process.jsp:
------------------------------------------
<%
  MultipartRequestWrapper multi = (MultipartRequestWrapper) request;
  filename = multi.getFilesystemName("image_1");
  logger.debug("filename: " + filename);
%>

<jsp:include page="someOtherJsp.jsp" />
------------------------------------------

in someOtherJsp.jsp:
------------------------------------------
<%
  MultipartRequestWrapper multi = (MultipartRequestWrapper) request;
  filename = multi.getFilesystemName("image_1");
  logger.debug("filename: " + filename);
%>


In my log4j logs:
DEBUG com.gbim.web.FileUploadFilter - [wrapping request] 
DEBUG booster/process.jsp - [filename: separator.gif]
DEBUG booster/someOtherJsp.jsp - [filename: separator.gif] 


So: I can access the request again, in the included file, as a
MultiPartRequestWrapper.  So when Tomcat, the container, makes its
internal jsp:include request, it passes along the *existing* request,
wrapped and everything, as is. I seemed to recall some conversation
about facades getting in the way, but this has been taken care of since
? Or was I dreaming? I've googled for this (probably imagined)
conversation, and can't find it.


-----------------------------------------------
mike curwen                    
intermediate programmer
globally boundless

204 885-7733  ext 229
www.globallyboundless.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Wrapping Requests and jsp:include

Posted by Mike Curwen <gb...@gb-im.com>.
I only wanted to know if Tomcat wrapped the request object in a façade
of some sort, when it does a jsp:include.
 
Maybe I should have just asked that much simpler question. ;)  (Or
looked at the source of a compiled jsp page?)  But well... there's still
the question of "that's the way Tomcat does it" vs. "this is how Resin
does the same thing" and whether or not there is a spec mandate to do it
one way or another.

What I'm trying (and succeeding) to do is access a multipart upload from
included jsp files. I just want to make sure this same code would work
'everywhere'.

> -----Original Message-----
> From: Yansheng Lin [mailto:yansheng.lin@silvacom.com] 
> Sent: Wednesday, April 07, 2004 10:39 AM
> To: 'Tomcat Users List'
> Subject: RE: Wrapping Requests and jsp:include
> 
> 
> Hey, you may want to try the question on the dev list.  But 
> IMHO if tomcat does not follow the spec, then it would be a 
> bug.  um, can you think of any other ways of retrieving the 
> image without using a wrapper?  if you are simply viewing the 
> image, there may be a easier way. But I am not sure what you 
> are doing exactly....
> 
> -Yan
> 
> -----Original Message-----
> From: Mike Curwen [mailto:gb_dev@gb-im.com] 
> Sent: Wednesday, April 07, 2004 8:19 AM
> To: 'Tomcat Users List'
> Subject: RE: Wrapping Requests and jsp:include
> 
> 
> I know that works. My main concern was "does tomcat 
> internally construct a new request". Because then I wouldn't 
> be getting my wrapped request in the included page.  But it 
> appears to pass along the original request object (whatever it is).
> 
> > -----Original Message-----
> > From: Yan Lin [mailto:yansheng_lin@yahoo.com]
> > Sent: Wednesday, April 07, 2004 12:10 AM
> > To: Tomcat Users List
> > Subject: Re: Wrapping Requests and jsp:include
> > 
> > 
> > Hi, I think that's the correct behaviour for
> > <jsp:include> action. The request is shared among all
> > the included pages.  If you are still in doubt, you
> > can do a simple test by setting a param in your
> > request for you main jsp file, then try to retrieve it
> > in your included jsp file.
> > 
> > Hope this helps:).
> > 
> > -Yan
> > 
> > --- Mike Curwen <gb...@gb-im.com> wrote:
> > > Hello,
> > > 
> > > I'm just wanting to check if something is
> > > "consistent with Spec".  I've
> > > tested code that performs the following, in tomcat
> > > 4.1.29, and it 'works
> > > as expected'. So I'm curious if this is a
> > > 'guaranteed' behaviour across
> > > all containers, or if this is one of those fuzzy
> > > areas, and it just
> > > happily works in Tomcat.
> > >  
> > > I am using com.oreilly.servlet to upload files and
> > > I'm using them
> > > through a file upload filter and
> > > MultipartRequestWrapper class
> > > (borrowing heavily from those available in cos).
> > >  
> > > in process.jsp:
> > > ------------------------------------------
> > > <%
> > >   MultipartRequestWrapper multi =
> > > (MultipartRequestWrapper) request;
> > >   filename = multi.getFilesystemName("image_1");
> > >   logger.debug("filename: " + filename);
> > > %>
> > > 
> > > <jsp:include page="someOtherJsp.jsp" />
> > > ------------------------------------------
> > > 
> > > in someOtherJsp.jsp:
> > > ------------------------------------------
> > > <%
> > >   MultipartRequestWrapper multi =
> > > (MultipartRequestWrapper) request;
> > >   filename = multi.getFilesystemName("image_1");
> > >   logger.debug("filename: " + filename);
> > > %>
> > > 
> > > 
> > > In my log4j logs:
> > > DEBUG com.gbim.web.FileUploadFilter - [wrapping
> > > request]
> > > DEBUG booster/process.jsp - [filename:
> > > separator.gif]
> > > DEBUG booster/someOtherJsp.jsp - [filename:
> > > separator.gif]
> > > 
> > > 
> > > So: I can access the request again, in the included
> > > file, as a
> > > MultiPartRequestWrapper.  So when Tomcat, the
> > > container, makes its
> > > internal jsp:include request, it passes along the
> > > *existing* request,
> > > wrapped and everything, as is. I seemed to recall
> > > some conversation
> > > about facades getting in the way, but this has been
> > > taken care of since
> > > ? Or was I dreaming? I've googled for this (probably
> > > imagined)
> > > conversation, and can't find it.
> > > 
> > > 
> > > -----------------------------------------------
> > > mike curwen                    
> > > intermediate programmer
> > > globally boundless
> > > 
> > > 204 885-7733  ext 229
> > > www.globallyboundless.com
> > > 
> > > 
> > >
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: 
> tomcat-user-help@jakarta.apache.org
> > > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Small Business $15K Web Design Giveaway
> > http://promotions.yahoo.com/design_giveaway/
> > 
> > 
> ---------------------------------------------------------------------
> > 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
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Wrapping Requests and jsp:include

Posted by Yansheng Lin <ya...@silvacom.com>.
Hey, you may want to try the question on the dev list.  But IMHO if tomcat does
not follow the spec, then it would be a bug.  um, can you think of any other
ways of retrieving the image without using a wrapper?  if you are simply viewing
the image, there may be a easier way. But I am not sure what you are doing
exactly....

-Yan

-----Original Message-----
From: Mike Curwen [mailto:gb_dev@gb-im.com] 
Sent: Wednesday, April 07, 2004 8:19 AM
To: 'Tomcat Users List'
Subject: RE: Wrapping Requests and jsp:include


I know that works. My main concern was "does tomcat internally construct
a new request". Because then I wouldn't be getting my wrapped request in
the included page.  But it appears to pass along the original request
object (whatever it is).

> -----Original Message-----
> From: Yan Lin [mailto:yansheng_lin@yahoo.com] 
> Sent: Wednesday, April 07, 2004 12:10 AM
> To: Tomcat Users List
> Subject: Re: Wrapping Requests and jsp:include
> 
> 
> Hi, I think that's the correct behaviour for
> <jsp:include> action. The request is shared among all
> the included pages.  If you are still in doubt, you
> can do a simple test by setting a param in your
> request for you main jsp file, then try to retrieve it
> in your included jsp file.  
> 
> Hope this helps:).
> 
> -Yan
> 
> --- Mike Curwen <gb...@gb-im.com> wrote:
> > Hello,
> > 
> > I'm just wanting to check if something is
> > "consistent with Spec".  I've
> > tested code that performs the following, in tomcat
> > 4.1.29, and it 'works
> > as expected'. So I'm curious if this is a
> > 'guaranteed' behaviour across
> > all containers, or if this is one of those fuzzy
> > areas, and it just
> > happily works in Tomcat.
> >  
> > I am using com.oreilly.servlet to upload files and
> > I'm using them
> > through a file upload filter and
> > MultipartRequestWrapper class
> > (borrowing heavily from those available in cos).
> >  
> > in process.jsp:
> > ------------------------------------------
> > <%
> >   MultipartRequestWrapper multi =
> > (MultipartRequestWrapper) request;
> >   filename = multi.getFilesystemName("image_1");
> >   logger.debug("filename: " + filename);
> > %>
> > 
> > <jsp:include page="someOtherJsp.jsp" />
> > ------------------------------------------
> > 
> > in someOtherJsp.jsp:
> > ------------------------------------------
> > <%
> >   MultipartRequestWrapper multi =
> > (MultipartRequestWrapper) request;
> >   filename = multi.getFilesystemName("image_1");
> >   logger.debug("filename: " + filename);
> > %>
> > 
> > 
> > In my log4j logs:
> > DEBUG com.gbim.web.FileUploadFilter - [wrapping
> > request]
> > DEBUG booster/process.jsp - [filename:
> > separator.gif]
> > DEBUG booster/someOtherJsp.jsp - [filename:
> > separator.gif] 
> > 
> > 
> > So: I can access the request again, in the included
> > file, as a
> > MultiPartRequestWrapper.  So when Tomcat, the
> > container, makes its
> > internal jsp:include request, it passes along the
> > *existing* request,
> > wrapped and everything, as is. I seemed to recall
> > some conversation
> > about facades getting in the way, but this has been
> > taken care of since
> > ? Or was I dreaming? I've googled for this (probably
> > imagined)
> > conversation, and can't find it.
> > 
> > 
> > -----------------------------------------------
> > mike curwen                    
> > intermediate programmer
> > globally boundless
> > 
> > 204 885-7733  ext 229
> > www.globallyboundless.com
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Small Business $15K Web Design Giveaway 
> http://promotions.yahoo.com/design_giveaway/
> 
> ---------------------------------------------------------------------
> 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: Wrapping Requests and jsp:include

Posted by Mike Curwen <gb...@gb-im.com>.
I know that works. My main concern was "does tomcat internally construct
a new request". Because then I wouldn't be getting my wrapped request in
the included page.  But it appears to pass along the original request
object (whatever it is).

> -----Original Message-----
> From: Yan Lin [mailto:yansheng_lin@yahoo.com] 
> Sent: Wednesday, April 07, 2004 12:10 AM
> To: Tomcat Users List
> Subject: Re: Wrapping Requests and jsp:include
> 
> 
> Hi, I think that's the correct behaviour for
> <jsp:include> action. The request is shared among all
> the included pages.  If you are still in doubt, you
> can do a simple test by setting a param in your
> request for you main jsp file, then try to retrieve it
> in your included jsp file.  
> 
> Hope this helps:).
> 
> -Yan
> 
> --- Mike Curwen <gb...@gb-im.com> wrote:
> > Hello,
> > 
> > I'm just wanting to check if something is
> > "consistent with Spec".  I've
> > tested code that performs the following, in tomcat
> > 4.1.29, and it 'works
> > as expected'. So I'm curious if this is a
> > 'guaranteed' behaviour across
> > all containers, or if this is one of those fuzzy
> > areas, and it just
> > happily works in Tomcat.
> >  
> > I am using com.oreilly.servlet to upload files and
> > I'm using them
> > through a file upload filter and
> > MultipartRequestWrapper class
> > (borrowing heavily from those available in cos).
> >  
> > in process.jsp:
> > ------------------------------------------
> > <%
> >   MultipartRequestWrapper multi =
> > (MultipartRequestWrapper) request;
> >   filename = multi.getFilesystemName("image_1");
> >   logger.debug("filename: " + filename);
> > %>
> > 
> > <jsp:include page="someOtherJsp.jsp" />
> > ------------------------------------------
> > 
> > in someOtherJsp.jsp:
> > ------------------------------------------
> > <%
> >   MultipartRequestWrapper multi =
> > (MultipartRequestWrapper) request;
> >   filename = multi.getFilesystemName("image_1");
> >   logger.debug("filename: " + filename);
> > %>
> > 
> > 
> > In my log4j logs:
> > DEBUG com.gbim.web.FileUploadFilter - [wrapping
> > request]
> > DEBUG booster/process.jsp - [filename:
> > separator.gif]
> > DEBUG booster/someOtherJsp.jsp - [filename:
> > separator.gif] 
> > 
> > 
> > So: I can access the request again, in the included
> > file, as a
> > MultiPartRequestWrapper.  So when Tomcat, the
> > container, makes its
> > internal jsp:include request, it passes along the
> > *existing* request,
> > wrapped and everything, as is. I seemed to recall
> > some conversation
> > about facades getting in the way, but this has been
> > taken care of since
> > ? Or was I dreaming? I've googled for this (probably
> > imagined)
> > conversation, and can't find it.
> > 
> > 
> > -----------------------------------------------
> > mike curwen                    
> > intermediate programmer
> > globally boundless
> > 
> > 204 885-7733  ext 229
> > www.globallyboundless.com
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Small Business $15K Web Design Giveaway 
> http://promotions.yahoo.com/design_giveaway/
> 
> ---------------------------------------------------------------------
> 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: Wrapping Requests and jsp:include

Posted by Yan Lin <ya...@yahoo.com>.
Hi, I think that's the correct behaviour for
<jsp:include> action. The request is shared among all
the included pages.  If you are still in doubt, you
can do a simple test by setting a param in your
request for you main jsp file, then try to retrieve it
in your included jsp file.  

Hope this helps:).

-Yan

--- Mike Curwen <gb...@gb-im.com> wrote:
> Hello,
> 
> I'm just wanting to check if something is
> "consistent with Spec".  I've
> tested code that performs the following, in tomcat
> 4.1.29, and it 'works
> as expected'. So I'm curious if this is a
> 'guaranteed' behaviour across
> all containers, or if this is one of those fuzzy
> areas, and it just
> happily works in Tomcat.
>  
> I am using com.oreilly.servlet to upload files and
> I'm using them
> through a file upload filter and
> MultipartRequestWrapper class
> (borrowing heavily from those available in cos).
>  
> in process.jsp:
> ------------------------------------------
> <%
>   MultipartRequestWrapper multi =
> (MultipartRequestWrapper) request;
>   filename = multi.getFilesystemName("image_1");
>   logger.debug("filename: " + filename);
> %>
> 
> <jsp:include page="someOtherJsp.jsp" />
> ------------------------------------------
> 
> in someOtherJsp.jsp:
> ------------------------------------------
> <%
>   MultipartRequestWrapper multi =
> (MultipartRequestWrapper) request;
>   filename = multi.getFilesystemName("image_1");
>   logger.debug("filename: " + filename);
> %>
> 
> 
> In my log4j logs:
> DEBUG com.gbim.web.FileUploadFilter - [wrapping
> request] 
> DEBUG booster/process.jsp - [filename:
> separator.gif]
> DEBUG booster/someOtherJsp.jsp - [filename:
> separator.gif] 
> 
> 
> So: I can access the request again, in the included
> file, as a
> MultiPartRequestWrapper.  So when Tomcat, the
> container, makes its
> internal jsp:include request, it passes along the
> *existing* request,
> wrapped and everything, as is. I seemed to recall
> some conversation
> about facades getting in the way, but this has been
> taken care of since
> ? Or was I dreaming? I've googled for this (probably
> imagined)
> conversation, and can't find it.
> 
> 
> -----------------------------------------------
> mike curwen                    
> intermediate programmer
> globally boundless
> 
> 204 885-7733  ext 229
> www.globallyboundless.com
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org