Maybe, just maybe, we could look at the accept header, before
rendering the page...

-Matej

On Dec 21, 2007 6:42 AM, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> that is actually in our gotchas wiki page - images with src="" cause a
> request to the page...
>
> -igor
>
>
>
> On Dec 20, 2007 6:54 PM, Tauren Mills <[EMAIL PROTECTED]> wrote:
> > I think this problem is caused by the browser.  Using Firebug, it
> > looks like the browser is actually requesting the page a second time.
> > Both requests go to:
> > http://localhost:8080/db/app/?wicket:interface=:15::::
> >
> > Here are the request headers from the first request:
> >
> > Host: localhost:8080
> > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
> > rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
> > Accept: 
> > text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
> > Accept-Language: en-us,en;q=0.5
> > Accept-Encoding: gzip,deflate
> > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > Keep-Alive: 300
> > Connection: keep-alive
> > Referer: http://localhost:8080/db/app/?wicket:interface=:2::::
> > Cookie: JSESSIONID=1hndka1no7ub6; styleswitcher_style=small
> >
> > The browser then makes a second request:
> >
> > Host: localhost:8080
> > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
> > rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
> > Accept: image/png,*/*;q=0.5
> > Accept-Language: en-us,en;q=0.5
> > Accept-Encoding: gzip,deflate
> > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > Keep-Alive: 300
> > Connection: keep-alive
> > Referer: http://localhost:8080/db/app/?wicket:interface=:3::::
> > Cookie: JSESSIONID=1hndka1no7ub6; styleswitcher_style=small
> > Cache-Control: max-age=0
> >
> > Note that the second request has a different Accept (images only?) and
> > a Cache-Control.
> >
> > This seems to only be happening to me when the image source is empty.
> > Even having any text in there works.  The following wicket output
> > causes the problem:
> > <img wicket:id="image1" src=""/>
> >
> > So it looks like if there is an image on the page without a source
> > (not just a broken image), that Firefox requests the page URL again.
> > And by doing so, causes my DataView to refresh.  But it doesn't
> > refresh the DOM on the 2nd request, only images.  Thus the links are
> > no longer valid.
> >
> > To solve this problem, I just need to make sure that my image src is
> > never an empty string.  Here is a simple hack that I did to my
> > StaticImage class:
> >
> > public class StaticImage extends WebComponent {
> >         private static final long serialVersionUID = 1L;
> >
> >     public StaticImage(String id, IModel model) {
> >         super(id, model);
> >     }
> >
> >     protected void onComponentTag(ComponentTag tag) {
> >         checkComponentTag(tag, "img");
> >         String src = getModelObjectAsString();
> >         tag.put("src", (!src.equals("")?src:"no_image") );
> >     }
> >
> > }
> >
> > With this, img src="no_image" in the markup.  It doesn't render of
> > course, but it also doesn't cause a 2nd page refresh.
> >
> > One last thing.  If I just add <img src=""/> to my page's HTML, it
> > appears that it is rewritten by wicket to be this: <img src="../"/>.
> > So maybe this is a problem that was already discovered and solved.
> > But when I made a custom component that alters the src, I lost that
> > solution.
> >
> > I guess in the end, this isn't a wicket problem.  It isn't really even
> > a problem with my application, although I can solve it in my
> > application.  I don't know enough about why Firefox is doing this, so
> > it might not even be a browser problem.  Who knows...
> >
> > I hope this helps someone else who runs into a similar issue.
> >
> > Tauren
> >
> >
> >
> >
> >
> >
> >
> >
> > On Dec 20, 2007 4:16 PM, Tauren Mills <[EMAIL PROTECTED]> wrote:
> > > Gwyn,
> > >
> > > Thanks for the guidance!  The DataProvider.iterator was being executed
> > > twice.  I put a breakpoint in iterator() and it would pause when the
> > > page first started to load.  Then I'd continue running the code, and
> > > the breakpoint was hit again.  At that time, the full page was
> > > rendered except for some images on the page, and the browser was
> > > paused loading again because of the breakpoint.  When I continued
> > > running the code, the page would finish loading.
> > >
> > > The images that weren't loaded are URLs stored in my DB.  I found that
> > > when I had image URLs in the DB, everything worked fine.  But when I
> > > had NULL entries for the images, then I'd get this exception and the
> > > iterator would run twice.  So when the iterator would run twice, the
> > > component hierarchy would change, causing the link URLs to no longer
> > > be valid.
> > >
> > > I'm still tracking it down to figure out exactly what is going on.
> > > But you got me on the right track.  And now  I'm thinking it is more
> > > of a problem in my application or database than in wicket itself.
> > > Which is what I was hoping was the case anyway! :)
> > >
> > > Tauren
> > >
> > >
> > >
> > > On Dec 20, 2007 7:43 AM, Gwyn Evans <[EMAIL PROTECTED]> wrote:
> > > > No real idea, but I'd be tempted to stick in some diagnostic logging
> > > > to log the calls to the DataProvider & the details of the lists it
> > > > returns, just to check there's nothing odd happening there...
> > > >
> > > > /Gwyn
> > > >
> > > >
> > > > On 20/12/2007, Tauren Mills <[EMAIL PROTECTED]> wrote:
> > > > > Thanks.  I will try to put together a quickstart, but I'm not sure I
> > > > > can duplicate the problem in it.
> > > > >
> > > > > Tauren
> > > > >
> > > > >
> > > > > On Dec 19, 2007 3:23 PM, Matej Knopp <[EMAIL PROTECTED]> wrote:
> > > > > > This is definitely strange. However without posting more code (or
> > > > > > preferably a complete testcase to reproduce) I don't really know how
> > > > > > to help you with it.
> > > > > >
> > > > > > -Matej
> > > > > >
> > > > > >
> > > > > > On Dec 20, 2007 12:05 AM, Tauren Mills <[EMAIL PROTECTED]> wrote:
> > > > > > > Does anyone have any thoughts on this problem?  I realize this it 
> > > > > > > may
> > > > > > > seem unique and isolated, but are there any suggestions even on 
> > > > > > > how to
> > > > > > > figure out what is wrong?  How can I figure out why the component 
> > > > > > > path
> > > > > > > in the URLs for the Links in the DataView are not matching the
> > > > > > > component hierarchy?  These are the URLs output at initial page
> > > > > > > creation time:
> > > > > > >
> > > > > > > http://localhost:8082/db/app/?wicket:interface=:6:reports:reports:1:actions:select::ILinkListener::
> > > > > > > http://localhost:8082/db/app/?wicket:interface=:6:reports:reports:2:actions:select::ILinkListener::
> > > > > > >
> > > > > > > However, at the time that onClick is processed, the component
> > > > > > > hierarchy seems to have changed and now have the value of 3 and 4
> > > > > > > instead of 1 and 2.  The links above don't work, but the following
> > > > > > > links do if I manually enter them:
> > > > > > >
> > > > > > > http://localhost:8082/db/app/?wicket:interface=:6:reports:reports:3:actions:select::ILinkListener::
> > > > > > > http://localhost:8082/db/app/?wicket:interface=:6:reports:reports:4:actions:select::ILinkListener::
> > > > > > >
> > > > > > > Its almost as if a secondary page render has occurred.  But I've 
> > > > > > > added
> > > > > > > logging to my page and don't see any extra log output.
> > > > > > >
> > > > > > > My project is basically done and ready to launch, but this is 
> > > > > > > holding
> > > > > > > it up.  Any ideas or suggestions?
> > > > > > >
> > > > > > > Thanks!
> > > > > > > Tauren
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Dec 18, 2007 11:21 PM, Tauren Mills <[EMAIL PROTECTED]> wrote:
> > > > > > > > I'm having an Exception that is happening before any of my
> > > > > > > > Link.onClick() code is executed, making me wonder if there is a 
> > > > > > > > wicket
> > > > > > > > bug of some sort.
> > > > > > > >
> > > > > > > > I have a DataView with an ActionPanel in each row that contains 
> > > > > > > > a
> > > > > > > > Link. There is no AJAX on this page.  When I load the page with 
> > > > > > > > the
> > > > > > > > DataView for the first time, clicking the Link doesn't work and 
> > > > > > > > I get
> > > > > > > > an Exception (see below).  But if I click the browser back 
> > > > > > > > button,
> > > > > > > > then click the same link, it works.  However, this problem only 
> > > > > > > > occurs
> > > > > > > > for some of the data records, not all of them.  But the same 
> > > > > > > > data
> > > > > > > > records always break.  I thought it was a data problem because 
> > > > > > > > of
> > > > > > > > this, but tracing back into the wicket code seems to indicate
> > > > > > > > otherwise.  Also, I'm running on the latest wicket trunk that I
> > > > > > > > updated to about 15 minutes ago.
> > > > > > > >
> > > > > > > > The URLs that are output for the Links in the dataview when the 
> > > > > > > > page
> > > > > > > > is first loaded is (dataview has only 2 data records):
> > > > > > > >
> > > > > > > > http://localhost:8082/db/app/?wicket:interface=:6:reports:reports:1:actions:select::ILinkListener::
> > > > > > > > http://localhost:8082/db/app/?wicket:interface=:6:reports:reports:2:actions:select::ILinkListener::
> > > > > > > >
> > > > > > > > When I hit the back button, the URLs for that same links are:
> > > > > > > >
> > > > > > > > http://localhost:8082/db/app/?wicket:interface=:6:reports:reports:5:actions:select::ILinkListener::
> > > > > > > > http://localhost:8082/db/app/?wicket:interface=:6:reports:reports:6:actions:select::ILinkListener::
> > > > > > > >
> > > > > > > > The exception that is thrown is this (only when the first links 
> > > > > > > > are
> > > > > > > > clicked, not the links after hitting the back button):
> > > > > > > >
> > > > > > > > WicketMessage: component reports:reports:1:actions:select not 
> > > > > > > > found on
> > > > > > > > page 
> > > > > > > > com.theseniorlist.database.web.page.site.service.ServiceDetailsPage[id
> > > > > > > > = 6], listener interface = [RequestListenerInterface
> > > > > > > > name=ILinkListener, method=public abstract void
> > > > > > > > org.apache.wicket.markup.html.link.ILinkListener.onLinkClicked()]
> > > > > > > >
> > > > > > > > Root cause:
> > > > > > > >
> > > > > > > > org.apache.wicket.WicketRuntimeException: component
> > > > > > > > reports:reports:1:actions:select not found on page
> > > > > > > > com.theseniorlist.database.web.page.site.service.ServiceDetailsPage[id
> > > > > > > > = 6], listener interface = [RequestListenerInterface
> > > > > > > > name=ILinkListener, method=public abstract void
> > > > > > > > org.apache.wicket.markup.html.link.ILinkListener.onLinkClicked()]
> > > > > > > > at 
> > > > > > > > org.apache.wicket.request.AbstractRequestCycleProcessor.resolveListenerInterfaceTarget(AbstractRequestCycleProcessor.java:411)
> > > > > > > > at 
> > > > > > > > org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:456)
> > > > > > > > at 
> > > > > > > > org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:139)
> > > > > > > > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1152)
> > > > > > > > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1245)
> > > > > > > > at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
> > > > > > > > at 
> > > > > > > > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:354)
> > > > > > > > at 
> > > > > > > > org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:121)
> > > > > > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
> > > > > > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > > > > > > > at 
> > > > > > > > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:445)
> > > > > > > > at 
> > > > > > > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1050)
> > > > > > > > at 
> > > > > > > > org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
> > > > > > > > at 
> > > > > > > > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
> > > > > > > > at 
> > > > > > > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1041)
> > > > > > > > at 
> > > > > > > > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:354)
> > > > > > > > at 
> > > > > > > > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:226)
> > > > > > > > at 
> > > > > > > > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:627)
> > > > > > > > at 
> > > > > > > > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141)
> > > > > > > > at org.mortbay.jetty.Server.handle(Server.java:269)
> > > > > > > > at 
> > > > > > > > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:430)
> > > > > > > > at 
> > > > > > > > org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:687)
> > > > > > > > at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:492)
> > > > > > > > at 
> > > > > > > > org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:199)
> > > > > > > > at 
> > > > > > > > org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:339)
> > > > > > > > at 
> > > > > > > > org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:208)
> > > > > > > > at 
> > > > > > > > org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
> > > > > > > >
> > > > > > > > Sure enough, when I trace the wicket code and examine the data 
> > > > > > > > in
> > > > > > > > memory, the first time the dataview page is loaded, the 
> > > > > > > > component path
> > > > > > > > to the actual components are values 3 and 4.  In fact, if after 
> > > > > > > > I load
> > > > > > > > the page for the first time, I manually enter the following 
> > > > > > > > URLs, I
> > > > > > > > get the correct page without an exception:
> > > > > > > >
> > > > > > > > http://localhost:8082/db/app/?wicket:interface=:8:reports:reports:3:actions:select::ILinkListener::
> > > > > > > > http://localhost:8082/db/app/?wicket:interface=:8:reports:reports:4:actions:select::ILinkListener::
> > > > > > > >
> > > > > > > > Why would the URLs that are rendered the first time be wrong?  
> > > > > > > > Is
> > > > > > > > there something in my code that could cause this?
> > > > > > > >
> > > > > > > > Here is a trimmed down version of the code:
> > > > > > > >
> > > > > > > >     public ReportListPanel(String id, final Service service) {
> > > > > > > >         super(id);
> > > > > > > >
> > > > > > > >         this.service = service;
> > > > > > > >
> > > > > > > >         ReportsDataProvider dataProvider = new 
> > > > > > > > ReportsDataProvider(dao);
> > > > > > > >         Report filter = (Report) dataProvider.getFilterState();
> > > > > > > >         filter.setService(service);
> > > > > > > >         dataProvider.setFilterState(filter);
> > > > > > > >
> > > > > > > >                 final DataView reports = new 
> > > > > > > > DataView("reports", dataProvider)
> > > > > > > >                 {
> > > > > > > >                         @Override
> > > > > > > >                         protected void populateItem(final Item 
> > > > > > > > item)
> > > > > > > >                         {
> > > > > > > >                         Report report = (Report) 
> > > > > > > > item.getModelObject();
> > > > > > > >                         item.setModel(new 
> > > > > > > > CompoundPropertyModel(report));
> > > > > > > >                         item.add(new 
> > > > > > > > ActionPanel(actions",item.getModel()));
> > > > > > > >                 };
> > > > > > > >             reports.setItemsPerPage(40);
> > > > > > > >             add(reports);
> > > > > > > >     }
> > > > > > > >
> > > > > > > >     class ActionPanel extends Panel
> > > > > > > >     {
> > > > > > > >         public ActionPanel(String id, IModel model)
> > > > > > > >         {
> > > > > > > >                 super(id, model);
> > > > > > > >                 setModel(model);
> > > > > > > >
> > > > > > > >                 Link link = new Link("select",model) {
> > > > > > > >                         @Override
> > > > > > > >                         public void onClick() {
> > > > > > > >                                         setResponsePage(new
> > > > > > > > ReportDetailsPage(getPage(),(Report)getModelObject(),service));;
> > > > > > > >                         }
> > > > > > > >                 };
> > > > > > > >                 link.add(new Label("summary"));
> > > > > > > >                 add(link);
> > > > > > > >         }
> > > > > > > >     }
> > > > > > > >
> > > > > > > > Any help would be appreciated!
> > > > > > > >
> > > > > > > > Thanks,
> > > > > > > > Tauren
> > > > > > > >
> > > > > > >
> > > > > > > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > > > >
> > > > > > >
> > > > > >
> > > > > > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > > >
> > > > > >
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to