Sven,

1. Setting suggestFilename will also set the Content-Disposition hader
to 'attachment', which will cause the browser to ask you to save the
file. You don't set the mime-type of your WFileResource - it is
advised to set it to the correct type
2. You call suggestFilename too late. Can you call it in the
WFileResource constructor? If not, we must modify
WResource.C::handle()

Could you explain what you mean by your third remark? I don't see how
a file resource can send a file to the client withoug invoking
handleRequest()...

Best regards,
Wim.

2010/9/24 Knoblich Sven <[email protected]>:
> Hello,
> the mechanism runs. But i have still several questions/problems:
> -exists a possibility to force a download by using Wanchor (especially for 
> text based files)
> -when i click on the link, the filename (of the created file by using 
> WFileResource::handleRequest) of the downloaded file switchs randomly between 
> the-real name and the domain-name
> -Only with IE the method WFileResource::handleRequest will not be called. 
> Other browsers like Opera/Firefox/Chrome call the method.
>
>
> Thanks in advance,
> Sven
> --------------------------------------------------------------------
> Here is a summary of my code:
>
> //main
> WAnchor* const pcLink = new WAnchor( this);
> pcLink->setResource( new MyResource( this));
> pcLink->setTarget( TargetNewWindow);
>
> //resource class
> class MyResource : public WFileResource
> {
> public:
>  MyResource( WObject* const pcParent)
>  :
>    WFileResource( "*", string(), pcParent)
>  {
>  }
>
>  void handleRequest( const Http::Request& request,
>                      Http::Response& response)
>  {
>    if( !request.continuation())
>    {
>        MyFile cFile;
>        //generate file
>        const string strFileName = cFile.getName();
>      setFileName( strFileName);
>      suggestFileName( strFileName);
>    }
>
>    WFileResource::handleRequest( request, response);
>  }
> };
> --------------------------------------------------------------------
>
>
>
>
>
>
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Knoblich Sven
> Gesendet: Freitag, 17. September 2010 10:29
> An: [email protected]
> Betreff: Re: [Wt-interest] Emitting a clicked signal from a WAnchor?
>
> Thanks a lot, this is exactly what i need!!! :-)
>
> -----Ursprüngliche Nachricht-----
> Von: Koen Deforche [mailto:[email protected]]
> Gesendet: Donnerstag, 16. September 2010 12:31
> An: [email protected]
> Betreff: Re: [Wt-interest] Emitting a clicked signal from a WAnchor?
>
> Hey Sven,
>
> 2010/9/16 Wim Dumon <[email protected]>:
>> As your method is called 'OnButtonClicked()', I guess that you want to
>> start a file download in response to a click on a button. The easiest
>> thing to do is either to replace the button with an WAnchor, or to put
>> the button inside an anchor if you want to keep the visual appearance
>> of the button. Bur if you want to defer the creation of your file (if
>> it is dynamically created) to the moment that the user clicks the
>> button, it becomes more complicated again: you'll need to specialize
>> WResource and create the file in WResource::handleRequest() (when
>> 'continuation' is false).
>
> That should probably read specialize WFileResource and
> WFileResource::handleRequest():
>
> MyFileResource::handleRequest(const Http::Request &request, Http::Response 
> &response) {
>  if (!request.continuation()) {
>    // Generate file ...
>    setFileName(...)
>    setMimeType(...)
>  }
>
>  WFileResource::handleRequest(request, response); }
>
> Regards,
> koen
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances and start using 
> them to simplify application deployment and accelerate your shift to cloud 
> computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances and start using 
> them to simplify application deployment and accelerate your shift to cloud 
> computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America contest
> Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> http://p.sf.net/sfu/nokia-dev2dev
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to