make sure your servlet mapping ends in /* like /app/*

-igor


On 12/13/06, Nino Wael <[EMAIL PROTECTED]> wrote:

 Nope its not hit.. I've been wonder if it would be better if I used an
bytearrayRessource than just a plain webressource?





So taking that in regard it looks like this, but its still not working:



                                            HttpServletRequest req =
((WebRequest) getRequest())


.getHttpServletRequest();



                                            String path = req.getSession
(false).getServletContext().getRealPath(


"/report");

                                            path += "\\" +
uiResult.getUrlWord().replaceAll("report/", "");



                                            final File myFile = new
File(path);

                                             byte[] myByte = null;

                                             try {

                                             InputStream myStream = new
FileInputStream(myFile);

                                             myStream.read(myByte);

                                             }catch(Exception e){}



                                            ByteArrayResource export = new
ByteArrayResource("nase",myByte);

                                            export.setCacheable(false);



                                            form.add(new
ResourceLink("word", export));





Regards Nino


 ------------------------------

*From:* [EMAIL PROTECTED] [mailto:
[EMAIL PROTECTED] *On Behalf Of *Igor Vaynberg
*Sent:* 12. december 2006 17:56
*To:* wicket-user@lists.sourceforge.net
*Subject:* Re: [Wicket-user] Download file/ trying to use webresource
usingwicket 1.2 plain



what is the generated url? if you set a breakpoint in getResourceStream()
is it hit?

-igor

 On 12/12/06, *Nino Wael* <[EMAIL PROTECTED]> wrote:

Hi I've trying to use the this example:






http://cwiki.apache.org/WICKET/best-practices-and-gotchas.html#BestPracticesandGotchas-Startingdownloadafterformsubmission%2528Wicket1.2%2529



WebResource export = new WebResource() {



       @Override

       public IResourceStream getResourceStream() {



         CharSequence discounts = DataBase.getInstance()

             .exportDiscounts();

         return new StringResourceStream(discounts, "text/plain");

       }



       @Override



protected void setHeaders(WebResponse response) {

         super.setHeaders(response);

         response.setAttachmentHeader("discounts.csv");



       }

     };



     export.setCacheable(false);





     new ResourceLink(this, "exportLink", export);







My implementation (I am using wicket 1.2):

                                            String path = req.getSession
(false).getServletContext()

                                            .getRealPath("/report");


path+="\\"+uiResult.getUrlWord().replaceAll("report/","");



                                            final File myFile = new
File(path);

                                            WebResource export = new
WebResource() {



                                                   public IResourceStream
getResourceStream() {



                                                     return new
FileResourceStream(myFile);

                                                   }





                                                   protected void
setHeaders(WebResponse response) {

                                                     super.setHeaders
(response);




response.setAttachmentHeader(uiResult.getUrlWord
().replaceAll("report/",""));

                                                   }

                                                 };

                                                 export.setCacheable
(false);



                                                 form.add( new
ResourceLink("word", export));



This does nothing but a page reload.



Does it only work with wicket 1.2.3, what should I do then? Use the wicket
1.1 example or ?





Regards Nino


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to