[ 
https://issues.apache.org/jira/browse/WICKET-948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12526175
 ] 

Zsolt Süli commented on WICKET-948:
-----------------------------------

There's no form in these pages. 

I have a page (say HomePage ... like this:
public class HomePage extends WebPage {
        private static final long serialVersionUID = 2429832495146545152L;

        public HomePage() {
                super();
                
                add(new Link("link")
                {
                        public void onClick()
                        {
                                setResponsePage(StatefulPage.class);
                        }
                });
                
        }
}

It calls StatefullPage, which is a statefull page (for example it has a 
PageLink component ... nothing more). When I see StatefullPage, and push a back 
button, HomePage shown, but when I click on the link, it threw this exception.

Everything is OK, if
- I make my HomePage stateless (say replace Link with StatelessLink)
OR
- I make my StatefullPage stateless (by using BookmarkablePageLink instead of 
PageLink)


This is where it takes:
/**
         * De-serializes an object from a byte array.
         * 
         * @param data
         *            The serialized object
         * @return The object
         */
        public static Object byteArrayToObject(final byte[] data)
        {
                try
                {
                        final ByteArrayInputStream in = new 
ByteArrayInputStream(data);
                        try
                        {
                                return 
objectStreamFactory.newObjectInputStream(in).readObject();
                        }
                        finally
                        {
                                in.close();
                        }
                }
                catch (ClassNotFoundException e)
                {
                        throw new RuntimeException("Could not deserialize 
object using `"
                                        + 
objectStreamFactory.getClass().getName() + "` object factory", e);
                }
                catch (IOException e)
                {
                        throw new RuntimeException("Could not deserialize 
object using `"
                                        + 
objectStreamFactory.getClass().getName() + "` object factory", e);
                }
        }


--- so this line is the source of the problem : 
return objectStreamFactory.newObjectInputStream(in).readObject();

--- thx for the reply

> Links don't work after using browser's back button (Statefull page)
> -------------------------------------------------------------------
>
>                 Key: WICKET-948
>                 URL: https://issues.apache.org/jira/browse/WICKET-948
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta4
>         Environment: Windows Vista, Tomcat 6
>            Reporter: Zsolt Süli
>
> After using this link on a statefull page:
> add(new Link("link")
>               {
>                       @Override
>                       public void onClick()
>                       {
>                               setResponsePage(new Page2());
>                       }
>               });
> It tooks me to Page2. After I hit the browser's back button and click on the 
> link again wicket throws a runtime exception:
> Root cause:
> java.io.StreamCorruptedException: invalid type code: 01
> at java.io.ObjectInputStream.readObject0(Unknown Source)
> at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
> at java.io.ObjectInputStream.readSerialData(Unknown Source)
> at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
> at java.io.ObjectInputStream.readObject0(Unknown Source)
> at java.io.ObjectInputStream.readObject(Unknown Source)
> at org.apache.wicket.util.lang.Objects.byteArrayToObject(Objects.java:396)
> at 
> org.apache.wicket.protocol.http.pagestore.AbstractPageStore.deserializePage(AbstractPageStore.java:231)
> at 
> org.apache.wicket.protocol.http.pagestore.DiskPageStore.getPage(DiskPageStore.java:589)
> at 
> org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.get(SecondLevelCacheSessionStore.java:322)
> at org.apache.wicket.Session.getPage(Session.java:790)
> at 
> org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:426)
> at 
> org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:139)
> at org.apache.wicket.RequestCycle.step(RequestCycle.java:1077)
> at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1173)
> at org.apache.wicket.RequestCycle.request(RequestCycle.java:483)
> at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:277)
> at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:121)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> at 
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> at java.lang.Thread.run(Unknown Source)
> Complete stack:
> java.lang.RuntimeException: Could not deserialize object using 
> `org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory` 
> object factory
> at org.apache.wicket.util.lang.Objects.byteArrayToObject(Objects.java:410)
> at 
> org.apache.wicket.protocol.http.pagestore.AbstractPageStore.deserializePage(AbstractPageStore.java:231)
> at 
> org.apache.wicket.protocol.http.pagestore.DiskPageStore.getPage(DiskPageStore.java:589)
> at 
> org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.get(SecondLevelCacheSessionStore.java:322)
> at org.apache.wicket.Session.getPage(Session.java:790)
> at 
> org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:426)
> at 
> org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:139)
> at org.apache.wicket.RequestCycle.step(RequestCycle.java:1077)
> at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1173)
> at org.apache.wicket.RequestCycle.request(RequestCycle.java:483)
> at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:277)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to