Thanks !

On Wed, Aug 29, 2012 at 10:00 AM, James Eliyezar <[email protected]> wrote:
> Updated the wiki "Request Cycle in Wicket
> 1.5<https://cwiki.apache.org/confluence/display/WICKET/RequestCycle+in+Wicket+1.5>
> "
>
> On Wed, Aug 29, 2012 at 3:31 PM, James Eliyezar <[email protected]> wrote:
>
>> That was fast Martin. I'm working on the wiki now.
>>
>>
>> On Wed, Aug 29, 2012 at 3:27 PM, Martin Grigorov <[email protected]>wrote:
>>
>>>
>>> https://git-wip-us.apache.org/repos/asf/wicket/repo?p=wicket.git;a=commitdiff;h=a5a1fe98e3b76110c6827b5744bf83f45ab0aac4
>>>
>>> On Wed, Aug 29, 2012 at 9:19 AM, James Eliyezar <[email protected]>
>>> wrote:
>>> > I like that deal.. :-)
>>> >
>>> > On Wed, Aug 29, 2012 at 3:09 PM, Martin Grigorov <[email protected]
>>> >wrote:
>>> >
>>> >> I'll improve the javadoc. You improve the wiki page ;-)
>>> >>
>>> >> On Wed, Aug 29, 2012 at 9:07 AM, James Eliyezar <[email protected]>
>>> >> wrote:
>>> >> > Thanks Martin for the info.
>>> >> > A note in PageRequestHandlerTracker's javadoc can be very useful.
>>> >> > And it will be great if this is reflected in the wiki page "Request
>>> Cycle
>>> >> > in wicket 1.5<
>>> >> https://cwiki.apache.org/WICKET/requestcycle-in-wicket-15.html>
>>> >> > ".
>>> >> >
>>> >> > On Wed, Aug 29, 2012 at 3:03 PM, Martin Grigorov <
>>> [email protected]
>>> >> >wrote:
>>> >> >
>>> >> >> Hi,
>>> >> >>
>>> >> >> Yes, you have to register it.
>>> >> >> It is not registered by default because not everyone needs it.
>>> >> >>
>>> >> >> On Wed, Aug 29, 2012 at 9:01 AM, James Eliyezar <
>>> [email protected]>
>>> >> >> wrote:
>>> >> >> > Guys,
>>> >> >> >
>>> >> >> > From the javadoc of IRequestCycleListener, I found that we have to
>>> >> >> > explicitly register the implementations.
>>> >> >> > I thought PageRequestHandlerTracker would have been registered by
>>> >> default
>>> >> >> > as that's from wicket.
>>> >> >> > So, when I registered it manually, it worked as expected. This is
>>> how
>>> >> I
>>> >> >> > registered it in the wicket application's "init" method.
>>> >> >> >
>>> >> >> >     @Override
>>> >> >> >>     public void init()
>>> >> >> >>     {
>>> >> >> >>         super.init();
>>> >> >> >>         getRequestCycleListeners().add(new
>>> >> PageRequestHandlerTracker());
>>> >> >> >>     }
>>> >> >> >>
>>> >> >> >
>>> >> >> > On Wed, Aug 29, 2012 at 2:41 PM, James Eliyezar <
>>> [email protected]>
>>> >> >> wrote:
>>> >> >> >
>>> >> >> >> Should I register PageRequestHandlerTracker anywhere?
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> On Wed, Aug 29, 2012 at 2:40 PM, James Eliyezar <
>>> [email protected]
>>> >> >> >wrote:
>>> >> >> >>
>>> >> >> >>> Alright Paul.
>>> >> >> >>>
>>> >> >> >>> This is my code:
>>> >> >> >>>
>>> >> >> >>> public class HomePage extends WebPage
>>> >> >> >>>> {
>>> >> >> >>>>     private static Logger logger =
>>> >> >> >>>> LoggerFactory.getLogger(HomePage.class);
>>> >> >> >>>>     private static final long serialVersionUID = 1L;
>>> >> >> >>>>
>>> >> >> >>>>     public HomePage(final PageParameters parameters)
>>> >> >> >>>>     {
>>> >> >> >>>>         add(new Label("version",
>>> >> >> >>>> getApplication().getFrameworkSettings().getVersion()));
>>> >> >> >>>>         try {
>>> >> >> >>>>             IPageRequestHandler lastHandler =
>>> >> >> >>>> PageRequestHandlerTracker.getLastHandler(RequestCycle.get());
>>> >> >> >>>>             logger.debug("Last handler: {}", lastHandler);
>>> >> >> >>>>             logger.debug("Requested page",
>>> lastHandler.getPage());
>>> >> >> >>>>         } catch (Exception ex) {
>>> >> >> >>>>             logger.error("Error", ex);
>>> >> >> >>>>         }
>>> >> >> >>>>     }
>>> >> >> >>>> }
>>> >> >> >>>>
>>> >> >> >>>>
>>> >> >> >>> This is the log with exception stack trace:
>>> >> >> >>>
>>> >> >> >>> [INFO] Started Jetty Server
>>> >> >> >>>> DEBUG - HomePage                   - Last handler: null
>>> >> >> >>>> ERROR - DefaultExceptionMapper     - Unexpected error occurred
>>> >> >> >>>> org.apache.wicket.WicketRuntimeException: Can't instantiate
>>> page
>>> >> using
>>> >> >> >>>> constructor 'public
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.quickstart.HomePage(org.apache.wicket.request.mapper.parameter.PageParameters)'
>>> >> >> >>>> and argument ''. Might be it doesn't exist, may be it is not
>>> >> visible
>>> >> >> >>>> (public).
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:193)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:76)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:46)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:103)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.request.handler.PageProvider.resolvePageInstance(PageProvider.java:274)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:165)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:93)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:237)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:784)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1326)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.server.handler.ContextHandler.__doHandle(ContextHandler.java:940)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:874)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
>>> >> >> >>>>     at org.eclipse.jetty.server.Server.handle(Server.java:349)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:904)
>>> >> >> >>>>     at
>>> >> >> org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:565)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:217)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:46)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:545)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:43)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
>>> >> >> >>>>     at java.lang.Thread.run(Thread.java:662)
>>> >> >> >>>> Caused by: java.lang.reflect.InvocationTargetException
>>> >> >> >>>>     at
>>> >> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>> >> >> >>>> Method)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>>> >> >> >>>>     at
>>> >> java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>> >> >> >>>>     at
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:170)
>>> >> >> >>>>     ... 41 more
>>> >> >> >>>> Caused by: java.lang.NullPointerException
>>> >> >> >>>>     at
>>> >> org.apache.wicket.quickstart.HomePage.<init>(HomePage.java:22)
>>> >> >> >>>>     ... 46 more
>>> >> >> >>>>
>>> >> >> >>>>
>>> >> >> >>> I've attached a quickstart project to recreate the problem.
>>> >> >> >>>
>>> >> >> >>>    - Unzip it
>>> >> >> >>>    - mvn clean package jetty:run
>>> >> >> >>>    - Point your browser to http://localhost:8080
>>> >> >> >>>    - Watch out the console for the exception.
>>> >> >> >>>
>>> >> >> >>>
>>> >> >> >>> On Wed, Aug 29, 2012 at 12:53 PM, Paul Borș <[email protected]>
>>> wrote:
>>> >> >> >>>
>>> >> >> >>>> Might help if you provide a stack trace for the NPE :)
>>> >> >> >>>>
>>> >> >> >>>> Have a great day,
>>> >> >> >>>>     Paul Borș
>>> >> >> >>>>
>>> >> >> >>>> On Aug 29, 2012, at 0:37, James Eliyezar <[email protected]>
>>> >> wrote:
>>> >> >> >>>>
>>> >> >> >>>> > Hi,
>>> >> >> >>>> >
>>> >> >> >>>> > We recently migrated our application to wicket-1.5.8.
>>> >> >> >>>> >
>>> >> >> >>>> > We have an audit aspect based on Spring AOP that shall log
>>> the
>>> >> >> actions
>>> >> >> >>>> > performed in the current page.
>>> >> >> >>>> > In wicket 1.4 we use to get that like
>>> >> >> >>>> > "RequestCycle.get().getResponsePage()".
>>> >> >> >>>> >
>>> >> >> >>>> > This has changed and I know that wicket 1.5 doesn't support
>>> this
>>> >> >> >>>> anymore.
>>> >> >> >>>> >
>>> >> >> >>>> > The suggested method as per the wiki is to "use a custom
>>> >> >> >>>> > RequestCycleListener<
>>> >> >> >>>> https://cwiki.apache.org/WICKET/requestcycle-in-wicket-15.html
>>> >
>>> >> >> >>>> > ".
>>> >> >> >>>> >
>>> >> >> >>>> > Fortunately, as highlighted in the mailing list, there is a
>>> new
>>> >> >> class
>>> >> >> >>>> in
>>> >> >> >>>> > wicket 1.5.8 named
>>> >> >> >>>> > PageRequestHandlerTracker<
>>> >> >> >>>>
>>> >> >>
>>> >>
>>> http://apache-wicket.1842946.n4.nabble.com/Interpolate-response-with-IResponseFilter-td4651476.html
>>> >> >> >>>> >to
>>> >> >> >>>> > meet this common requirement.
>>> >> >> >>>> >
>>> >> >> >>>> > However, when we use
>>> >> >> >>>> > PageRequestHandlerTracker.getLastHandler(RequestCycle.get()),
>>> >> >> >>>> > and then attempt to call #getPage(), a null pointer
>>> exception is
>>> >> >> >>>> thrown.
>>> >> >> >>>> >
>>> >> >> >>>> > Am I doing something wrong here? Please give your
>>> suggestions.
>>> >> >> >>>> >
>>> >> >> >>>> > --
>>> >> >> >>>> > Thanks & regards
>>> >> >> >>>> > James Selvakumar
>>> >> >> >>>> > mcruncher.com
>>> >> >> >>>>
>>> >> >> >>>>
>>> >> ---------------------------------------------------------------------
>>> >> >> >>>> To unsubscribe, e-mail: [email protected]
>>> >> >> >>>> For additional commands, e-mail: [email protected]
>>> >> >> >>>>
>>> >> >> >>>>
>>> >> >> >>>
>>> >> >> >>>
>>> >> >> >>> --
>>> >> >> >>> Thanks & regards
>>> >> >> >>> James Selvakumar
>>> >> >> >>> mcruncher.com
>>> >> >> >>>
>>> >> >> >>>
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> --
>>> >> >> >> Thanks & regards
>>> >> >> >> James Selvakumar
>>> >> >> >> mcruncher.com
>>> >> >> >>
>>> >> >> >>
>>> >> >> >
>>> >> >> >
>>> >> >> > --
>>> >> >> > Thanks & regards
>>> >> >> > James Selvakumar
>>> >> >> > mcruncher.com
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> --
>>> >> >> Martin Grigorov
>>> >> >> jWeekend
>>> >> >> Training, Consulting, Development
>>> >> >> http://jWeekend.com
>>> >> >>
>>> >> >>
>>> ---------------------------------------------------------------------
>>> >> >> To unsubscribe, e-mail: [email protected]
>>> >> >> For additional commands, e-mail: [email protected]
>>> >> >>
>>> >> >>
>>> >> >
>>> >> >
>>> >> > --
>>> >> > Thanks & regards
>>> >> > James Selvakumar
>>> >> > mcruncher.com
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> Martin Grigorov
>>> >> jWeekend
>>> >> Training, Consulting, Development
>>> >> http://jWeekend.com
>>> >>
>>> >> ---------------------------------------------------------------------
>>> >> To unsubscribe, e-mail: [email protected]
>>> >> For additional commands, e-mail: [email protected]
>>> >>
>>> >>
>>> >
>>> >
>>> > --
>>> > Thanks & regards
>>> > James Selvakumar
>>> > mcruncher.com
>>>
>>>
>>>
>>> --
>>> Martin Grigorov
>>> jWeekend
>>> Training, Consulting, Development
>>> http://jWeekend.com
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>>
>> --
>> Thanks & regards
>> James Selvakumar
>> mcruncher.com
>>
>>
>
>
> --
> Thanks & regards
> James Selvakumar
> mcruncher.com



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to