Re: [Wicket-user] nice url for DownloadLink

2007-06-13 Thread Jan Van Besien
Jean-Baptiste Quenot wrote:
 The concepts described in the static pages examples are the same
 in 1.2.6.  You would just have to copy
 URIRequestTargetUrlCodingStrategy in your project, it is
 compatible with 1.2.6.

Ok, that's what I did.

In the WebPage class I have something like (StaticLink as in the example)

StaticLink fileLink = new StaticLink(fileLink, new Model(reports/ + 
file.getAbsolutePath()));

In the WebApplication class I do

mount(/reports, new URIRequestTargetUrlCodingStrategy(/reports) {
 public IRequestTarget decode(RequestParameters requestParameters) {
 String path = getURI(requestParameters);
 FileResourceStream fileStream = new FileResourceStream(new 
File(path));
 return new ResourceStreamRequestTarget(fileStream);
 }
});

Note that I use a FileResourceStream because my files are not in the 
webapp. Now when I try to browse to a certain file, I get this in a 
JBoss server

08:09:44,384 ERROR [[rtApplication]] Servlet.service() for servlet 
rtApplication threw exception
java.lang.IllegalStateException: getOutputStream() has already been 
called for this response
 at 
org.apache.catalina.connector.Response.getWriter(Response.java:596)
 at 
org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:186)
 at wicket.protocol.http.WebResponse.write(WebResponse.java:315)
 at 
wicket.protocol.http.BufferedWebResponse.close(BufferedWebResponse.java:75)
 at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:229)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
 at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
 at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at 
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
 at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
 at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
 at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
 at 
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
 at 
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
 at 
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
 at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
 at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
 at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
 at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
 at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
 at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
 at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
 at 
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
 at java.lang.Thread.run(Thread.java:595)

Strange thing: if I replace the 'new File(path)' with 'new 
File(/tmp/test.txt)' it actually works (returning test.txt for every 
link ofcourse).

Any ideas?

thnx
Jan

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] nice url for DownloadLink

2007-06-13 Thread Jan Van Besien
Johan Compagner wrote:
 somehow there is also txt/strings written to the output, can you set a
 breakt point in the br.close() method and see what it wants to write?

Indeed! It wanted to write a html page displaying a RuntimeException 
(file not found). Now I got it working.

thnx
Jan

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] nice url for DownloadLink

2007-06-12 Thread Jan Van Besien
Hi all

I have a page with a list of DownloadLinks that allow the user to 
download a bunch of text (csv) files. This works, but clients want to 
access these files with a script, without having to click trough the 
gui. This also works, but the url's that point to the files are somewhat 
cryptic ofcourse.

I know of the feature to mount bookmarkable pages etc to give them nicer 
url's, and now I'm looking for a solution to do something similar for 
DownloadLinks.

Currently on my page the files (e.g. report1.csv, report2.csv, ...) have 
url's like

http://somehost/mycontextroot/?wicket:interface=:1:reports:0:fileLink::ILinkListener
http://somehost/mycontextroot/?wicket:interface=:1:reports:1:fileLink::ILinkListener

I would like this to be something like

http://somehost/mycontextroot/reports/report1.csv
http://somehost/mycontextroot/reports/report2.csv

Thanks in advance
Jan

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] nice url for DownloadLink

2007-06-12 Thread Jan Van Besien
Jean-Baptiste Quenot wrote:
 * Jan Van Besien:
 If I were you I would look at the static pages examples:
 
 http://wicketstuff.org/wicket13/staticpages/

Looks promising indeed, but unfortunattely seems to be wicket 1.3 
features. I'm using latest stable 1.2.6, and will need to verify if 1.3 
is an option (not in public maven repository?).

Will also have a look at the shared resources suggestion...

thnx
Jan

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user