You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by mfs <fa...@gmail.com> on 2008/08/21 22:33:42 UTC

Re: Mounting dynamic content

Hi Martin did you come out with a solution for mounting a DynamicWebResource,
actually my problem is slightly different where i am showing my pdf inline
in the browser. Now when the user clicks "Save AS" (either through Browser's
File-> SaveAs or clicking on the save button on the pdf-toolbar") it shows
the name as you mentioned in your post, where i want it shown the custom pdf
name which i specify.

Any suggestions would be appreciated..



Martin Makundi wrote:
> 
> This is already performed automatically by ResourceStreamRequestTarget
> but IE disregards the header after opening the download-dialog:
> 
> 		// and content disposition if any
> 		String file = getFileName();
> 		if (file != null && (response instanceof WebResponse))
> 		{
> 			((WebResponse)response).setAttachmentHeader(file);
> 		}
> 
> My code:
> 
>           public void onClick() {
>             IResourceStream resourceStream = new AbstractResourceStream()
> {
>               private ByteArrayInputStream byteStream;
> 
>               public synchronized void close() throws IOException {
>                 if (byteStream != null) {
>                   byteStream.close();
>                   byteStream = null;
>                 }
>               }
> 
>               public synchronized InputStream getInputStream()
>                   throws ResourceStreamNotFoundException {
>                 FileAttachment fileAttachmentWithBytes = DatabaseServices
>                     .getById(fileAttachment);
>                 return byteStream = new ByteArrayInputStream(
>                     fileAttachmentWithBytes.getBytes());
>               }
> 
>             };
> 
>             getRequestCycle().setRequestTarget(
>                 new ResourceStreamRequestTarget(resourceStream,
>                     fileAttachment.getName()));
>           }
> 
> 
> 
> **
> Martin
> 
> 
> 2008/5/30 Rodolfo Hansen <rh...@kindleit.net>:
>> there is a DynamicWebResource (String filename) constructor you can use
>> to
>> specify the filename you want for the resource...
>>
>> On Thu, May 29, 2008 at 4:27 PM, Martin Makundi <
>> martin.makundi@koodaripalvelut.com> wrote:
>>
>>> It is an IE "bug" or "feature" that it disregards the content type
>>> after opening up the download (file save/open) dialog -> It uses
>>> windows file extension detection after that ;) On Firefox the content
>>> type suffices, but for IE I must hack the filename too.
>>>
>>> **
>>> Martin
>>>
>>> 2008/5/29 Rodolfo Hansen <rh...@kindleit.net>:
>>> > I think maybe what you want is to use a DynamicWebResource
>>> > and customize the ResourceState to return the correct content type...
>>> >
>>> > It makes more sense that a .doc link be of that type I think...
>>> >
>>> > On Thu, May 29, 2008 at 10:18 AM, Martijn Lindhout <
>>> mlindhout@jointeffort.nl>
>>> > wrote:
>>> >
>>> >> setting the HTTP Content-Disposition may help. The value should be
>>> >> something
>>> >> like
>>> >>
>>> >> attachment; filename=DummyFilename.doc
>>> >>
>>> >> 2008/5/26 Martin Makundi <ma...@koodaripalvelut.com>:
>>> >>
>>> >> > Hi!
>>> >> >
>>> >> > I have a web page whose content the user is supposed to save as a
>>> >> > XYZ.doc file. With Firefox it is sufficient to set the content-type
>>> to
>>> >> > application/msword.
>>> >> >
>>> >> > However, Internet Explorer takes my context path (the part before
>>> the
>>> >> > url parameters) as the filename, say "webapp" and forgets about the
>>> >> > content type already. Is there a simple way to mount my dnyamic
>>> page
>>> >> > as "DummyFilename.doc"?
>>> >> >
>>> >> > I would rather not use BookmarkablePage because the parameters are
>>> >> > huge. Ofcourse I could pass the parameters via an internal model,
>>> but
>>> >> > if there is a fast moujnting strategy for a dynamic page, I would
>>> be
>>> >> > interested.
>>> >> >
>>> >> > **
>>> >> > Martin
>>> >> >
>>> >> >
>>> ---------------------------------------------------------------------
>>> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> >> > For additional commands, e-mail: users-help@wicket.apache.org
>>> >> >
>>> >> >
>>> >>
>>> >>
>>> >> --
>>> >> Martijn Lindhout
>>> >> JointEffort IT Services
>>> >> http://www.jointeffort.nl
>>> >> mlindhout@jointeffort.nl
>>> >> +31 (0)6 18 47 25 29
>>> >>
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Mounting-dynamic-content-tp17473889p19096332.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Mounting dynamic content

Posted by mfs <fa...@gmail.com>.
Hi Martin,

Actually the issue is that i want to have a [custom-file-name].pdf declared
based on the pdf being generated, so if mount a page with a certain name (i
am not sure but) i would have to use the same name as specified for
mounting. 

Secondly i have question that when u talk about downloading the contents
from bookmarkable page, you would mean flushing/streaming the pdf contents
in the constructor of the bookmarkable page is it ?   

Thanks again



Martin Makundi wrote:
> 
> Have you tried to download your content from a bookmarkable page that
> is mounted as "/Filename.ext"?
> 
> **
> Martin
> 
> 2008/8/21 mfs <fa...@gmail.com>:
>>
>> Can you be elaborate more, a sample would be really helpful, just to let
>> u
>> know i am using a DynamicWebResource since i am generating the pdf on the
>> fly..
>>
>> Thanks in advance..
>>
>>
>> Martin Makundi wrote:
>>>
>>> Yes, I solved it. I open the file as a bookmarkable page which is
>>> mounted as "/MyPage.doc" or "/MyPage.pdf".
>>>
>>> **
>>> Martin
>>>
>>>
>>> 2008/8/21 mfs <fa...@gmail.com>:
>>>>
>>>> Hi Martin did you come out with a solution for mounting a
>>>> DynamicWebResource,
>>>> actually my problem is slightly different where i am showing my pdf
>>>> inline
>>>> in the browser. Now when the user clicks "Save AS" (either through
>>>> Browser's
>>>> File-> SaveAs or clicking on the save button on the pdf-toolbar") it
>>>> shows
>>>> the name as you mentioned in your post, where i want it shown the
>>>> custom
>>>> pdf
>>>> name which i specify.
>>>>
>>>> Any suggestions would be appreciated..
>>>>
>>>>
>>>>
>>>> Martin Makundi wrote:
>>>>>
>>>>> This is already performed automatically by ResourceStreamRequestTarget
>>>>> but IE disregards the header after opening the download-dialog:
>>>>>
>>>>>               // and content disposition if any
>>>>>               String file = getFileName();
>>>>>               if (file != null && (response instanceof WebResponse))
>>>>>               {
>>>>>                      
>>>>> ((WebResponse)response).setAttachmentHeader(file);
>>>>>               }
>>>>>
>>>>> My code:
>>>>>
>>>>>           public void onClick() {
>>>>>             IResourceStream resourceStream = new
>>>>> AbstractResourceStream()
>>>>> {
>>>>>               private ByteArrayInputStream byteStream;
>>>>>
>>>>>               public synchronized void close() throws IOException {
>>>>>                 if (byteStream != null) {
>>>>>                   byteStream.close();
>>>>>                   byteStream = null;
>>>>>                 }
>>>>>               }
>>>>>
>>>>>               public synchronized InputStream getInputStream()
>>>>>                   throws ResourceStreamNotFoundException {
>>>>>                 FileAttachment fileAttachmentWithBytes =
>>>>> DatabaseServices
>>>>>                     .getById(fileAttachment);
>>>>>                 return byteStream = new ByteArrayInputStream(
>>>>>                     fileAttachmentWithBytes.getBytes());
>>>>>               }
>>>>>
>>>>>             };
>>>>>
>>>>>             getRequestCycle().setRequestTarget(
>>>>>                 new ResourceStreamRequestTarget(resourceStream,
>>>>>                     fileAttachment.getName()));
>>>>>           }
>>>>>
>>>>>
>>>>>
>>>>> **
>>>>> Martin
>>>>>
>>>>>
>>>>> 2008/5/30 Rodolfo Hansen <rh...@kindleit.net>:
>>>>>> there is a DynamicWebResource (String filename) constructor you can
>>>>>> use
>>>>>> to
>>>>>> specify the filename you want for the resource...
>>>>>>
>>>>>> On Thu, May 29, 2008 at 4:27 PM, Martin Makundi <
>>>>>> martin.makundi@koodaripalvelut.com> wrote:
>>>>>>
>>>>>>> It is an IE "bug" or "feature" that it disregards the content type
>>>>>>> after opening up the download (file save/open) dialog -> It uses
>>>>>>> windows file extension detection after that ;) On Firefox the
>>>>>>> content
>>>>>>> type suffices, but for IE I must hack the filename too.
>>>>>>>
>>>>>>> **
>>>>>>> Martin
>>>>>>>
>>>>>>> 2008/5/29 Rodolfo Hansen <rh...@kindleit.net>:
>>>>>>> > I think maybe what you want is to use a DynamicWebResource
>>>>>>> > and customize the ResourceState to return the correct content
>>>>>>> type...
>>>>>>> >
>>>>>>> > It makes more sense that a .doc link be of that type I think...
>>>>>>> >
>>>>>>> > On Thu, May 29, 2008 at 10:18 AM, Martijn Lindhout <
>>>>>>> mlindhout@jointeffort.nl>
>>>>>>> > wrote:
>>>>>>> >
>>>>>>> >> setting the HTTP Content-Disposition may help. The value should
>>>>>>> be
>>>>>>> >> something
>>>>>>> >> like
>>>>>>> >>
>>>>>>> >> attachment; filename=DummyFilename.doc
>>>>>>> >>
>>>>>>> >> 2008/5/26 Martin Makundi <ma...@koodaripalvelut.com>:
>>>>>>> >>
>>>>>>> >> > Hi!
>>>>>>> >> >
>>>>>>> >> > I have a web page whose content the user is supposed to save as
>>>>>>> a
>>>>>>> >> > XYZ.doc file. With Firefox it is sufficient to set the
>>>>>>> content-type
>>>>>>> to
>>>>>>> >> > application/msword.
>>>>>>> >> >
>>>>>>> >> > However, Internet Explorer takes my context path (the part
>>>>>>> before
>>>>>>> the
>>>>>>> >> > url parameters) as the filename, say "webapp" and forgets about
>>>>>>> the
>>>>>>> >> > content type already. Is there a simple way to mount my dnyamic
>>>>>>> page
>>>>>>> >> > as "DummyFilename.doc"?
>>>>>>> >> >
>>>>>>> >> > I would rather not use BookmarkablePage because the parameters
>>>>>>> are
>>>>>>> >> > huge. Ofcourse I could pass the parameters via an internal
>>>>>>> model,
>>>>>>> but
>>>>>>> >> > if there is a fast moujnting strategy for a dynamic page, I
>>>>>>> would
>>>>>>> be
>>>>>>> >> > interested.
>>>>>>> >> >
>>>>>>> >> > **
>>>>>>> >> > Martin
>>>>>>> >> >
>>>>>>> >> >
>>>>>>> ---------------------------------------------------------------------
>>>>>>> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> >> > For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>> >> >
>>>>>>> >> >
>>>>>>> >>
>>>>>>> >>
>>>>>>> >> --
>>>>>>> >> Martijn Lindhout
>>>>>>> >> JointEffort IT Services
>>>>>>> >> http://www.jointeffort.nl
>>>>>>> >> mlindhout@jointeffort.nl
>>>>>>> >> +31 (0)6 18 47 25 29
>>>>>>> >>
>>>>>>> >
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Mounting-dynamic-content-tp17473889p19096332.html
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Mounting-dynamic-content-tp17473889p19096559.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Mounting-dynamic-content-tp17473889p19113341.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Mounting dynamic content

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Have you tried to download your content from a bookmarkable page that
is mounted as "/Filename.ext"?

**
Martin

2008/8/21 mfs <fa...@gmail.com>:
>
> Can you be elaborate more, a sample would be really helpful, just to let u
> know i am using a DynamicWebResource since i am generating the pdf on the
> fly..
>
> Thanks in advance..
>
>
> Martin Makundi wrote:
>>
>> Yes, I solved it. I open the file as a bookmarkable page which is
>> mounted as "/MyPage.doc" or "/MyPage.pdf".
>>
>> **
>> Martin
>>
>>
>> 2008/8/21 mfs <fa...@gmail.com>:
>>>
>>> Hi Martin did you come out with a solution for mounting a
>>> DynamicWebResource,
>>> actually my problem is slightly different where i am showing my pdf
>>> inline
>>> in the browser. Now when the user clicks "Save AS" (either through
>>> Browser's
>>> File-> SaveAs or clicking on the save button on the pdf-toolbar") it
>>> shows
>>> the name as you mentioned in your post, where i want it shown the custom
>>> pdf
>>> name which i specify.
>>>
>>> Any suggestions would be appreciated..
>>>
>>>
>>>
>>> Martin Makundi wrote:
>>>>
>>>> This is already performed automatically by ResourceStreamRequestTarget
>>>> but IE disregards the header after opening the download-dialog:
>>>>
>>>>               // and content disposition if any
>>>>               String file = getFileName();
>>>>               if (file != null && (response instanceof WebResponse))
>>>>               {
>>>>                       ((WebResponse)response).setAttachmentHeader(file);
>>>>               }
>>>>
>>>> My code:
>>>>
>>>>           public void onClick() {
>>>>             IResourceStream resourceStream = new
>>>> AbstractResourceStream()
>>>> {
>>>>               private ByteArrayInputStream byteStream;
>>>>
>>>>               public synchronized void close() throws IOException {
>>>>                 if (byteStream != null) {
>>>>                   byteStream.close();
>>>>                   byteStream = null;
>>>>                 }
>>>>               }
>>>>
>>>>               public synchronized InputStream getInputStream()
>>>>                   throws ResourceStreamNotFoundException {
>>>>                 FileAttachment fileAttachmentWithBytes =
>>>> DatabaseServices
>>>>                     .getById(fileAttachment);
>>>>                 return byteStream = new ByteArrayInputStream(
>>>>                     fileAttachmentWithBytes.getBytes());
>>>>               }
>>>>
>>>>             };
>>>>
>>>>             getRequestCycle().setRequestTarget(
>>>>                 new ResourceStreamRequestTarget(resourceStream,
>>>>                     fileAttachment.getName()));
>>>>           }
>>>>
>>>>
>>>>
>>>> **
>>>> Martin
>>>>
>>>>
>>>> 2008/5/30 Rodolfo Hansen <rh...@kindleit.net>:
>>>>> there is a DynamicWebResource (String filename) constructor you can use
>>>>> to
>>>>> specify the filename you want for the resource...
>>>>>
>>>>> On Thu, May 29, 2008 at 4:27 PM, Martin Makundi <
>>>>> martin.makundi@koodaripalvelut.com> wrote:
>>>>>
>>>>>> It is an IE "bug" or "feature" that it disregards the content type
>>>>>> after opening up the download (file save/open) dialog -> It uses
>>>>>> windows file extension detection after that ;) On Firefox the content
>>>>>> type suffices, but for IE I must hack the filename too.
>>>>>>
>>>>>> **
>>>>>> Martin
>>>>>>
>>>>>> 2008/5/29 Rodolfo Hansen <rh...@kindleit.net>:
>>>>>> > I think maybe what you want is to use a DynamicWebResource
>>>>>> > and customize the ResourceState to return the correct content
>>>>>> type...
>>>>>> >
>>>>>> > It makes more sense that a .doc link be of that type I think...
>>>>>> >
>>>>>> > On Thu, May 29, 2008 at 10:18 AM, Martijn Lindhout <
>>>>>> mlindhout@jointeffort.nl>
>>>>>> > wrote:
>>>>>> >
>>>>>> >> setting the HTTP Content-Disposition may help. The value should be
>>>>>> >> something
>>>>>> >> like
>>>>>> >>
>>>>>> >> attachment; filename=DummyFilename.doc
>>>>>> >>
>>>>>> >> 2008/5/26 Martin Makundi <ma...@koodaripalvelut.com>:
>>>>>> >>
>>>>>> >> > Hi!
>>>>>> >> >
>>>>>> >> > I have a web page whose content the user is supposed to save as a
>>>>>> >> > XYZ.doc file. With Firefox it is sufficient to set the
>>>>>> content-type
>>>>>> to
>>>>>> >> > application/msword.
>>>>>> >> >
>>>>>> >> > However, Internet Explorer takes my context path (the part before
>>>>>> the
>>>>>> >> > url parameters) as the filename, say "webapp" and forgets about
>>>>>> the
>>>>>> >> > content type already. Is there a simple way to mount my dnyamic
>>>>>> page
>>>>>> >> > as "DummyFilename.doc"?
>>>>>> >> >
>>>>>> >> > I would rather not use BookmarkablePage because the parameters
>>>>>> are
>>>>>> >> > huge. Ofcourse I could pass the parameters via an internal model,
>>>>>> but
>>>>>> >> > if there is a fast moujnting strategy for a dynamic page, I would
>>>>>> be
>>>>>> >> > interested.
>>>>>> >> >
>>>>>> >> > **
>>>>>> >> > Martin
>>>>>> >> >
>>>>>> >> >
>>>>>> ---------------------------------------------------------------------
>>>>>> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> >> > For additional commands, e-mail: users-help@wicket.apache.org
>>>>>> >> >
>>>>>> >> >
>>>>>> >>
>>>>>> >>
>>>>>> >> --
>>>>>> >> Martijn Lindhout
>>>>>> >> JointEffort IT Services
>>>>>> >> http://www.jointeffort.nl
>>>>>> >> mlindhout@jointeffort.nl
>>>>>> >> +31 (0)6 18 47 25 29
>>>>>> >>
>>>>>> >
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Mounting-dynamic-content-tp17473889p19096332.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Mounting-dynamic-content-tp17473889p19096559.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Mounting dynamic content

Posted by mfs <fa...@gmail.com>.
Can you be elaborate more, a sample would be really helpful, just to let u
know i am using a DynamicWebResource since i am generating the pdf on the
fly..

Thanks in advance..


Martin Makundi wrote:
> 
> Yes, I solved it. I open the file as a bookmarkable page which is
> mounted as "/MyPage.doc" or "/MyPage.pdf".
> 
> **
> Martin
> 
> 
> 2008/8/21 mfs <fa...@gmail.com>:
>>
>> Hi Martin did you come out with a solution for mounting a
>> DynamicWebResource,
>> actually my problem is slightly different where i am showing my pdf
>> inline
>> in the browser. Now when the user clicks "Save AS" (either through
>> Browser's
>> File-> SaveAs or clicking on the save button on the pdf-toolbar") it
>> shows
>> the name as you mentioned in your post, where i want it shown the custom
>> pdf
>> name which i specify.
>>
>> Any suggestions would be appreciated..
>>
>>
>>
>> Martin Makundi wrote:
>>>
>>> This is already performed automatically by ResourceStreamRequestTarget
>>> but IE disregards the header after opening the download-dialog:
>>>
>>>               // and content disposition if any
>>>               String file = getFileName();
>>>               if (file != null && (response instanceof WebResponse))
>>>               {
>>>                       ((WebResponse)response).setAttachmentHeader(file);
>>>               }
>>>
>>> My code:
>>>
>>>           public void onClick() {
>>>             IResourceStream resourceStream = new
>>> AbstractResourceStream()
>>> {
>>>               private ByteArrayInputStream byteStream;
>>>
>>>               public synchronized void close() throws IOException {
>>>                 if (byteStream != null) {
>>>                   byteStream.close();
>>>                   byteStream = null;
>>>                 }
>>>               }
>>>
>>>               public synchronized InputStream getInputStream()
>>>                   throws ResourceStreamNotFoundException {
>>>                 FileAttachment fileAttachmentWithBytes =
>>> DatabaseServices
>>>                     .getById(fileAttachment);
>>>                 return byteStream = new ByteArrayInputStream(
>>>                     fileAttachmentWithBytes.getBytes());
>>>               }
>>>
>>>             };
>>>
>>>             getRequestCycle().setRequestTarget(
>>>                 new ResourceStreamRequestTarget(resourceStream,
>>>                     fileAttachment.getName()));
>>>           }
>>>
>>>
>>>
>>> **
>>> Martin
>>>
>>>
>>> 2008/5/30 Rodolfo Hansen <rh...@kindleit.net>:
>>>> there is a DynamicWebResource (String filename) constructor you can use
>>>> to
>>>> specify the filename you want for the resource...
>>>>
>>>> On Thu, May 29, 2008 at 4:27 PM, Martin Makundi <
>>>> martin.makundi@koodaripalvelut.com> wrote:
>>>>
>>>>> It is an IE "bug" or "feature" that it disregards the content type
>>>>> after opening up the download (file save/open) dialog -> It uses
>>>>> windows file extension detection after that ;) On Firefox the content
>>>>> type suffices, but for IE I must hack the filename too.
>>>>>
>>>>> **
>>>>> Martin
>>>>>
>>>>> 2008/5/29 Rodolfo Hansen <rh...@kindleit.net>:
>>>>> > I think maybe what you want is to use a DynamicWebResource
>>>>> > and customize the ResourceState to return the correct content
>>>>> type...
>>>>> >
>>>>> > It makes more sense that a .doc link be of that type I think...
>>>>> >
>>>>> > On Thu, May 29, 2008 at 10:18 AM, Martijn Lindhout <
>>>>> mlindhout@jointeffort.nl>
>>>>> > wrote:
>>>>> >
>>>>> >> setting the HTTP Content-Disposition may help. The value should be
>>>>> >> something
>>>>> >> like
>>>>> >>
>>>>> >> attachment; filename=DummyFilename.doc
>>>>> >>
>>>>> >> 2008/5/26 Martin Makundi <ma...@koodaripalvelut.com>:
>>>>> >>
>>>>> >> > Hi!
>>>>> >> >
>>>>> >> > I have a web page whose content the user is supposed to save as a
>>>>> >> > XYZ.doc file. With Firefox it is sufficient to set the
>>>>> content-type
>>>>> to
>>>>> >> > application/msword.
>>>>> >> >
>>>>> >> > However, Internet Explorer takes my context path (the part before
>>>>> the
>>>>> >> > url parameters) as the filename, say "webapp" and forgets about
>>>>> the
>>>>> >> > content type already. Is there a simple way to mount my dnyamic
>>>>> page
>>>>> >> > as "DummyFilename.doc"?
>>>>> >> >
>>>>> >> > I would rather not use BookmarkablePage because the parameters
>>>>> are
>>>>> >> > huge. Ofcourse I could pass the parameters via an internal model,
>>>>> but
>>>>> >> > if there is a fast moujnting strategy for a dynamic page, I would
>>>>> be
>>>>> >> > interested.
>>>>> >> >
>>>>> >> > **
>>>>> >> > Martin
>>>>> >> >
>>>>> >> >
>>>>> ---------------------------------------------------------------------
>>>>> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> >> > For additional commands, e-mail: users-help@wicket.apache.org
>>>>> >> >
>>>>> >> >
>>>>> >>
>>>>> >>
>>>>> >> --
>>>>> >> Martijn Lindhout
>>>>> >> JointEffort IT Services
>>>>> >> http://www.jointeffort.nl
>>>>> >> mlindhout@jointeffort.nl
>>>>> >> +31 (0)6 18 47 25 29
>>>>> >>
>>>>> >
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Mounting-dynamic-content-tp17473889p19096332.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Mounting-dynamic-content-tp17473889p19096559.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Mounting dynamic content

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Yes, I solved it. I open the file as a bookmarkable page which is
mounted as "/MyPage.doc" or "/MyPage.pdf".

**
Martin


2008/8/21 mfs <fa...@gmail.com>:
>
> Hi Martin did you come out with a solution for mounting a DynamicWebResource,
> actually my problem is slightly different where i am showing my pdf inline
> in the browser. Now when the user clicks "Save AS" (either through Browser's
> File-> SaveAs or clicking on the save button on the pdf-toolbar") it shows
> the name as you mentioned in your post, where i want it shown the custom pdf
> name which i specify.
>
> Any suggestions would be appreciated..
>
>
>
> Martin Makundi wrote:
>>
>> This is already performed automatically by ResourceStreamRequestTarget
>> but IE disregards the header after opening the download-dialog:
>>
>>               // and content disposition if any
>>               String file = getFileName();
>>               if (file != null && (response instanceof WebResponse))
>>               {
>>                       ((WebResponse)response).setAttachmentHeader(file);
>>               }
>>
>> My code:
>>
>>           public void onClick() {
>>             IResourceStream resourceStream = new AbstractResourceStream()
>> {
>>               private ByteArrayInputStream byteStream;
>>
>>               public synchronized void close() throws IOException {
>>                 if (byteStream != null) {
>>                   byteStream.close();
>>                   byteStream = null;
>>                 }
>>               }
>>
>>               public synchronized InputStream getInputStream()
>>                   throws ResourceStreamNotFoundException {
>>                 FileAttachment fileAttachmentWithBytes = DatabaseServices
>>                     .getById(fileAttachment);
>>                 return byteStream = new ByteArrayInputStream(
>>                     fileAttachmentWithBytes.getBytes());
>>               }
>>
>>             };
>>
>>             getRequestCycle().setRequestTarget(
>>                 new ResourceStreamRequestTarget(resourceStream,
>>                     fileAttachment.getName()));
>>           }
>>
>>
>>
>> **
>> Martin
>>
>>
>> 2008/5/30 Rodolfo Hansen <rh...@kindleit.net>:
>>> there is a DynamicWebResource (String filename) constructor you can use
>>> to
>>> specify the filename you want for the resource...
>>>
>>> On Thu, May 29, 2008 at 4:27 PM, Martin Makundi <
>>> martin.makundi@koodaripalvelut.com> wrote:
>>>
>>>> It is an IE "bug" or "feature" that it disregards the content type
>>>> after opening up the download (file save/open) dialog -> It uses
>>>> windows file extension detection after that ;) On Firefox the content
>>>> type suffices, but for IE I must hack the filename too.
>>>>
>>>> **
>>>> Martin
>>>>
>>>> 2008/5/29 Rodolfo Hansen <rh...@kindleit.net>:
>>>> > I think maybe what you want is to use a DynamicWebResource
>>>> > and customize the ResourceState to return the correct content type...
>>>> >
>>>> > It makes more sense that a .doc link be of that type I think...
>>>> >
>>>> > On Thu, May 29, 2008 at 10:18 AM, Martijn Lindhout <
>>>> mlindhout@jointeffort.nl>
>>>> > wrote:
>>>> >
>>>> >> setting the HTTP Content-Disposition may help. The value should be
>>>> >> something
>>>> >> like
>>>> >>
>>>> >> attachment; filename=DummyFilename.doc
>>>> >>
>>>> >> 2008/5/26 Martin Makundi <ma...@koodaripalvelut.com>:
>>>> >>
>>>> >> > Hi!
>>>> >> >
>>>> >> > I have a web page whose content the user is supposed to save as a
>>>> >> > XYZ.doc file. With Firefox it is sufficient to set the content-type
>>>> to
>>>> >> > application/msword.
>>>> >> >
>>>> >> > However, Internet Explorer takes my context path (the part before
>>>> the
>>>> >> > url parameters) as the filename, say "webapp" and forgets about the
>>>> >> > content type already. Is there a simple way to mount my dnyamic
>>>> page
>>>> >> > as "DummyFilename.doc"?
>>>> >> >
>>>> >> > I would rather not use BookmarkablePage because the parameters are
>>>> >> > huge. Ofcourse I could pass the parameters via an internal model,
>>>> but
>>>> >> > if there is a fast moujnting strategy for a dynamic page, I would
>>>> be
>>>> >> > interested.
>>>> >> >
>>>> >> > **
>>>> >> > Martin
>>>> >> >
>>>> >> >
>>>> ---------------------------------------------------------------------
>>>> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> >> > For additional commands, e-mail: users-help@wicket.apache.org
>>>> >> >
>>>> >> >
>>>> >>
>>>> >>
>>>> >> --
>>>> >> Martijn Lindhout
>>>> >> JointEffort IT Services
>>>> >> http://www.jointeffort.nl
>>>> >> mlindhout@jointeffort.nl
>>>> >> +31 (0)6 18 47 25 29
>>>> >>
>>>> >
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Mounting-dynamic-content-tp17473889p19096332.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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