Done: https://issues.apache.org/jira/browse/WICKET-3869

A

On Mon, Jul 4, 2011 at 7:46 PM, Martin Grigorov <mgrigo...@apache.org> wrote:
> See how http://wicketstuff.org/wicket/images/ creates the images.
> If you can create a quickstart application that shows the problem then
> attach it to a ticket.
>
> On Mon, Jul 4, 2011 at 6:42 PM, Anders Smestad <anders.smes...@gmail.com> 
> wrote:
>> Hi. I have a simple (test) page with an ajax link that displays a
>> modal window when clicked.
>>
>> The modal window contains some text and an image-link. The image is
>> added to a link as
>>
>> link.add(new Image("image", sharedResourceReference);
>>
>> When displaying the modal window, everything displays correctly, but
>> firstly, there is a warning in the log that says:
>>
>> WARN  - ResourceReferenceRegistry  - Resource reference not added to
>> registry. reference.canBeRegistered() == false
>>
>> Then, not every time, but often, the stacktrace included at the bottom
>> of this message appears in the log when using Internet Explorer. Using
>> the network inspector tool (F12) in internet explorer shows that the
>> image is first requested once, then the request is aborted (result:
>> "(Aborted)"), then the same image is requested another time, this time
>> it receives a 200 and the image is downloaded.
>>
>> None of these problems materialize when using other browsers than
>> internet explorer.
>>
>> The image is a symbol for a link, and is a static image that will not
>> change between redeployments of the application.
>>
>> What is the proper way to use such images. I have tried different approaches,
>> * Using the <wicket:link> in markup
>> * Using PackageResourceReference from java code
>> * Using SharedResourceReference as described above
>> * Registring the Image to the
>> Application.get().getSharedResources().add("name", ...); and
>> dereferencing it using new SharedResourceReference("name"), then
>> adding it to the link.
>>
>> It seems that either the image link gets rendered with the
>> -ts000000.ext (timestamp) extension, or the ?wicket:antiCache is
>> appended, both seems unnecessary since it is a static image which
>> could very well be cached on the browser.
>>
>> The SharedResourceReference seems like it would be the right class to
>> use, but when adding the image to the page, the .canBeRegistered() ==
>> false is displayed.
>>
>> So finally, this is the question: What is the correct way to include
>> static images, css and javascript resources in wicket, it seems there
>> are multiple ways to do this, but none seems to do what I want. I also
>> the resources to be contained with the component it is used with.
>>
>> Thanks in advance!
>>
>> A
>>
>> Stacktrace from log when using Internet Explorer.
>>
>> ERROR - DefaultExceptionMapper     - Connection lost, give up responding.
>> org.apache.wicket.protocol.http.servlet.ResponseIOException:
>> org.mortbay.jetty.EofException
>>        at 
>> org.apache.wicket.protocol.http.servlet.ServletWebResponse.write(ServletWebResponse.java:120)
>>        at 
>> org.apache.wicket.protocol.http.HeaderBufferingWebResponse.write(HeaderBufferingWebResponse.java:168)
>>        at 
>> org.apache.wicket.request.resource.PackageResource$1.writeData(PackageResource.java:239)
>>        at 
>> org.apache.wicket.request.resource.AbstractResource.respond(AbstractResource.java:448)
>>        at 
>> org.apache.wicket.request.handler.resource.ResourceRequestHandler.respond(ResourceRequestHandler.java:77)
>>        at 
>> org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler.respond(ResourceReferenceRequestHandler.java:92)
>>        at 
>> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:717)
>>        at 
>> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
>>        at 
>> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
>>        at 
>> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253)
>>        at 
>> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:160)
>>        at 
>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:216)
>>        at 
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1112)
>>        at 
>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
>>        at 
>> org.mortbay.jetty.security.ConstraintsSecurityHandler.handle(ConstraintsSecurityHandler.java:220)
>>        at 
>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>>        at 
>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:822)
>>        at 
>> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:305)
>>        at 
>> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:229)
>>        at 
>> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:113)
>>        at 
>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>>        at org.mortbay.jetty.Server.handle(Server.java:324)
>>        at 
>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:550)
>>        at 
>> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:876)
>>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:535)
>>        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
>>        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:407)
>>        at 
>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:421)
>>        at 
>> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
>> Caused by: org.mortbay.jetty.EofException
>>        at org.mortbay.jetty.HttpGenerator.flush(HttpGenerator.java:787)
>>        at 
>> org.mortbay.jetty.AbstractGenerator$Output.flush(AbstractGenerator.java:567)
>>        at 
>> org.mortbay.jetty.HttpConnection$Output.flush(HttpConnection.java:958)
>>        at 
>> org.mortbay.jetty.AbstractGenerator$Output.write(AbstractGenerator.java:647)
>>        at 
>> org.mortbay.jetty.AbstractGenerator$Output.write(AbstractGenerator.java:588)
>>        at 
>> org.apache.wicket.protocol.http.servlet.ServletWebResponse.write(ServletWebResponse.java:116)
>>        ... 28 more
>> Caused by: java.io.IOException: An established connection was aborted
>> by the software in your host machine
>>        at sun.nio.ch.SocketDispatcher.write0(Native Method)
>>        at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:33)
>>        at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:72)
>>        at sun.nio.ch.IOUtil.write(IOUtil.java:28)
>>        at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)
>>        at org.mortbay.io.nio.ChannelEndPoint.flush(ChannelEndPoint.java:169)
>>        at 
>> org.mortbay.io.nio.SelectChannelEndPoint.flush(SelectChannelEndPoint.java:212)
>>        at org.mortbay.jetty.HttpGenerator.flush(HttpGenerator.java:721)
>>        ... 33 more
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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

Reply via email to