You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Frank Villarreal <f_...@tetco.com> on 2005/09/08 21:16:05 UTC

Dynamic Images and HttpServletRequest [J2]

Hello all.

Couple of questions.

Q#1: I've been browsing the mail archives to no avail and finding I'm not
alone in the need to serve up dynamic images through the portal ... which
happens to be a two-request process (1-generate image and html, 2-pull the
image down).  Also haven't seen any concrete way to accomplish it.  So, can
someone please tell me how to reference the raw HttpServletRequest object
from within a doRender response of a portlet?  I have a servlet that
generates an image file and I'd like to "write" that file to some directory
in my portlet directory and then create a link to it from an <img> tag in my
view page.  The HttpServletRequest object supports the "getRealPath" method
which can tell me where to output my image file to ... but first I need to
get a handle on the underlying Request.  Help please!

Q#2: Apparently, the mail archive at marcaimsgroup is no longer archiving
recent Jetspeed emails.  Does anyone know of a current and searchable
archive for the jetspeed-user and jetspeed-dev mailing lists?

- Frank


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


Re: Dynamic Images and HttpServletRequest [J2]

Posted by David Sean Taylor <da...@bluesunrise.com>.
Frank Villarreal wrote:
> Hello all.
> 
> Couple of questions.
> 
> Q#1: I've been browsing the mail archives to no avail and finding I'm not
> alone in the need to serve up dynamic images through the portal ... which
> happens to be a two-request process (1-generate image and html, 2-pull the
> image down).  Also haven't seen any concrete way to accomplish it.  So, can
> someone please tell me how to reference the raw HttpServletRequest object
> from within a doRender response of a portlet?  I have a servlet that
> generates an image file and I'd like to "write" that file to some directory
> in my portlet directory and then create a link to it from an <img> tag in my
> view page.  The HttpServletRequest object supports the "getRealPath" method
> which can tell me where to output my image file to ... but first I need to
> get a handle on the underlying Request.  Help please!

Well the 2 phase sounds like a job for action/render phases of portlet 
api. But beware, you can't dispatch to servlets during the action 
(first) phase. So you may want to move your logic to generate the image 
into your portlet's action and out of the servlet. Then in the second 
phase, you can use something as simple as the FilePortlet (a servlet 
portlet) to display the image relative to your context.

As for "reference the raw HttpServletRequest object", just dispatch to 
it from your portlet.
Something like:

String path = "/raisons.jsp?orderno=5";
PortletRequestDispatcher rd = context.getRequestDispatcher(path);
rd.include(renderRequest, renderResponse);


> 
> Q#2: Apparently, the mail archive at marcaimsgroup is no longer archiving
> recent Jetspeed emails.  Does anyone know of a current and searchable
> archive for the jetspeed-user and jetspeed-dev mailing lists?
> 
We have mail archives at Apache

http://mail-archives.apache.org/mod_mbox/

-- 
David Sean Taylor
Bluesunrise Software
david@bluesunrise.com
[office] +01 707 773-4646
[mobile] +01 707 529 9194

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