tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Wingfield <jon.wingfi...@mkodo.com>
Subject Re: Multi-part response
Date Tue, 18 Oct 2005 10:07:29 GMT
If the browser supports it you would send the whole page in one 
multipart response a bit like a mail message.

Here's one way to do it:
So, you'd have to buffer the response. Then create a 
javax.mail.internet.MimeMultipart and add BodyParts 
(javax.mail.internet.MimeBodyPart) for the html and each of the images.
For each image link in the html you'll have to change it for the 
Content-Id of the corresponding image MimeBodyPart.

For example (IIRC):
For an image blah.gif with a Content-Id of piccy1 replace the contents 
of the src attribute of the image tag in the html with "cid:piccy1"

http://www.ietf.org/rfc/rfc2111.txt

javax.mail.Multipart has a handy writeTo(...) method so you can splurge 
the entire thing down the response outputstream.

HTH and intrigued to see if any browser supports it,

Jon



ALEX HYDE wrote:
> Hi David,
> 
> I guess I meant that I wanted to write part of a page,
> and then write the image straight othe stream, then
> some more of the page, and then another image direct
> to the stream, and then....
> 
> I am not sure of the syntax?
> 
> --- David Delbecq <delbd@oma.be> wrote:
> 
> 
>>Well am not sure of what you mean, and am not sure
>>browser accept multi-part response that way, but i
>>dont know
>>http protocol enough. Could you provide an example
>>http
>>response you would like to get??
>>
>>Anyway, struts in itself is not extensible that way.
>>
>>
>>ALEX HYDE a écrit :
>>
>>
>>>Cheers. I think I wanted to know how and if there
>>
>>was
>>
>>>a good way of incororating mulitpart response into
>>
>>a
>>
>>>framewrok like struts? 
>>>
>>>Let's say I have a page with a number of src tags
>>>embeded in it, and I don't want the browser to have
>>
>>to
>>
>>>pull in each image individually, how could I write
>>>them all out to a single response and still stay
>>>within a tidy framework like Struts?
>>>
>>>--- David Delbecq <delbd@oma.be> wrote:
>>>
>>> 
>>>
>>>
>>>>If you want to alter the response of a servlet
>>
>>(like
>>
>>>>struts servlet), a
>>>>ServletFilter is
>>>>a good choice.
>>>>
>>>>ALEX HYDE a écrit :
>>>>
>>>>   
>>>>
>>>>
>>>>>Hi All,
>>>>>
>>>>>This is probably not strictly a Tomcat question
>>
>>so
>>
>>>>>apologies. 
>>>>>
>>>>>If I am using Struts, how can I filter the output
>>>>>     
>>>>>
>>>>
>>>>so
>>>>   
>>>>
>>>>
>>>>>that I convert it into a multipart response?
>>
>>Using
>>
>>>>>     
>>>>>
>>>>
>>>>a
>>>>   
>>>>
>>>>
>>>>>filter probably! But I'm not sure how. For
>>
>>example,
>>
>>>>>how could I send all my embedded images and the
>>>>>response in one mulit-part response?
>>>>>
>>>>>Thanks alot
>>>>>
>>>>>Alex
>>>>>
>>>>>
>>>>>	
>>>>>	
>>>>>		
>>>>>     
>>>>>
>>
>>>___________________________________________________________
>>>
>>>>   
>>>>
>>>>
>>>>>Yahoo! Messenger - NEW crystal clear PC to PC
>>>>>     
>>>>>
>>>>
>>>>calling worldwide with voicemail
>>>>http://uk.messenger.yahoo.com
>>>>   
>>>>
>>
>>>---------------------------------------------------------------------
>>>
>>>>   
>>>>
>>>>
>>>>>To unsubscribe, e-mail:
>>>>>     
>>>>>
>>>>
>>>>users-unsubscribe@tomcat.apache.org
>>>>   
>>>>
>>>>
>>>>>For additional commands, e-mail:
>>>>>     
>>>>>
>>>>
>>>>users-help@tomcat.apache.org
>>>>   
>>>>
>>>>
>>>>>
>>>>>     
>>>>>
>>>>
>>>>   
>>>>
>>
>>---------------------------------------------------------------------
>>
>>> 
>>>
>>>
>>>>To unsubscribe, e-mail:
>>>>users-unsubscribe@tomcat.apache.org
>>>>For additional commands, e-mail:
>>>>users-help@tomcat.apache.org
>>>>
>>>>
>>>>   
>>>>
>>>
>>>
>>>
>>>		
>>
>>___________________________________________________________
>>
>>
>>>How much free photo storage do you get? Store your
>>
>>holiday 
>>
>>>snaps for FREE with Yahoo! Photos
>>
>>http://uk.photos.yahoo.com
>>
>>---------------------------------------------------------------------
>>
>>>To unsubscribe, e-mail:
>>
>>users-unsubscribe@tomcat.apache.org
>>
>>>For additional commands, e-mail:
>>
>>users-help@tomcat.apache.org
>>
>>> 
>>>
>>
>>
>>
> ---------------------------------------------------------------------
> 
>>To unsubscribe, e-mail:
>>users-unsubscribe@tomcat.apache.org
>>For additional commands, e-mail:
>>users-help@tomcat.apache.org
>>
>>
> 
> 
> 
> 
> 		
> ___________________________________________________________ 
> To help you stay safe and secure online, we've developed the all new Yahoo! Security
Centre. http://uk.security.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 



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


Mime
View raw message