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


Re: [Wicket-user] nice url for DownloadLink

2007-06-13 Thread Johan Compagner
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?

On 6/13/07, Jan Van Besien <[EMAIL PROTECTED]> wrote:
> 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
>

-
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 Jean-Baptiste Quenot
* 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).

If this is Wicket 1.2.6, yes I can understand this issue, and it's
fixed in 1.3.  It was a bug in BufferedWebResponse, not buffering
enough.

Back to your problem: does it work on Tomcat or Jetty?

Note that for security reasons you shouldn't mention the absolute
path in the URL.  I advise to prepend the root path in the code.
Also be careful of the double slash!  By reading your code, the
request translates to:

reports//path/to/file
-- 
 Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

-
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:
> 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-12 Thread Maurice Marrink
wicket 1.3 is available if you include the following in your
repositories tag of maven 2 pom.xml


wicket-snaps
http://wicketstuff.org/maven/repository

true


false



Maurice

On 6/12/07, Jean-Baptiste Quenot <[EMAIL PROTECTED]> wrote:
> * Jan Van Besien:
>
> > Jean-Baptiste Quenot wrote:
> >
> > > 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?).
>
> 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.
> --
>  Jean-Baptiste Quenot
> aka  John Banana   Qwerty
> http://caraldi.com/jbq/
>
> -
> 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
>

-
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 Jean-Baptiste Quenot
* Jan Van Besien:

> Jean-Baptiste Quenot wrote:
>
> > 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?).

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.
-- 
 Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

-
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


Re: [Wicket-user] nice url for DownloadLink

2007-06-12 Thread Jean-Baptiste Quenot
* Jan Van Besien:
> 
> 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

Hello Jan,

If I were you I would look at the static pages examples:

http://wicketstuff.org/wicket13/staticpages/

If you have trouble using it, please follow-up, I'll be glad to
help.
-- 
 Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

-
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 Igor Vaynberg

you need to create a shared resource that lets you stream those files and
mount that. then create a link component that generates href with
urlfor(resourcereference)+"/report1.csv"; or something like that.

-igor


On 6/11/07, Jan Van Besien <[EMAIL PROTECTED]> wrote:


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

-
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-11 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