Response already commited - Wicket or server?

2016-01-05 Thread niestroj
Hi,
i have a problem on one client. The problem is weird. I'm getting an
exception like the below *java.lang.IllegalStateException: UT010019:
Response already commited* when downloading an Excel file generated by a
model in a DownloadLink. But not all Excel files trigger this Exception.
Only those which take longer to generate. Small and fast generated Excel
files download normally. What's even more strange is that the exception is
thrown when i access the app through the external domain like
http://company.com/wapp but all Excel files are generated correctly when i'm
throuh RDP on the server and access the app through http://localhost/wapp. 

It's Wicket 6.18 and WildFly 8.2.0.Final. Where to look for solutions or how
to solve this? Is it an Wicket issue or do i have to look on the server
side?


java.lang.IllegalStateException: UT010019: Response already commited
at
io.undertow.servlet.spec.HttpServletResponseImpl.sendRedirect(HttpServletResponseImpl.java:173)
at
org.apache.wicket.protocol.http.servlet.ServletWebResponse.sendRedirect(ServletWebResponse.java:297)
at
org.apache.wicket.protocol.http.HeaderBufferingWebResponse.sendRedirect(HeaderBufferingWebResponse.java:117)
at
org.apache.wicket.request.handler.render.WebPageRenderer.redirectTo(WebPageRenderer.java:176)
at
org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:327)
at
org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:310)
at
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
at
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
at
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
at
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
at
org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
at
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:233)
at
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
at
org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
at
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
at 
io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
at
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
at
io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)
at
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
at
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at
org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at
io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at
io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56)
at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
at
io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63)
at
io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
at
io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
at
io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at
org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at

Re: Response already commited - Wicket or server?

2016-01-05 Thread Martin Grigorov
Hi,

This exception means that before the redirect there was a
ServletWebResponse#write(byte[])
or ServletWebResponse#write(CharSequence) to the servlet response.
Either put breakpoints in these methods or override them to add some
logging to see what happens.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Jan 5, 2016 at 8:47 AM, niestroj  wrote:

> Hi,
> i have a problem on one client. The problem is weird. I'm getting an
> exception like the below *java.lang.IllegalStateException: UT010019:
> Response already commited* when downloading an Excel file generated by a
> model in a DownloadLink. But not all Excel files trigger this Exception.
> Only those which take longer to generate. Small and fast generated Excel
> files download normally. What's even more strange is that the exception is
> thrown when i access the app through the external domain like
> http://company.com/wapp but all Excel files are generated correctly when
> i'm
> throuh RDP on the server and access the app through http://localhost/wapp.
>
> It's Wicket 6.18 and WildFly 8.2.0.Final. Where to look for solutions or
> how
> to solve this? Is it an Wicket issue or do i have to look on the server
> side?
>
>
> java.lang.IllegalStateException: UT010019: Response already commited
> at
>
> io.undertow.servlet.spec.HttpServletResponseImpl.sendRedirect(HttpServletResponseImpl.java:173)
> at
>
> org.apache.wicket.protocol.http.servlet.ServletWebResponse.sendRedirect(ServletWebResponse.java:297)
> at
>
> org.apache.wicket.protocol.http.HeaderBufferingWebResponse.sendRedirect(HeaderBufferingWebResponse.java:117)
> at
>
> org.apache.wicket.request.handler.render.WebPageRenderer.redirectTo(WebPageRenderer.java:176)
> at
>
> org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:327)
> at
>
> org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
> at
>
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
> at
>
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> at
>
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:310)
> at
>
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
> at
>
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
> at
>
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
> at
>
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
> at
>
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:319)
> at
>
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:233)
> at
>
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
> at
>
> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
> at
>
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
> at
>
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
> at
> io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
> at
>
> io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
> at
>
> io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)
> at
>
> io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
> at
>
> io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
> at
>
> org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
> at
>
> io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
> at
>
> io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
> at
>
> io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56)
> at
>
> io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
> at
>
> io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
> at
>
> io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63)
> at
>
> 

Re: Input Stream DownloadLink

2016-01-05 Thread Štefan Šimík
Hi Martin,
I found it very useful and really appreciate you contribution.
I think it is definitely worth of effort, if something very similar does
not already exist in wicket distribution.
In that case, it would be great source of inspiration for new pull-request
into wicket.

Simple, short and clean description. I like that :)
Good work Martin

On Wed, Jan 6, 2016 at 12:16 AM, Martin Spielmann <
martin.spielm...@pingunaut.com> wrote:

> Hello all,
>
> I just published a small version of a download link which enables you to
> serve
> any data coming from an InputStream for download.
>
> https://github.com/pingunaut/wicket-stream-download-example
>
> I used that one in multiple projects now, so I thought it could be
> interesting
> for other people too.
> Just wanted to hear, if there any need for this one out there before
> spending
> more effort for docs and error handling.
>
> Happy new year!
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Input Stream DownloadLink

2016-01-05 Thread Martin Grigorov
Hi,

Thanks for sharing your component with us!

In the "about" section you use LoadableDetachableModel that returns
InputStream. For single use this would work fine, but if you try to use
this model second time in the same request then it may fail depending on
the type of the InputStream because you may need to reset it. I cannot
imagine now a use case where you will need to use it second time in the
same request but I also see no reason to use LDM. Using
AbstractReadOnlyModel looks better to me.

Apart from that I think you can use "new ResourceLink(String, IResource)"
for the same kind of tasks. E.g. with ByteArrayResource that either accepts
its byte[] as constructor parameter or loads it dynamically by overriding
#getData().

Happy New Year!

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Jan 6, 2016 at 12:16 AM, Martin Spielmann <
martin.spielm...@pingunaut.com> wrote:

> Hello all,
>
> I just published a small version of a download link which enables you to
> serve
> any data coming from an InputStream for download.
>
> https://github.com/pingunaut/wicket-stream-download-example
>
> I used that one in multiple projects now, so I thought it could be
> interesting
> for other people too.
> Just wanted to hear, if there any need for this one out there before
> spending
> more effort for docs and error handling.
>
> Happy new year!
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Input Stream DownloadLink

2016-01-05 Thread Martin Spielmann
Hello all,

I just published a small version of a download link which enables you to serve 
any data coming from an InputStream for download.

https://github.com/pingunaut/wicket-stream-download-example

I used that one in multiple projects now, so I thought it could be interesting 
for other people too. 
Just wanted to hear, if there any need for this one out there before spending 
more effort for docs and error handling.

Happy new year!


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