PageFactory and SessionSettings
After migration to Wicket 1.5 I'm wondering why our tests with our own IPageFactory implementation is not working anymore. In our tests we use the following code ... WicketTester tester = new WicketTester(); tester.getApplication().getSessionSettings().setPageFactory( new FooPageFactory() ); But in Wicket 1.5 the implemented SessionSettings class and their method getPageFacory() is only called from Session#getPageFactory() and SignInPanel#onBeforeRender methods, in which the first call is used in the InlineFrame class only. As I figured out you should use and override the newPageFactory() method from the Application class instead to create a custom IPageFactory implementation. Which whould result in the following code ... WicketTester tester = new WicketTester(new MockApplication() { protected IPageFactory newPageFactory() { return new FooPageFactory(); } }); The Application#getPageFactory() method is used in the DefaultMapperContext class to create a new Page instance, therefore our own implementation is used. But this is confusing to me. Maybe I miss a point but in my opinion the ISessionSettings interface should be marked as deprecated. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageFactory-and-SessionSettings-tp3854493p3854493.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Tracking Memory Usage
On Thu, Sep 29, 2011 at 3:04 AM, Dawid Dudzinski dawi...@gmail.com wrote: Hello, We are running into memory usage problems in our Wicket application. The team has identified several areas worth of improving. However we were only able to do that by looking at our code and not by profiling the jvm. This brings me to my actual questions: 1. Is there tool or method to determine Wicket's memory usage/session size? 2. Can anyone suggest a tool or a method to profile a jvm? (We use WebSphere AS and RAD IDE - problem is that WAS simply crashes when attempting to run in memory profiling mode) Then run the application in normal mode and from time to time dump the heap. Then you can examine the dumps with Eclipse Memory Analyzer tool. I'm open to all suggestions - if anyone could give some hints I would truly appreciate your help. Thanks, Dave -- 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
Re: ModalWindow in IE6, IE7, IE8 browser issues
here is exception stack, but only IE throws the exception ERROR - DefaultExceptionMapper - Connection lost, give up responding. org.apache.wicket.protocol.http.servlet.ResponseIOException: ClientAbortException: java.io.IOException at org.apache.wicket.protocol.http.servlet.ServletWebResponse.flush(ServletWebResponse.java:254) at org.apache.wicket.protocol.http.HeaderBufferingWebResponse.flush(HeaderBufferingWebResponse.java:92) at org.apache.wicket.request.resource.AbstractResource.setResponseHeaders(AbstractResource.java:611) at org.apache.wicket.request.resource.AbstractResource.respond(AbstractResource.java:485) 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:712) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:208) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:251) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:399) at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235) at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:411) at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:188) at org.springframework.security.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:99) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:306) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:322) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1732) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Caused by: ClientAbortException: java.io.IOException at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:329) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:298) at org.apache.catalina.connector.Response.flushBuffer(Response.java:559) at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:303) at javax.servlet.ServletResponseWrapper.flushBuffer(ServletResponseWrapper.java:161) at javax.servlet.ServletResponseWrapper.flushBuffer(ServletResponseWrapper.java:161) at org.apache.wicket.protocol.http.servlet.ServletWebResponse.flush(ServletWebResponse.java:250) ... 39
Re: ModalWindow in IE6, IE7, IE8 browser issues
This is fixed in 1.5.1 On Thu, Sep 29, 2011 at 8:50 AM, nhsoft.yhw nhsoft@gmail.com wrote: here is exception stack, but only IE throws the exception ERROR - DefaultExceptionMapper - Connection lost, give up responding. org.apache.wicket.protocol.http.servlet.ResponseIOException: ClientAbortException: java.io.IOException at org.apache.wicket.protocol.http.servlet.ServletWebResponse.flush(ServletWebResponse.java:254) at org.apache.wicket.protocol.http.HeaderBufferingWebResponse.flush(HeaderBufferingWebResponse.java:92) at org.apache.wicket.request.resource.AbstractResource.setResponseHeaders(AbstractResource.java:611) at org.apache.wicket.request.resource.AbstractResource.respond(AbstractResource.java:485) 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:712) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:208) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:251) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:399) at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235) at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:411) at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:188) at org.springframework.security.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:99) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:306) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:322) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1732) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Caused by: ClientAbortException: java.io.IOException at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:329) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:298) at org.apache.catalina.connector.Response.flushBuffer(Response.java:559) at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:303) at javax.servlet.ServletResponseWrapper.flushBuffer(ServletResponseWrapper.java:161) at
Re: PageFactory and SessionSettings
Indeed this is missed. I'll create a ticket for it. Thanks! On Thu, Sep 29, 2011 at 8:05 AM, Dirk Forchel dirk.forc...@exedio.com wrote: After migration to Wicket 1.5 I'm wondering why our tests with our own IPageFactory implementation is not working anymore. In our tests we use the following code ... WicketTester tester = new WicketTester(); tester.getApplication().getSessionSettings().setPageFactory( new FooPageFactory() ); But in Wicket 1.5 the implemented SessionSettings class and their method getPageFacory() is only called from Session#getPageFactory() and SignInPanel#onBeforeRender methods, in which the first call is used in the InlineFrame class only. As I figured out you should use and override the newPageFactory() method from the Application class instead to create a custom IPageFactory implementation. Which whould result in the following code ... WicketTester tester = new WicketTester(new MockApplication() { protected IPageFactory newPageFactory() { return new FooPageFactory(); } }); The Application#getPageFactory() method is used in the DefaultMapperContext class to create a new Page instance, therefore our own implementation is used. But this is confusing to me. Maybe I miss a point but in my opinion the ISessionSettings interface should be marked as deprecated. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageFactory-and-SessionSettings-tp3854493p3854493.html Sent from the Users forum mailing list archive at Nabble.com. - 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
Re: How to set Cookie on Redirect to URL
Here is what I use to keep the cookies (headers): public class NonResettingRestartException extends ReplaceHandlerException { public NonResettingRestartException(final Class? extends Page? pageClass, final PageParameters params, final RequestCycle cycle) { super(createRequestHandler(pageClass, params), true); Response response = cycle.getResponse(); if (response instanceof IMetaDataBufferingWebResponse) { IMetaDataBufferingWebResponse bufferingWebResponse = (IMetaDataBufferingWebResponse) response; bufferingWebResponse.writeMetaData((WebResponse) cycle.getOriginalResponse()); } } private static IRequestHandler createRequestHandler(Class? extends Page? pageClass, PageParameters params) { return new RenderPageRequestHandler(new PageProvider(pageClass, params)); } } On Thu, Sep 29, 2011 at 12:01 AM, b...@actrix.gen.nz wrote: Hi, How do I add a cookie to a URL redirect response? I started with the following class: public class RedirectToUrlWithHandlerException extends ReplaceHandlerException { ... public RedirectToUrlWithHandlerException(final String redirectUrl, final int statusCode, final IRequestHandler handler) { super(new RedirectRequestHandler(redirectUrl, statusCode){ @Override public void detach(IRequestCycle requestCycle) { super.detach(requestCycle); handler.detach(requestCycle); } @Override public void respond(IRequestCycle requestCycle) { super.respond(requestCycle); handler.respond(requestCycle); } }, true); } } and in the page: throw new RedirectToUrlWithHandlerException(targetUrl, new IRequestHandler(){ @Override public void respond(IRequestCycle requestCycle) { // Set cookie cookieUtils.save(name, value); } @Override public void detach(IRequestCycle requestCycle) { } }); with cookieUtils: instance.cookieUtils = new CookieUtils(cookieDefaults){ @Override protected void initializeCookie(Cookie cookie) { super.initializeCookie(cookie); cookie.setPath(/); } }; Still no cookie in the response. I know this is a tricky issue where older browsers don't always cooperate, but the page being redirected to can't set the cookie because the cookie is used to transfer information to it. Many thanks, Bernard - 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
Re: PageFactory and SessionSettings
https://issues.apache.org/jira/browse/WICKET-4093 On Thu, Sep 29, 2011 at 8:54 AM, Martin Grigorov mgrigo...@apache.org wrote: Indeed this is missed. I'll create a ticket for it. Thanks! On Thu, Sep 29, 2011 at 8:05 AM, Dirk Forchel dirk.forc...@exedio.com wrote: After migration to Wicket 1.5 I'm wondering why our tests with our own IPageFactory implementation is not working anymore. In our tests we use the following code ... WicketTester tester = new WicketTester(); tester.getApplication().getSessionSettings().setPageFactory( new FooPageFactory() ); But in Wicket 1.5 the implemented SessionSettings class and their method getPageFacory() is only called from Session#getPageFactory() and SignInPanel#onBeforeRender methods, in which the first call is used in the InlineFrame class only. As I figured out you should use and override the newPageFactory() method from the Application class instead to create a custom IPageFactory implementation. Which whould result in the following code ... WicketTester tester = new WicketTester(new MockApplication() { protected IPageFactory newPageFactory() { return new FooPageFactory(); } }); The Application#getPageFactory() method is used in the DefaultMapperContext class to create a new Page instance, therefore our own implementation is used. But this is confusing to me. Maybe I miss a point but in my opinion the ISessionSettings interface should be marked as deprecated. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageFactory-and-SessionSettings-tp3854493p3854493.html Sent from the Users forum mailing list archive at Nabble.com. - 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 -- 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
Re: PageFactory and SessionSettings
Put a breakpoint in your factory and see what it returns and why PageProvider believes it is null ... On Thu, Sep 29, 2011 at 9:34 AM, Dirk Forchel dirk.forc...@exedio.com wrote: Hi Martin, thank you for your quick response ... indeed I have another problem too ... In our own BookmarkablePageFactoryTest I set up now the test environment the following way ... @Before public void setUp() { // see issue https://issues.apache.org/jira/browse/WICKET-4093 tester = new WicketTester(new MockApplication() { protected IPageFactory newPageFactory() { return new BookmarkablePageFactory( linkFactory ); } }); ConverterLocator converterLocator = (ConverterLocator)tester.getApplication().getConverterLocator(); converterLocator.set( DummyData.class, new DummyDataConverter() ); } and test a page with one named parameter ... @Test public void oneParameter() { PageParameters params = new PageParameters(); params.set(data, ~~abc~~); tester.startPage( OneParameterPage.class, params); tester.isRenderedPage( OneParameterPage.class ); assertInfoMessages( tester, OneParameterPage(abc) ); Assert.assertEquals( 200, tester.getLastResponse().getStatus() ); } But this test (and other tests as well) are not working anymore (as it was with Wicket 1.4). I've got always a PageExpiredException although the Page is really created and returned within our own PageFactory implementation. Additional I've dumped the stack trace for getting a hint where the method is called ... @Override public final C extends IRequestablePage IRequestablePage newPage(final ClassC pageClass, final PageParameters pageParameters) { System.out.println( newPage Class +pageClass+ PageParameters +pageParameters); Thread.dumpStack(); ... IRequestablePage page = createPage( constructor, arguments ); System.out.println( created page +page); return page; } This is the stack trace: newPage Class class com.exedio.wig.bookmark.dummy.OneParameterPage PageParameters data=[~~abc~~] java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Unknown Source) at com.exedio.wig.bookmark.BookmarkablePageFactory.newPage(BookmarkablePageFactory.java:80) at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:107) at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:273) at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:167) at org.apache.wicket.util.tester.BaseWicketTester$LastPageRecordingPageRendererProvider.get(BaseWicketTester.java:2514) at org.apache.wicket.util.tester.BaseWicketTester$LastPageRecordingPageRendererProvider.get(BaseWicketTester.java:2501) at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:146) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:719) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:210) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253) at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:596) at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:516) at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:488) at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:1097) at com.exedio.wig.bookmark.BookmarkablePageFactoryTest.oneParameter(BookmarkablePageFactoryTest.java:135) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at
Re: PageFactory and SessionSettings
Hi Martin, thank you for your quick response ... indeed I have another problem too ... In our own BookmarkablePageFactoryTest I set up now the test environment the following way ... @Before public void setUp() { // see issue https://issues.apache.org/jira/browse/WICKET-4093 tester = new WicketTester(new MockApplication() { protected IPageFactory newPageFactory() { return new BookmarkablePageFactory( linkFactory ); } }); ConverterLocator converterLocator = (ConverterLocator)tester.getApplication().getConverterLocator(); converterLocator.set( DummyData.class, new DummyDataConverter() ); } and test a page with one named parameter ... @Test public void oneParameter() { PageParameters params = new PageParameters(); params.set(data, ~~abc~~); tester.startPage( OneParameterPage.class, params); tester.isRenderedPage( OneParameterPage.class ); assertInfoMessages( tester, OneParameterPage(abc) ); Assert.assertEquals( 200, tester.getLastResponse().getStatus() ); } But this test (and other tests as well) are not working anymore (as it was with Wicket 1.4). I've got always a PageExpiredException although the Page is really created and returned within our own PageFactory implementation. Additional I've dumped the stack trace for getting a hint where the method is called ... @Override public final C extends IRequestablePage IRequestablePage newPage(final ClassC pageClass, final PageParameters pageParameters) { System.out.println( newPage Class +pageClass+ PageParameters +pageParameters); Thread.dumpStack(); ... IRequestablePage page = createPage( constructor, arguments ); System.out.println( created page +page); return page; } This is the stack trace: newPage Class class com.exedio.wig.bookmark.dummy.OneParameterPage PageParameters data=[~~abc~~] java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Unknown Source) at com.exedio.wig.bookmark.BookmarkablePageFactory.newPage(BookmarkablePageFactory.java:80) at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:107) at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:273) at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:167) at org.apache.wicket.util.tester.BaseWicketTester$LastPageRecordingPageRendererProvider.get(BaseWicketTester.java:2514) at org.apache.wicket.util.tester.BaseWicketTester$LastPageRecordingPageRendererProvider.get(BaseWicketTester.java:2501) at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:146) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:719) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:210) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253) at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:596) at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:516) at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:488) at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:1097) at com.exedio.wig.bookmark.BookmarkablePageFactoryTest.oneParameter(BookmarkablePageFactoryTest.java:135) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at
Re: pretty strange behavior with TextArea containing remaining output html code inside
tested on wicket 1.5.0 and paradoxically a single-closed textarea tag does validate as legal too, like in wicket 1.4.17/18, and renders correctly, contrary to wicket 1.4.17/18. issue https://issues.apache.org/jira/browse/WICKET-4094 On Wed, Sep 28, 2011 at 7:30 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: file a jira issue -igor On Wed, Sep 28, 2011 at 9:52 AM, manuelbarzi manuelba...@gmail.com wrote: right. may wicket html validation complain in future version for this particular case. low priority issue... . On Wed, Sep 28, 2011 at 6:42 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: per html spec textarea must have a closing tag... -igor On Wed, Sep 28, 2011 at 9:25 AM, manuelbarzi manuelba...@gmail.com wrote: TextArea is one-self-closed tag .../. should TextArea two-opening-closing tags ../... work fine. On Wed, Sep 28, 2011 at 6:18 PM, manuelbarzi manuelba...@gmail.com wrote: this error happens on this simple composite (wicket 1.4.17): Page |-Panel |-Form |-TextField |-TextField |-TextArea |-TextField |-TextField |-Button |-Button when just rendering this simple page (no logic implemented yet), the output html (reviewed on chrome and ie) renders ok until the TextArea, and then, inside the TextArea content (visible text), there's all the remaining of the output markup! switching TextArea to a simple TextField does render ok. known bug? - 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 - 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: pretty strange behavior with TextArea containing remaining output html code inside
This is improved in 1.5.0. We expand some HTML elements from name/ to name/name You are recommended to upgrade. On Thu, Sep 29, 2011 at 9:44 AM, manuelbarzi manuelba...@gmail.com wrote: tested on wicket 1.5.0 and paradoxically a single-closed textarea tag does validate as legal too, like in wicket 1.4.17/18, and renders correctly, contrary to wicket 1.4.17/18. issue https://issues.apache.org/jira/browse/WICKET-4094 On Wed, Sep 28, 2011 at 7:30 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: file a jira issue -igor On Wed, Sep 28, 2011 at 9:52 AM, manuelbarzi manuelba...@gmail.com wrote: right. may wicket html validation complain in future version for this particular case. low priority issue... . On Wed, Sep 28, 2011 at 6:42 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: per html spec textarea must have a closing tag... -igor On Wed, Sep 28, 2011 at 9:25 AM, manuelbarzi manuelba...@gmail.com wrote: TextArea is one-self-closed tag .../. should TextArea two-opening-closing tags ../... work fine. On Wed, Sep 28, 2011 at 6:18 PM, manuelbarzi manuelba...@gmail.com wrote: this error happens on this simple composite (wicket 1.4.17): Page |-Panel |-Form |-TextField |-TextField |-TextArea |-TextField |-TextField |-Button |-Button when just rendering this simple page (no logic implemented yet), the output html (reviewed on chrome and ie) renders ok until the TextArea, and then, inside the TextArea content (visible text), there's all the remaining of the output markup! switching TextArea to a simple TextField does render ok. known bug? - 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 - 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 - 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
Re: pretty strange behavior with TextArea containing remaining output html code inside
sure, as you may have read, i already tested on wicket 1.5.0 and renders ok. but from the point of view of validation, a textarea cannot be a single-closed tag, is an illegal code, as it goes against the spec (igor). On Thu, Sep 29, 2011 at 9:49 AM, Martin Grigorov mgrigo...@apache.org wrote: This is improved in 1.5.0. We expand some HTML elements from name/ to name/name You are recommended to upgrade. On Thu, Sep 29, 2011 at 9:44 AM, manuelbarzi manuelba...@gmail.com wrote: tested on wicket 1.5.0 and paradoxically a single-closed textarea tag does validate as legal too, like in wicket 1.4.17/18, and renders correctly, contrary to wicket 1.4.17/18. issue https://issues.apache.org/jira/browse/WICKET-4094 On Wed, Sep 28, 2011 at 7:30 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: file a jira issue -igor On Wed, Sep 28, 2011 at 9:52 AM, manuelbarzi manuelba...@gmail.com wrote: right. may wicket html validation complain in future version for this particular case. low priority issue... . On Wed, Sep 28, 2011 at 6:42 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: per html spec textarea must have a closing tag... -igor On Wed, Sep 28, 2011 at 9:25 AM, manuelbarzi manuelba...@gmail.com wrote: TextArea is one-self-closed tag .../. should TextArea two-opening-closing tags ../... work fine. On Wed, Sep 28, 2011 at 6:18 PM, manuelbarzi manuelba...@gmail.com wrote: this error happens on this simple composite (wicket 1.4.17): Page |-Panel |-Form |-TextField |-TextField |-TextArea |-TextField |-TextField |-Button |-Button when just rendering this simple page (no logic implemented yet), the output html (reviewed on chrome and ie) renders ok until the TextArea, and then, inside the TextArea content (visible text), there's all the remaining of the output markup! switching TextArea to a simple TextField does render ok. known bug? - 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 - 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 - 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
Re: java.lang.IllegalStateException: STREAMED - Consuming JSON fails
Cheers. Changed the call to. BufferedReader in = new BufferedReader( new InputStreamReader( hsr.getInputStream())); On 28/09/2011, at 7:03 PM, Martin Grigorov wrote: This exception says Don't use the reader but use the input stream because something (maybe header) has been already read from the stream. On Wed, Sep 28, 2011 at 10:59 AM, Tate Jones t...@bluedog.com.au wrote: Hi Group, I am new to Wicket and I am attempting to read some JSON data posted from a wicket page. The following exception occurs with Wicket 1.4.18 and Jetty 6.1.x when attempting to read the servlet request - BufferedReader br = hsr.getReader(). Sep 28, 2011 8:50:48 AM org.apache.wicket.RequestCycle logRuntimeException SEVERE: STREAMED java.lang.IllegalStateException: STREAMED at org.mortbay.jetty.Request.getReader(Request.java:935) at tunechipsapp.web.pages.LoginPage$2.onRequest(LoginPage.java:64) at org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:157) at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1252) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1331) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1438) at org.apache.wicket.RequestCycle.request(RequestCycle.java:546) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319) at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) The code was source from https://cwiki.apache.org/WICKET/how-to-handle-jqueryajax-json-request-.html AbstractAjaxBehavior ajaxSaveBehaviour = new AbstractAjaxBehavior() { private static final long serialVersionUID = 1L; @SuppressWarnings(unchecked) public void onRequest() { log.info(* onRequest *); //get parameters final RequestCycle requestCycle = RequestCycle.get(); WebRequest wr = (WebRequest) requestCycle.getRequest(); HttpServletRequest hsr = wr.getHttpServletRequest(); try { BufferedReader br = hsr.getReader(); Exception String jsonString = br.readLine(); if ((jsonString == null) || jsonString.isEmpty()) { log.error( no json found); } else { log.info( json is : + jsonString); } } catch (IOException ex) { log.error(ex.toString()); } // json string to retir to the jQuery onSuccess function String data = {}; log.info(returning json : + data); IRequestTarget t = new StringRequestTarget(application/json, UTF-8, data); getRequestCycle().setRequestTarget(t); //requestCycle.setRequestTarget(new StringRequestTarget(application/json, utf-8, data)); } }; add(ajaxSaveBehaviour); I have read some posts about this in different forms (eg. pushing content), but I haven't found a solution at this point. Cheers in advance Tate -- 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
Re: pretty strange behavior with TextArea containing remaining output html code inside
Wicket doesn't act as (X)HTML validator. It never did. You may use https://github.com/dashorst/wicket-stuff-markup-validator for that On Thu, Sep 29, 2011 at 9:53 AM, manuelbarzi manuelba...@gmail.com wrote: sure, as you may have read, i already tested on wicket 1.5.0 and renders ok. but from the point of view of validation, a textarea cannot be a single-closed tag, is an illegal code, as it goes against the spec (igor). On Thu, Sep 29, 2011 at 9:49 AM, Martin Grigorov mgrigo...@apache.org wrote: This is improved in 1.5.0. We expand some HTML elements from name/ to name/name You are recommended to upgrade. On Thu, Sep 29, 2011 at 9:44 AM, manuelbarzi manuelba...@gmail.com wrote: tested on wicket 1.5.0 and paradoxically a single-closed textarea tag does validate as legal too, like in wicket 1.4.17/18, and renders correctly, contrary to wicket 1.4.17/18. issue https://issues.apache.org/jira/browse/WICKET-4094 On Wed, Sep 28, 2011 at 7:30 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: file a jira issue -igor On Wed, Sep 28, 2011 at 9:52 AM, manuelbarzi manuelba...@gmail.com wrote: right. may wicket html validation complain in future version for this particular case. low priority issue... . On Wed, Sep 28, 2011 at 6:42 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: per html spec textarea must have a closing tag... -igor On Wed, Sep 28, 2011 at 9:25 AM, manuelbarzi manuelba...@gmail.com wrote: TextArea is one-self-closed tag .../. should TextArea two-opening-closing tags ../... work fine. On Wed, Sep 28, 2011 at 6:18 PM, manuelbarzi manuelba...@gmail.com wrote: this error happens on this simple composite (wicket 1.4.17): Page |-Panel |-Form |-TextField |-TextField |-TextArea |-TextField |-TextField |-Button |-Button when just rendering this simple page (no logic implemented yet), the output html (reviewed on chrome and ie) renders ok until the TextArea, and then, inside the TextArea content (visible text), there's all the remaining of the output markup! switching TextArea to a simple TextField does render ok. known bug? - 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 - 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 - 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 -- 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
Re: pretty strange behavior with TextArea containing remaining output html code inside
Wicket doesn't act as (X)HTML validator. It never did. but if you forget some closing tag, /tr for instance, you might be sure it will complain... then why not validating other tags too, and fully validate (x)html. On Thu, Sep 29, 2011 at 9:56 AM, Martin Grigorov mgrigo...@apache.org wrote: Wicket doesn't act as (X)HTML validator. It never did. You may use https://github.com/dashorst/wicket-stuff-markup-validator for that On Thu, Sep 29, 2011 at 9:53 AM, manuelbarzi manuelba...@gmail.com wrote: sure, as you may have read, i already tested on wicket 1.5.0 and renders ok. but from the point of view of validation, a textarea cannot be a single-closed tag, is an illegal code, as it goes against the spec (igor). On Thu, Sep 29, 2011 at 9:49 AM, Martin Grigorov mgrigo...@apache.org wrote: This is improved in 1.5.0. We expand some HTML elements from name/ to name/name You are recommended to upgrade. On Thu, Sep 29, 2011 at 9:44 AM, manuelbarzi manuelba...@gmail.com wrote: tested on wicket 1.5.0 and paradoxically a single-closed textarea tag does validate as legal too, like in wicket 1.4.17/18, and renders correctly, contrary to wicket 1.4.17/18. issue https://issues.apache.org/jira/browse/WICKET-4094 On Wed, Sep 28, 2011 at 7:30 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: file a jira issue -igor On Wed, Sep 28, 2011 at 9:52 AM, manuelbarzi manuelba...@gmail.com wrote: right. may wicket html validation complain in future version for this particular case. low priority issue... . On Wed, Sep 28, 2011 at 6:42 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: per html spec textarea must have a closing tag... -igor On Wed, Sep 28, 2011 at 9:25 AM, manuelbarzi manuelba...@gmail.com wrote: TextArea is one-self-closed tag .../. should TextArea two-opening-closing tags ../... work fine. On Wed, Sep 28, 2011 at 6:18 PM, manuelbarzi manuelba...@gmail.com wrote: this error happens on this simple composite (wicket 1.4.17): Page |-Panel |-Form |-TextField |-TextField |-TextArea |-TextField |-TextField |-Button |-Button when just rendering this simple page (no logic implemented yet), the output html (reviewed on chrome and ie) renders ok until the TextArea, and then, inside the TextArea content (visible text), there's all the remaining of the output markup! switching TextArea to a simple TextField does render ok. known bug? - 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 - 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 - 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 -- 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
Re: PageFactory and SessionSettings
PageProvider.getPageInstance() is called twice!!! Within the first call from BaseWicketTester$LastPageRecordingPageRendererProvider.get(RenderRequestHandler) line: 2514 the return pageInstance is not null (instance is OneParameterPage (id=73)) Thread [main] (Suspended (breakpoint at line 167 in PageProvider)) PageProvider.getPageInstance() line: 167 BaseWicketTester$LastPageRecordingPageRendererProvider.get(RenderPageRequestHandler) line: 2514 BaseWicketTester$LastPageRecordingPageRendererProvider.get(Object) line: 2501 RenderPageRequestHandler.respond(IRequestCycle) line: 146 RequestCycle$HandlerExecutor.respond(IRequestHandler) line: 719 RequestCycle$HandlerExecutor(RequestHandlerStack).execute(IRequestHandler) line: 63 RequestCycle.processRequest() line: 210 RequestCycle.processRequestAndDetach() line: 253 WicketTester(BaseWicketTester).processRequest(MockHttpServletRequest, IRequestHandler, boolean) line: 596 WicketTester(BaseWicketTester).processRequest(MockHttpServletRequest, IRequestHandler) line: 516 WicketTester(BaseWicketTester).processRequest() line: 488 WicketTester(BaseWicketTester).startPage(ClassC, PageParameters) line: 1097 BookmarkablePageFactoryTest.oneParameter() line: 135 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available Method.invoke(Object, Object...) line: not available FrameworkMethod$1.runReflectiveCall() line: 44 FrameworkMethod$1(ReflectiveCallable).run() line: 15 FrameworkMethod.invokeExplosively(Object, Object...) line: 41 InvokeMethod.evaluate() line: 20 RunBefores.evaluate() line: 28 Parameterized$TestClassRunnerForParameters(BlockJUnit4ClassRunner).runChild(FrameworkMethod, RunNotifier) line: 76 Parameterized$TestClassRunnerForParameters(BlockJUnit4ClassRunner).runChild(Object, RunNotifier) line: 50 ParentRunner$3.run() line: 193 ParentRunner$1.schedule(Runnable) line: 52 Parameterized$TestClassRunnerForParameters(ParentRunnerT).runChildren(RunNotifier) line: 191 ParentRunnerT.access$000(ParentRunner, RunNotifier) line: 42 ParentRunner$2.evaluate() line: 184 Parameterized$TestClassRunnerForParameters(ParentRunnerT).run(RunNotifier) line: 236 Parameterized(Suite).runChild(Runner, RunNotifier) line: 128 Parameterized(Suite).runChild(Object, RunNotifier) line: 24 ParentRunner$3.run() line: 193 ParentRunner$1.schedule(Runnable) line: 52 Parameterized(ParentRunnerT).runChildren(RunNotifier) line: 191 ParentRunnerT.access$000(ParentRunner, RunNotifier) line: 42 ParentRunner$2.evaluate() line: 184 Parameterized(ParentRunnerT).run(RunNotifier) line: 236 JUnit4TestClassReference(JUnit4TestReference).run(TestExecution) line: 49 TestExecution.run(ITestReference[]) line: 38 RemoteTestRunner.runTests(String[], String, TestExecution) line: 467 RemoteTestRunner.runTests(TestExecution) line: 683 RemoteTestRunner.run() line: 390 RemoteTestRunner.main(String[]) line: 197 The second call (I've marked line 646) the returned pageInstance is indeed NULL. Thread [main] (Suspended (breakpoint at line 167 in PageProvider)) PageProvider.getPageInstance() line: 167 BaseWicketTester$LastPageRecordingPageRendererProvider.get(RenderPageRequestHandler) line: 2514 BaseWicketTester$LastPageRecordingPageRendererProvider.get(Object) line: 2501 RenderPageRequestHandler.respond(IRequestCycle) line: 146 RequestCycle$HandlerExecutor.respond(IRequestHandler) line: 719 RequestCycle$HandlerExecutor(RequestHandlerStack).execute(IRequestHandler) line: 63 RequestCycle.processRequest() line: 210 RequestCycle.processRequestAndDetach() line: 253 WicketTester(BaseWicketTester).processRequest(MockHttpServletRequest, IRequestHandler, boolean) line: 596 WicketTester(BaseWicketTester).processRequest(MockHttpServletRequest, IRequestHandler, boolean) line: 646 WicketTester(BaseWicketTester).processRequest(MockHttpServletRequest, IRequestHandler) line: 516 WicketTester(BaseWicketTester).processRequest() line: 488 WicketTester(BaseWicketTester).startPage(ClassC, PageParameters) line: 1097 BookmarkablePageFactoryTest.oneParameter() line: 135 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available Method.invoke(Object, Object...) line: not available FrameworkMethod$1.runReflectiveCall() line: 44 FrameworkMethod$1(ReflectiveCallable).run() line: 15 FrameworkMethod.invokeExplosively(Object, Object...)
Re: pretty strange behavior with TextArea containing remaining output html code inside
Wicket uses (custom) XML parser when loading the HTML. textarea/ is a valid xml and thus it doesn't fail. HTML validator is a dirty job because different browsers implement the specs differently ... :-/ On Thu, Sep 29, 2011 at 10:02 AM, manuelbarzi manuelba...@gmail.com wrote: Wicket doesn't act as (X)HTML validator. It never did. but if you forget some closing tag, /tr for instance, you might be sure it will complain... then why not validating other tags too, and fully validate (x)html. On Thu, Sep 29, 2011 at 9:56 AM, Martin Grigorov mgrigo...@apache.org wrote: Wicket doesn't act as (X)HTML validator. It never did. You may use https://github.com/dashorst/wicket-stuff-markup-validator for that On Thu, Sep 29, 2011 at 9:53 AM, manuelbarzi manuelba...@gmail.com wrote: sure, as you may have read, i already tested on wicket 1.5.0 and renders ok. but from the point of view of validation, a textarea cannot be a single-closed tag, is an illegal code, as it goes against the spec (igor). On Thu, Sep 29, 2011 at 9:49 AM, Martin Grigorov mgrigo...@apache.org wrote: This is improved in 1.5.0. We expand some HTML elements from name/ to name/name You are recommended to upgrade. On Thu, Sep 29, 2011 at 9:44 AM, manuelbarzi manuelba...@gmail.com wrote: tested on wicket 1.5.0 and paradoxically a single-closed textarea tag does validate as legal too, like in wicket 1.4.17/18, and renders correctly, contrary to wicket 1.4.17/18. issue https://issues.apache.org/jira/browse/WICKET-4094 On Wed, Sep 28, 2011 at 7:30 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: file a jira issue -igor On Wed, Sep 28, 2011 at 9:52 AM, manuelbarzi manuelba...@gmail.com wrote: right. may wicket html validation complain in future version for this particular case. low priority issue... . On Wed, Sep 28, 2011 at 6:42 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: per html spec textarea must have a closing tag... -igor On Wed, Sep 28, 2011 at 9:25 AM, manuelbarzi manuelba...@gmail.com wrote: TextArea is one-self-closed tag .../. should TextArea two-opening-closing tags ../... work fine. On Wed, Sep 28, 2011 at 6:18 PM, manuelbarzi manuelba...@gmail.com wrote: this error happens on this simple composite (wicket 1.4.17): Page |-Panel |-Form |-TextField |-TextField |-TextArea |-TextField |-TextField |-Button |-Button when just rendering this simple page (no logic implemented yet), the output html (reviewed on chrome and ie) renders ok until the TextArea, and then, inside the TextArea content (visible text), there's all the remaining of the output markup! switching TextArea to a simple TextField does render ok. known bug? - 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 - 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 - 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 -- 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 -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands,
Re: BookmarkablePageLink PageParameters
Not sure for which version of Wicket you are talking about but in 1.5 org.apache.wicket.markup.html.link.BookmarkablePageLink.setParameter(String, int) and few other methods are deprecated and it is recommended to use BookmarkablePageLink#getPageParameters()}.set()/.add() On Wed, Sep 28, 2011 at 7:51 PM, neoritter rittermaver...@hotmail.com wrote: Not really an issue, but a question. Is there a reason that BookmarkablePageLink.setParameterImpl does a PageParameter.put instead of a PageParameter.add? When doing a ServletWebRequest.getParameters you can retrieve an array of parameters with a given key. Is there a reason why the functionality to add multiple parameters of the same key is taken out of BookmarkablePageLink? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/BookmarkablePageLink-PageParameters-tp3852163p3852163.html Sent from the Users forum mailing list archive at Nabble.com. - 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
Re: ModalWindow in IE6, IE7, IE8 browser issues
I swith to use modal dialog with panel, it works. ModalWindow seems to have some strange problems, sometimes it is difficult to reproduce. For example, some of my applications ModalWindow normal, some abnormal, but I can not find reason. - http://www.517wm.com 外卖订餐分享工具 -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ModalWindow-in-IE6-IE7-IE8-browser-issues-tp3854296p3854857.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Redering to to file in wicket1.5
Hey guys, I need to render a page to a String or file. I have already read the typical reference [1] [2] for this topic. The difference is, that I am using wicket 1.5 and there must be some API changes so I could not use the given examples. Has someone an example? I tried my best to make the exampel compile but i alwas get a NPE at bufferedWebResponse.getText().toString() Appreciate your help in advance, Stefan [1] http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ [2] https://gist.github.com/1152059 [3] public static String renderPage(final Class? extends Page pageClass, final PageParameters pageParameters) { final WebApplication application = WebApplication.get(); final ServletContext context = application.getServletContext(); //fake a request/response cycle final MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); final MockHttpServletRequest servletRequest = new MockHttpServletRequest(application, servletSession, context); final MockHttpServletResponse servletResponse = new MockHttpServletResponse(servletRequest); //initialize request and response servletRequest.initialize(); servletResponse.initialize(); final ServletWebRequest webRequest = new ServletWebRequest(servletRequest,/); final WebResponse webResponse = new ServletWebResponse(webRequest,servletResponse); final BufferedWebResponse bufferedWebResponse = new BufferedWebResponse(webResponse); //webResponse.setAjax(true); final RequestCycle requestCycle = new RequestCycle( new RequestCycleContext(webRequest, webResponse, application.getRootRequestMapper(, application.getExceptionMapperProvider().get())); //requestCycle.setRequestTarget(new BookmarkablePageRequestTarget(pageClass, pageParameters)); requestCycle.setResponsePage(pageClass, pageParameters); try { final boolean handled = requestCycle.processRequestAndDetach(); LOGGER.info(Response after request: + bufferedWebResponse.getText().toString()); if (! handled) { LOGGER.error( NOT HANDLED); //requestCycle.set(new ErrorCodeRequestHandler(HttpServletResponse.SC_NOT_FOUND)); } //requestCycle.detach(); } finally { requestCycle.getResponse().close(); } return bufferedWebResponse.getText().toString(); } -- Stefan Neumann Dipl.-Ing. freiheit.com technologies gmbh Straßenbahnring 22 / 20251 Hamburg, Germany fon +49 (0)40 / 890584-0 fax +49 (0)40 / 890584-20 HRB Hamburg 70814 1CB2 BA3C 168F 0C2B 6005 FC5E 3EBA BCE2 1BF0 21D3 Geschäftsführer: Claudia Dietze, Stefan Richter, Jörg Kirchhof - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Redering to to file in wicket1.5
use WicketTester.startPage() and tester.getLastResponseAsString() On Thu, Sep 29, 2011 at 11:06 AM, Stefan Neumann stefan.neum...@freiheit.com wrote: Hey guys, I need to render a page to a String or file. I have already read the typical reference [1] [2] for this topic. The difference is, that I am using wicket 1.5 and there must be some API changes so I could not use the given examples. Has someone an example? I tried my best to make the exampel compile but i alwas get a NPE at bufferedWebResponse.getText().toString() Appreciate your help in advance, Stefan [1] http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ [2] https://gist.github.com/1152059 [3] public static String renderPage(final Class? extends Page pageClass, final PageParameters pageParameters) { final WebApplication application = WebApplication.get(); final ServletContext context = application.getServletContext(); //fake a request/response cycle final MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); final MockHttpServletRequest servletRequest = new MockHttpServletRequest(application, servletSession, context); final MockHttpServletResponse servletResponse = new MockHttpServletResponse(servletRequest); //initialize request and response servletRequest.initialize(); servletResponse.initialize(); final ServletWebRequest webRequest = new ServletWebRequest(servletRequest,/); final WebResponse webResponse = new ServletWebResponse(webRequest,servletResponse); final BufferedWebResponse bufferedWebResponse = new BufferedWebResponse(webResponse); //webResponse.setAjax(true); final RequestCycle requestCycle = new RequestCycle( new RequestCycleContext(webRequest, webResponse, application.getRootRequestMapper(, application.getExceptionMapperProvider().get())); //requestCycle.setRequestTarget(new BookmarkablePageRequestTarget(pageClass, pageParameters)); requestCycle.setResponsePage(pageClass, pageParameters); try { final boolean handled = requestCycle.processRequestAndDetach(); LOGGER.info(Response after request: + bufferedWebResponse.getText().toString()); if (! handled) { LOGGER.error( NOT HANDLED); //requestCycle.set(new ErrorCodeRequestHandler(HttpServletResponse.SC_NOT_FOUND)); } //requestCycle.detach(); } finally { requestCycle.getResponse().close(); } return bufferedWebResponse.getText().toString(); } -- Stefan Neumann Dipl.-Ing. freiheit.com technologies gmbh Straßenbahnring 22 / 20251 Hamburg, Germany fon +49 (0)40 / 890584-0 fax +49 (0)40 / 890584-20 HRB Hamburg 70814 1CB2 BA3C 168F 0C2B 6005 FC5E 3EBA BCE2 1BF0 21D3 Geschäftsführer: Claudia Dietze, Stefan Richter, Jörg Kirchhof - 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
Re: How to use lazy initialize ModalWindow's Panel
Hi, you can consider to access to checkout order not directly with a variable (i.e. coOrder or checkoutOrder) but using a Wicket IModel. Then you could initialize your panel using onInitialize method, when IModel contains the right CoOrder instance. in WebPage, add modalwindow when page init: modalWindow.setContent(new CheckoutOrderModalWindow(coOrder.getOrderBillNo(), mwCheckout)); CheckoutOrderModalWindow class create code: public class CheckoutOrderModalWindow extends Panel { public CheckoutOrderModalWindow(final CoOrder checkoutOrder, final ModalWindow mwModalWindow) { super(mwModalWindow.getContentId()); if (coOrder.getOrderOnline() == true) { //here throw nullpointexception } } } Because in the page initialization, CoOrder has not been created, thus leading to WebPage initialize null pointer error. If I use ModalWindow with WebPage Mode, will not have this problem. But ModalWindow with WebPage occur in different browser page display problems, WebPage can not get value that changed by ModalWindow's Page. - http://www.517wm.com 外卖订餐分享工具 -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-use-lazy-initialize-ModalWindow-s-Panel-tp3854828p3854828.html Sent from the Users forum mailing list archive at Nabble.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
Re: Redering to to file in wicket1.5
Hey Martin, thanks for the quick response. It sounds quite good, but it is not working yet. Since we use guice, I tried to use the WebApplication we have configured already: final WicketTester wicketTester = new WicketTester(WebApplication.get()); wicketTester.startPage(pageClass,pageParameters); return wicketTester.getLastResponseAsString(); But I get following exception[1]. Some more basic conditions. * A request is currently running. * I need to get session information into the rendering, since the data loading for the page contains authorization checks on the currently logged in user. Any suggestions? Stefan 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:177) ... 37 more Caused by: java.lang.IllegalStateException: Application name can only be set once. at org.apache.wicket.Application.setName(Application.java:846) at org.apache.wicket.util.tester.BaseWicketTester.init(BaseWicketTester.java:291) at org.apache.wicket.util.tester.BaseWicketTester.init(BaseWicketTester.java:241) at org.apache.wicket.util.tester.WicketTester.init(WicketTester.java:192) at com.freiheit.tango.presentation.application.WicketUtils.renderPageWithWicketTester(WicketUtils.java:43) at com.freiheit.tango.presentation.dashboard.DashboardPage.init(DashboardPage.java:124) at com.freiheit.tango.presentation.dashboard.DashboardPage.init(DashboardPage.java:108) at com.freiheit.tango.presentation.dashboard.DashboardPage.init(DashboardPage.java:104) ... 42 more 2011/9/29 Martin Grigorov mgrigo...@apache.org: use WicketTester.startPage() and tester.getLastResponseAsString() On Thu, Sep 29, 2011 at 11:06 AM, Stefan Neumann stefan.neum...@freiheit.com wrote: Hey guys, I need to render a page to a String or file. I have already read the typical reference [1] [2] for this topic. The difference is, that I am using wicket 1.5 and there must be some API changes so I could not use the given examples. Has someone an example? I tried my best to make the exampel compile but i alwas get a NPE at bufferedWebResponse.getText().toString() Appreciate your help in advance, Stefan [1] http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ [2] https://gist.github.com/1152059 [3] public static String renderPage(final Class? extends Page pageClass, final PageParameters pageParameters) { final WebApplication application = WebApplication.get(); final ServletContext context = application.getServletContext(); //fake a request/response cycle final MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); final MockHttpServletRequest servletRequest = new MockHttpServletRequest(application, servletSession, context); final MockHttpServletResponse servletResponse = new MockHttpServletResponse(servletRequest); //initialize request and response servletRequest.initialize(); servletResponse.initialize(); final ServletWebRequest webRequest = new ServletWebRequest(servletRequest,/); final WebResponse webResponse = new ServletWebResponse(webRequest,servletResponse); final BufferedWebResponse bufferedWebResponse = new BufferedWebResponse(webResponse); //webResponse.setAjax(true); final RequestCycle requestCycle = new RequestCycle( new RequestCycleContext(webRequest, webResponse, application.getRootRequestMapper(, application.getExceptionMapperProvider().get())); //requestCycle.setRequestTarget(new BookmarkablePageRequestTarget(pageClass, pageParameters)); requestCycle.setResponsePage(pageClass, pageParameters); try { final boolean handled = requestCycle.processRequestAndDetach(); LOGGER.info(Response after request: + bufferedWebResponse.getText().toString()); if (! handled) { LOGGER.error( NOT HANDLED); //requestCycle.set(new ErrorCodeRequestHandler(HttpServletResponse.SC_NOT_FOUND)); } //requestCycle.detach(); } finally { requestCycle.getResponse().close(); } return bufferedWebResponse.getText().toString(); } -- Stefan
Re: Redering to to file in wicket1.5
I guess I need to add an example of this in wicket-examples ... Please create a ticket to not forget it. Here is how it should work: IRequestHandler handler = new RenderPageRequestHandler(Page.class, parameters); PageReneder renderer = application.getgetPageRendererProvider().get(handler); oldResponse = requestCycle.getResponse(); StringResponse newResponse = new StringResponse(); requestCycle.setResponse(newResponse); renderer.respond(requestCycle); requestCycle.setResponse(oldResponse); pageAsText = newResponse.toString(); On Thu, Sep 29, 2011 at 12:09 PM, Stefan Neumann stefan.neum...@freiheit.com wrote: Hey Martin, thanks for the quick response. It sounds quite good, but it is not working yet. Since we use guice, I tried to use the WebApplication we have configured already: final WicketTester wicketTester = new WicketTester(WebApplication.get()); wicketTester.startPage(pageClass,pageParameters); return wicketTester.getLastResponseAsString(); But I get following exception[1]. Some more basic conditions. * A request is currently running. * I need to get session information into the rendering, since the data loading for the page contains authorization checks on the currently logged in user. Any suggestions? Stefan 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:177) ... 37 more Caused by: java.lang.IllegalStateException: Application name can only be set once. at org.apache.wicket.Application.setName(Application.java:846) at org.apache.wicket.util.tester.BaseWicketTester.init(BaseWicketTester.java:291) at org.apache.wicket.util.tester.BaseWicketTester.init(BaseWicketTester.java:241) at org.apache.wicket.util.tester.WicketTester.init(WicketTester.java:192) at com.freiheit.tango.presentation.application.WicketUtils.renderPageWithWicketTester(WicketUtils.java:43) at com.freiheit.tango.presentation.dashboard.DashboardPage.init(DashboardPage.java:124) at com.freiheit.tango.presentation.dashboard.DashboardPage.init(DashboardPage.java:108) at com.freiheit.tango.presentation.dashboard.DashboardPage.init(DashboardPage.java:104) ... 42 more 2011/9/29 Martin Grigorov mgrigo...@apache.org: use WicketTester.startPage() and tester.getLastResponseAsString() On Thu, Sep 29, 2011 at 11:06 AM, Stefan Neumann stefan.neum...@freiheit.com wrote: Hey guys, I need to render a page to a String or file. I have already read the typical reference [1] [2] for this topic. The difference is, that I am using wicket 1.5 and there must be some API changes so I could not use the given examples. Has someone an example? I tried my best to make the exampel compile but i alwas get a NPE at bufferedWebResponse.getText().toString() Appreciate your help in advance, Stefan [1] http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ [2] https://gist.github.com/1152059 [3] public static String renderPage(final Class? extends Page pageClass, final PageParameters pageParameters) { final WebApplication application = WebApplication.get(); final ServletContext context = application.getServletContext(); //fake a request/response cycle final MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); final MockHttpServletRequest servletRequest = new MockHttpServletRequest(application, servletSession, context); final MockHttpServletResponse servletResponse = new MockHttpServletResponse(servletRequest); //initialize request and response servletRequest.initialize(); servletResponse.initialize(); final ServletWebRequest webRequest = new ServletWebRequest(servletRequest,/); final WebResponse webResponse = new ServletWebResponse(webRequest,servletResponse); final BufferedWebResponse bufferedWebResponse = new BufferedWebResponse(webResponse); //webResponse.setAjax(true); final RequestCycle requestCycle = new RequestCycle( new RequestCycleContext(webRequest, webResponse, application.getRootRequestMapper(, application.getExceptionMapperProvider().get())); //requestCycle.setRequestTarget(new BookmarkablePageRequestTarget(pageClass, pageParameters)); requestCycle.setResponsePage(pageClass, pageParameters); try
Re: Redering to to file in wicket1.5
Hey Martin, I get now a CastException in: Root cause: java.lang.ClassCastException: org.apache.wicket.response.StringResponse cannot be cast to org.apache.wicket.request.http.WebResponse at org.apache.wicket.request.handler.render.WebPageRenderer.redirectTo(WebPageRenderer.java:134) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:214) at com.freiheit.tango.presentation.application.WicketUtils.renderPageNew(WicketUtils.java:54) the corresponing line is: final WebApplication application = WebApplication.get(); final RenderPageRequestHandler handler = new RenderPageRequestHandler(new PageProvider(pageClass, pageParameters)); final PageRenderer pageRenderer = application.getPageRendererProvider().get(handler); final Response oldResponse = requestCycle.getResponse(); final StringResponse newResponse = new StringResponse(); requestCycle.setResponse(newResponse); -- pageRenderer.respond(requestCycle); --- requestCycle.setResponse(oldResponse); return newResponse.toString(); But seems to get closer ;-) I can add the ticket when my case is running. Greetings Stefan 2011/9/29 Martin Grigorov mgrigo...@apache.org: I guess I need to add an example of this in wicket-examples ... Please create a ticket to not forget it. Here is how it should work: IRequestHandler handler = new RenderPageRequestHandler(Page.class, parameters); PageReneder renderer = application.getgetPageRendererProvider().get(handler); oldResponse = requestCycle.getResponse(); StringResponse newResponse = new StringResponse(); requestCycle.setResponse(newResponse); renderer.respond(requestCycle); requestCycle.setResponse(oldResponse); pageAsText = newResponse.toString(); On Thu, Sep 29, 2011 at 12:09 PM, Stefan Neumann stefan.neum...@freiheit.com wrote: Hey Martin, thanks for the quick response. It sounds quite good, but it is not working yet. Since we use guice, I tried to use the WebApplication we have configured already: final WicketTester wicketTester = new WicketTester(WebApplication.get()); wicketTester.startPage(pageClass,pageParameters); return wicketTester.getLastResponseAsString(); But I get following exception[1]. Some more basic conditions. * A request is currently running. * I need to get session information into the rendering, since the data loading for the page contains authorization checks on the currently logged in user. Any suggestions? Stefan 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:177) ... 37 more Caused by: java.lang.IllegalStateException: Application name can only be set once. at org.apache.wicket.Application.setName(Application.java:846) at org.apache.wicket.util.tester.BaseWicketTester.init(BaseWicketTester.java:291) at org.apache.wicket.util.tester.BaseWicketTester.init(BaseWicketTester.java:241) at org.apache.wicket.util.tester.WicketTester.init(WicketTester.java:192) at com.freiheit.tango.presentation.application.WicketUtils.renderPageWithWicketTester(WicketUtils.java:43) at com.freiheit.tango.presentation.dashboard.DashboardPage.init(DashboardPage.java:124) at com.freiheit.tango.presentation.dashboard.DashboardPage.init(DashboardPage.java:108) at com.freiheit.tango.presentation.dashboard.DashboardPage.init(DashboardPage.java:104) ... 42 more 2011/9/29 Martin Grigorov mgrigo...@apache.org: use WicketTester.startPage() and tester.getLastResponseAsString() On Thu, Sep 29, 2011 at 11:06 AM, Stefan Neumann stefan.neum...@freiheit.com wrote: Hey guys, I need to render a page to a String or file. I have already read the typical reference [1] [2] for this topic. The difference is, that I am using wicket 1.5 and there must be some API changes so I could not use the given examples. Has someone an example? I tried my best to make the exampel compile but i alwas get a NPE at bufferedWebResponse.getText().toString() Appreciate your help in advance, Stefan [1] http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ [2] https://gist.github.com/1152059 [3] public static String renderPage(final Class? extends Page pageClass, final PageParameters pageParameters) { final WebApplication application = WebApplication.get(); final ServletContext context =
Re: Redering to to file in wicket1.5
Hey, I tried to use a MockWebRespone: // final StringResponse newResponse = new StringResponse(); final MockWebResponse mockWebResponse = new MockWebResponse(); requestCycle.setResponse(mockWebResponse); pageRenderer.respond(requestCycle); requestCycle.setResponse(oldResponse); return mockWebResponse.getTextResponse().toString(); But the getTextRespone() is null, because there is a redirect to the correct mapped url: print/external-id Can I follow this redirect? 2011/9/29 Stefan Neumann stefan.neum...@freiheit.com: Hey Martin, I get now a CastException in: Root cause: java.lang.ClassCastException: org.apache.wicket.response.StringResponse cannot be cast to org.apache.wicket.request.http.WebResponse at org.apache.wicket.request.handler.render.WebPageRenderer.redirectTo(WebPageRenderer.java:134) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:214) at com.freiheit.tango.presentation.application.WicketUtils.renderPageNew(WicketUtils.java:54) the corresponing line is: final WebApplication application = WebApplication.get(); final RenderPageRequestHandler handler = new RenderPageRequestHandler(new PageProvider(pageClass, pageParameters)); final PageRenderer pageRenderer = application.getPageRendererProvider().get(handler); final Response oldResponse = requestCycle.getResponse(); final StringResponse newResponse = new StringResponse(); requestCycle.setResponse(newResponse); -- pageRenderer.respond(requestCycle); --- requestCycle.setResponse(oldResponse); return newResponse.toString(); But seems to get closer ;-) I can add the ticket when my case is running. Greetings Stefan 2011/9/29 Martin Grigorov mgrigo...@apache.org: I guess I need to add an example of this in wicket-examples ... Please create a ticket to not forget it. Here is how it should work: IRequestHandler handler = new RenderPageRequestHandler(Page.class, parameters); PageReneder renderer = application.getgetPageRendererProvider().get(handler); oldResponse = requestCycle.getResponse(); StringResponse newResponse = new StringResponse(); requestCycle.setResponse(newResponse); renderer.respond(requestCycle); requestCycle.setResponse(oldResponse); pageAsText = newResponse.toString(); On Thu, Sep 29, 2011 at 12:09 PM, Stefan Neumann stefan.neum...@freiheit.com wrote: Hey Martin, thanks for the quick response. It sounds quite good, but it is not working yet. Since we use guice, I tried to use the WebApplication we have configured already: final WicketTester wicketTester = new WicketTester(WebApplication.get()); wicketTester.startPage(pageClass,pageParameters); return wicketTester.getLastResponseAsString(); But I get following exception[1]. Some more basic conditions. * A request is currently running. * I need to get session information into the rendering, since the data loading for the page contains authorization checks on the currently logged in user. Any suggestions? Stefan 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:177) ... 37 more Caused by: java.lang.IllegalStateException: Application name can only be set once. at org.apache.wicket.Application.setName(Application.java:846) at org.apache.wicket.util.tester.BaseWicketTester.init(BaseWicketTester.java:291) at org.apache.wicket.util.tester.BaseWicketTester.init(BaseWicketTester.java:241) at org.apache.wicket.util.tester.WicketTester.init(WicketTester.java:192) at com.freiheit.tango.presentation.application.WicketUtils.renderPageWithWicketTester(WicketUtils.java:43) at com.freiheit.tango.presentation.dashboard.DashboardPage.init(DashboardPage.java:124) at com.freiheit.tango.presentation.dashboard.DashboardPage.init(DashboardPage.java:108) at com.freiheit.tango.presentation.dashboard.DashboardPage.init(DashboardPage.java:104) ... 42 more 2011/9/29 Martin Grigorov mgrigo...@apache.org: use WicketTester.startPage() and tester.getLastResponseAsString() On Thu, Sep 29, 2011 at 11:06 AM, Stefan Neumann stefan.neum...@freiheit.com wrote: Hey guys, I need to render a page to a String or file. I have already read the typical reference [1] [2] for this topic. The difference is, that I am using wicket 1.5 and there must be some API changes so I could
RuntimeException when a stateless page throws a 404 which is also handled by wicket
We have the following situation: The wicket filter is configured to handle 404 responses (by a page mounted at /404), this is set in web.xml; We have a stateless (product) page at /shop/product, which contains a Stateless form which offers the customer the possibility to order. Some crawlers have apparently indexed the form's action url, eg: /shop/product/1671/california-sun?wicket:interface=:0:orderform::IFormSubmitListener:: Now in the constructor of the product page we check if the product exists and is visible. If not, we throw a new AbortWithWebErrorCodeException( 404 ); This leads to a runtime exception in some cases: WicketMessage: unable to find component with path orderform on stateless page [Page class = com.x.y.z.Error404Page, id = 0, version = 0] it could be that the component is inside a repeater make your component return false in getStatelessHint() It appears that wicket (1.4.3 in this case) handles the 404, and then tries to resolve the component path, which is no longer valid, since we are on the 404 page. Any ideas how to fix this? We don't want to redirect to another page, it's important that we send a 404 + friendly page when the product cannot be shown. Sebastian
Re: Redering to to file in wicket1.5
Use org.apache.wicket.request.handler.RenderPageRequestHandler.RenderPageRequestHandler(IPageProvider, RedirectPolicy) with org.apache.wicket.request.handler.RenderPageRequestHandler.RedirectPolicy.NEVER_REDIRECT On Thu, Sep 29, 2011 at 2:01 PM, Stefan Neumann stefan.neum...@freiheit.com wrote: Hey, I tried to use a MockWebRespone: // final StringResponse newResponse = new StringResponse(); final MockWebResponse mockWebResponse = new MockWebResponse(); requestCycle.setResponse(mockWebResponse); pageRenderer.respond(requestCycle); requestCycle.setResponse(oldResponse); return mockWebResponse.getTextResponse().toString(); But the getTextRespone() is null, because there is a redirect to the correct mapped url: print/external-id Can I follow this redirect? 2011/9/29 Stefan Neumann stefan.neum...@freiheit.com: Hey Martin, I get now a CastException in: Root cause: java.lang.ClassCastException: org.apache.wicket.response.StringResponse cannot be cast to org.apache.wicket.request.http.WebResponse at org.apache.wicket.request.handler.render.WebPageRenderer.redirectTo(WebPageRenderer.java:134) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:214) at com.freiheit.tango.presentation.application.WicketUtils.renderPageNew(WicketUtils.java:54) the corresponing line is: final WebApplication application = WebApplication.get(); final RenderPageRequestHandler handler = new RenderPageRequestHandler(new PageProvider(pageClass, pageParameters)); final PageRenderer pageRenderer = application.getPageRendererProvider().get(handler); final Response oldResponse = requestCycle.getResponse(); final StringResponse newResponse = new StringResponse(); requestCycle.setResponse(newResponse); -- pageRenderer.respond(requestCycle); --- requestCycle.setResponse(oldResponse); return newResponse.toString(); But seems to get closer ;-) I can add the ticket when my case is running. Greetings Stefan 2011/9/29 Martin Grigorov mgrigo...@apache.org: I guess I need to add an example of this in wicket-examples ... Please create a ticket to not forget it. Here is how it should work: IRequestHandler handler = new RenderPageRequestHandler(Page.class, parameters); PageReneder renderer = application.getgetPageRendererProvider().get(handler); oldResponse = requestCycle.getResponse(); StringResponse newResponse = new StringResponse(); requestCycle.setResponse(newResponse); renderer.respond(requestCycle); requestCycle.setResponse(oldResponse); pageAsText = newResponse.toString(); On Thu, Sep 29, 2011 at 12:09 PM, Stefan Neumann stefan.neum...@freiheit.com wrote: Hey Martin, thanks for the quick response. It sounds quite good, but it is not working yet. Since we use guice, I tried to use the WebApplication we have configured already: final WicketTester wicketTester = new WicketTester(WebApplication.get()); wicketTester.startPage(pageClass,pageParameters); return wicketTester.getLastResponseAsString(); But I get following exception[1]. Some more basic conditions. * A request is currently running. * I need to get session information into the rendering, since the data loading for the page contains authorization checks on the currently logged in user. Any suggestions? Stefan 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:177) ... 37 more Caused by: java.lang.IllegalStateException: Application name can only be set once. at org.apache.wicket.Application.setName(Application.java:846) at org.apache.wicket.util.tester.BaseWicketTester.init(BaseWicketTester.java:291) at org.apache.wicket.util.tester.BaseWicketTester.init(BaseWicketTester.java:241) at org.apache.wicket.util.tester.WicketTester.init(WicketTester.java:192) at com.freiheit.tango.presentation.application.WicketUtils.renderPageWithWicketTester(WicketUtils.java:43) at com.freiheit.tango.presentation.dashboard.DashboardPage.init(DashboardPage.java:124) at com.freiheit.tango.presentation.dashboard.DashboardPage.init(DashboardPage.java:108) at com.freiheit.tango.presentation.dashboard.DashboardPage.init(DashboardPage.java:104) ... 42 more 2011/9/29 Martin Grigorov mgrigo...@apache.org: use WicketTester.startPage() and tester.getLastResponseAsString()
Re: PageFactory and SessionSettings
I still don't understand why within the BaseWicketTester#processRequest() method the PageProvider#getPageInstance() method is called twice. The first time the correct page instance is returned, the second time not. I assume, this has to do with some kind of redirection of the same page. The lastResponse.isRedirect() returns true and therefore the processRequest() method ist called a second time forcing a redirect. ... if (!requestCycle.processRequestAndDetach()) { return false; } recordRequestResponse(); setupNextRequestCycle(); if (followRedirects lastResponse.isRedirect()) { ... processRequest(null, null, true); --redirectCount; } return true; ... This is strange to me. Meanwhile I figured out, that the respond()-method of the WebPageRenderer.class triggers the redirectTo(targetUrl, requestCycle) method which sets the redirectLocation attribute of the MockHttpServletResponse. After adding page.setWasCreatedBookmarkable(true) to our own PageFactory implementation all tests work as espected. So what is this flag for? Why does this flag change the process of the request handling in this manner? Can someone give me some clarification about this? Thank you. /** * TODO WICKET-NG javadoc * * @param wasCreatedBookmarkable */ public final void setWasCreatedBookmarkable(boolean wasCreatedBookmarkable) { setFlag(FLAG_WAS_CREATED_BOOKMARKABLE, wasCreatedBookmarkable); } Am 29.09.2011 09:40, schrieb Martin Grigorov-4 [via Apache Wicket]: Put a breakpoint in your factory and see what it returns and why PageProvider believes it is null ... On Thu, Sep 29, 2011 at 9:34 AM, Dirk Forchel [hidden email] /user/SendEmail.jtp?type=nodenode=3854689i=0 wrote: Hi Martin, thank you for your quick response ... indeed I have another problem too ... In our own BookmarkablePageFactoryTest I set up now the test environment the following way ... @Before public void setUp() { // see issue https://issues.apache.org/jira/browse/WICKET-4093 tester = new WicketTester(new MockApplication() { protected IPageFactory newPageFactory() { return new BookmarkablePageFactory( linkFactory ); } }); ConverterLocator converterLocator = (ConverterLocator)tester.getApplication().getConverterLocator(); converterLocator.set( DummyData.class, new DummyDataConverter() ); } and test a page with one named parameter ... @Test public void oneParameter() { PageParameters params = new PageParameters(); params.set(data, ~~abc~~); tester.startPage( OneParameterPage.class, params); tester.isRenderedPage( OneParameterPage.class ); assertInfoMessages( tester, OneParameterPage(abc) ); Assert.assertEquals( 200, tester.getLastResponse().getStatus() ); } But this test (and other tests as well) are not working anymore (as it was with Wicket 1.4). I've got always a PageExpiredException although the Page is really created and returned within our own PageFactory implementation. Additional I've dumped the stack trace for getting a hint where the method is called ... @Override public final C extends IRequestablePage IRequestablePage newPage(final ClassC pageClass, final PageParameters pageParameters) { System.out.println( newPage Class +pageClass+ PageParameters +pageParameters); Thread.dumpStack(); ... IRequestablePage page = createPage( constructor, arguments ); System.out.println( created page +page); return page; } This is the stack trace: newPage Class class com.exedio.wig.bookmark.dummy.OneParameterPage PageParameters data=[~~abc~~] java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Unknown Source) at com.exedio.wig.bookmark.BookmarkablePageFactory.newPage(BookmarkablePageFactory.java:80) at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:107) at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:273) at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:167) at org.apache.wicket.util.tester.BaseWicketTester$LastPageRecordingPageRendererProvider.get(BaseWicketTester.java:2514) at org.apache.wicket.util.tester.BaseWicketTester$LastPageRecordingPageRendererProvider.get(BaseWicketTester.java:2501) at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:146) at
Re: Palette select the data with one click
I used the AjaxFormChoiceComponentUpdatingBehavior in the palette but, it works with the method onchange and the method click does not work. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Palette-select-the-data-with-one-click-tp3839870p3855729.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Redering to to file in wicket1.5
Perfect. It works. Even though I don't need it, I just have a hint for all, who want to use it as well, It seems not to work in a constructor of a page. I created the issue for the wicket-examples: https://issues.apache.org/jira/browse/WICKET-4095 You will find a working code snipplet as well. thanks a lot! Stefan 2011/9/29 Martin Grigorov mgrigo...@apache.org: Use org.apache.wicket.request.handler.RenderPageRequestHandler.RenderPageRequestHandler(IPageProvider, RedirectPolicy) with org.apache.wicket.request.handler.RenderPageRequestHandler.RedirectPolicy.NEVER_REDIRECT On Thu, Sep 29, 2011 at 2:01 PM, Stefan Neumann stefan.neum...@freiheit.com wrote: Hey, I tried to use a MockWebRespone: // final StringResponse newResponse = new StringResponse(); final MockWebResponse mockWebResponse = new MockWebResponse(); requestCycle.setResponse(mockWebResponse); pageRenderer.respond(requestCycle); requestCycle.setResponse(oldResponse); return mockWebResponse.getTextResponse().toString(); But the getTextRespone() is null, because there is a redirect to the correct mapped url: print/external-id Can I follow this redirect? 2011/9/29 Stefan Neumann stefan.neum...@freiheit.com: Hey Martin, I get now a CastException in: Root cause: java.lang.ClassCastException: org.apache.wicket.response.StringResponse cannot be cast to org.apache.wicket.request.http.WebResponse at org.apache.wicket.request.handler.render.WebPageRenderer.redirectTo(WebPageRenderer.java:134) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:214) at com.freiheit.tango.presentation.application.WicketUtils.renderPageNew(WicketUtils.java:54) the corresponing line is: final WebApplication application = WebApplication.get(); final RenderPageRequestHandler handler = new RenderPageRequestHandler(new PageProvider(pageClass, pageParameters)); final PageRenderer pageRenderer = application.getPageRendererProvider().get(handler); final Response oldResponse = requestCycle.getResponse(); final StringResponse newResponse = new StringResponse(); requestCycle.setResponse(newResponse); -- pageRenderer.respond(requestCycle); --- requestCycle.setResponse(oldResponse); return newResponse.toString(); But seems to get closer ;-) I can add the ticket when my case is running. Greetings Stefan 2011/9/29 Martin Grigorov mgrigo...@apache.org: I guess I need to add an example of this in wicket-examples ... Please create a ticket to not forget it. Here is how it should work: IRequestHandler handler = new RenderPageRequestHandler(Page.class, parameters); PageReneder renderer = application.getgetPageRendererProvider().get(handler); oldResponse = requestCycle.getResponse(); StringResponse newResponse = new StringResponse(); requestCycle.setResponse(newResponse); renderer.respond(requestCycle); requestCycle.setResponse(oldResponse); pageAsText = newResponse.toString(); On Thu, Sep 29, 2011 at 12:09 PM, Stefan Neumann stefan.neum...@freiheit.com wrote: Hey Martin, thanks for the quick response. It sounds quite good, but it is not working yet. Since we use guice, I tried to use the WebApplication we have configured already: final WicketTester wicketTester = new WicketTester(WebApplication.get()); wicketTester.startPage(pageClass,pageParameters); return wicketTester.getLastResponseAsString(); But I get following exception[1]. Some more basic conditions. * A request is currently running. * I need to get session information into the rendering, since the data loading for the page contains authorization checks on the currently logged in user. Any suggestions? Stefan 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:177) ... 37 more Caused by: java.lang.IllegalStateException: Application name can only be set once. at org.apache.wicket.Application.setName(Application.java:846) at org.apache.wicket.util.tester.BaseWicketTester.init(BaseWicketTester.java:291) at org.apache.wicket.util.tester.BaseWicketTester.init(BaseWicketTester.java:241) at org.apache.wicket.util.tester.WicketTester.init(WicketTester.java:192) at com.freiheit.tango.presentation.application.WicketUtils.renderPageWithWicketTester(WicketUtils.java:43) at
Re: Redering to to file in wicket1.5
On Thu, Sep 29, 2011 at 4:18 PM, Stefan Neumann stefan.neum...@freiheit.com wrote: Perfect. It works. Even though I don't need it, I just have a hint for all, who want to use it as well, It seems not to work in a constructor of a page. I created the issue for the wicket-examples: https://issues.apache.org/jira/browse/WICKET-4095 You will find a working code snipplet as well. cool. thanks ! thanks a lot! Stefan 2011/9/29 Martin Grigorov mgrigo...@apache.org: Use org.apache.wicket.request.handler.RenderPageRequestHandler.RenderPageRequestHandler(IPageProvider, RedirectPolicy) with org.apache.wicket.request.handler.RenderPageRequestHandler.RedirectPolicy.NEVER_REDIRECT On Thu, Sep 29, 2011 at 2:01 PM, Stefan Neumann stefan.neum...@freiheit.com wrote: Hey, I tried to use a MockWebRespone: // final StringResponse newResponse = new StringResponse(); final MockWebResponse mockWebResponse = new MockWebResponse(); requestCycle.setResponse(mockWebResponse); pageRenderer.respond(requestCycle); requestCycle.setResponse(oldResponse); return mockWebResponse.getTextResponse().toString(); But the getTextRespone() is null, because there is a redirect to the correct mapped url: print/external-id Can I follow this redirect? 2011/9/29 Stefan Neumann stefan.neum...@freiheit.com: Hey Martin, I get now a CastException in: Root cause: java.lang.ClassCastException: org.apache.wicket.response.StringResponse cannot be cast to org.apache.wicket.request.http.WebResponse at org.apache.wicket.request.handler.render.WebPageRenderer.redirectTo(WebPageRenderer.java:134) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:214) at com.freiheit.tango.presentation.application.WicketUtils.renderPageNew(WicketUtils.java:54) the corresponing line is: final WebApplication application = WebApplication.get(); final RenderPageRequestHandler handler = new RenderPageRequestHandler(new PageProvider(pageClass, pageParameters)); final PageRenderer pageRenderer = application.getPageRendererProvider().get(handler); final Response oldResponse = requestCycle.getResponse(); final StringResponse newResponse = new StringResponse(); requestCycle.setResponse(newResponse); -- pageRenderer.respond(requestCycle); --- requestCycle.setResponse(oldResponse); return newResponse.toString(); But seems to get closer ;-) I can add the ticket when my case is running. Greetings Stefan 2011/9/29 Martin Grigorov mgrigo...@apache.org: I guess I need to add an example of this in wicket-examples ... Please create a ticket to not forget it. Here is how it should work: IRequestHandler handler = new RenderPageRequestHandler(Page.class, parameters); PageReneder renderer = application.getgetPageRendererProvider().get(handler); oldResponse = requestCycle.getResponse(); StringResponse newResponse = new StringResponse(); requestCycle.setResponse(newResponse); renderer.respond(requestCycle); requestCycle.setResponse(oldResponse); pageAsText = newResponse.toString(); On Thu, Sep 29, 2011 at 12:09 PM, Stefan Neumann stefan.neum...@freiheit.com wrote: Hey Martin, thanks for the quick response. It sounds quite good, but it is not working yet. Since we use guice, I tried to use the WebApplication we have configured already: final WicketTester wicketTester = new WicketTester(WebApplication.get()); wicketTester.startPage(pageClass,pageParameters); return wicketTester.getLastResponseAsString(); But I get following exception[1]. Some more basic conditions. * A request is currently running. * I need to get session information into the rendering, since the data loading for the page contains authorization checks on the currently logged in user. Any suggestions? Stefan 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:177) ... 37 more Caused by: java.lang.IllegalStateException: Application name can only be set once. at org.apache.wicket.Application.setName(Application.java:846) at org.apache.wicket.util.tester.BaseWicketTester.init(BaseWicketTester.java:291) at org.apache.wicket.util.tester.BaseWicketTester.init(BaseWicketTester.java:241) at org.apache.wicket.util.tester.WicketTester.init(WicketTester.java:192) at
Detect dirty text field
Hi, I have a behavior that changes the background color of a TextField if the user presses any keys. It does this by changing the className in the dom. This works fine but the problem I have is that when I have a form that submits via Ajax I need to remove the added className. Currently if I override Form.onSubmit and check the RequestCycle.get().getRequestTarget() to see if it is Ajax then I can call appendJavascript. That is messy and the logic is not all contained in my behavior. Any ideas would be greatly appreciated. Thanks, Josh -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Detect-dirty-text-field-tp3856096p3856096.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: pretty strange behavior with TextArea containing remaining output html code inside
wicket can be used for any xml-based markup, not just html... -igor On Thu, Sep 29, 2011 at 1:16 AM, Martin Grigorov mgrigo...@apache.org wrote: Wicket uses (custom) XML parser when loading the HTML. textarea/ is a valid xml and thus it doesn't fail. HTML validator is a dirty job because different browsers implement the specs differently ... :-/ On Thu, Sep 29, 2011 at 10:02 AM, manuelbarzi manuelba...@gmail.com wrote: Wicket doesn't act as (X)HTML validator. It never did. but if you forget some closing tag, /tr for instance, you might be sure it will complain... then why not validating other tags too, and fully validate (x)html. On Thu, Sep 29, 2011 at 9:56 AM, Martin Grigorov mgrigo...@apache.org wrote: Wicket doesn't act as (X)HTML validator. It never did. You may use https://github.com/dashorst/wicket-stuff-markup-validator for that On Thu, Sep 29, 2011 at 9:53 AM, manuelbarzi manuelba...@gmail.com wrote: sure, as you may have read, i already tested on wicket 1.5.0 and renders ok. but from the point of view of validation, a textarea cannot be a single-closed tag, is an illegal code, as it goes against the spec (igor). On Thu, Sep 29, 2011 at 9:49 AM, Martin Grigorov mgrigo...@apache.org wrote: This is improved in 1.5.0. We expand some HTML elements from name/ to name/name You are recommended to upgrade. On Thu, Sep 29, 2011 at 9:44 AM, manuelbarzi manuelba...@gmail.com wrote: tested on wicket 1.5.0 and paradoxically a single-closed textarea tag does validate as legal too, like in wicket 1.4.17/18, and renders correctly, contrary to wicket 1.4.17/18. issue https://issues.apache.org/jira/browse/WICKET-4094 On Wed, Sep 28, 2011 at 7:30 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: file a jira issue -igor On Wed, Sep 28, 2011 at 9:52 AM, manuelbarzi manuelba...@gmail.com wrote: right. may wicket html validation complain in future version for this particular case. low priority issue... . On Wed, Sep 28, 2011 at 6:42 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: per html spec textarea must have a closing tag... -igor On Wed, Sep 28, 2011 at 9:25 AM, manuelbarzi manuelba...@gmail.com wrote: TextArea is one-self-closed tag .../. should TextArea two-opening-closing tags ../... work fine. On Wed, Sep 28, 2011 at 6:18 PM, manuelbarzi manuelba...@gmail.com wrote: this error happens on this simple composite (wicket 1.4.17): Page |-Panel |-Form |-TextField |-TextField |-TextArea |-TextField |-TextField |-Button |-Button when just rendering this simple page (no logic implemented yet), the output html (reviewed on chrome and ie) renders ok until the TextArea, and then, inside the TextArea content (visible text), there's all the remaining of the output markup! switching TextArea to a simple TextField does render ok. known bug? - 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 - 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 - 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 -- 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 -- Martin Grigorov jWeekend Training, Consulting, Development
Wicket 1.5.1 released
This is the first maintenance release of the Wicket 1.5.x series. This release brings over 40 bug fixes and 15 improvements. Subversion tag http://svn.apache.org/repos/asf/wicket/releases/wicket-1.5.1 Changelog https://issues.apache.org/jira/secure/ReleaseNote.jspa?version=12315430projectId=12310561 To use in Maven: dependency groupIdorg.apache.wicket/groupId artifactIdwicket-core/artifactId version1.5.1/version /dependency Download the full distribution http://www.apache.org/dyn/closer.cgi/wicket/1.5.1 (including source) The Wicket Team - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Detect dirty text field
you can do all this clientside, add an onsubmit listener to the form and clear out the class... -igor On Thu, Sep 29, 2011 at 7:55 AM, jchappelle jchappe...@4redi.com wrote: Hi, I have a behavior that changes the background color of a TextField if the user presses any keys. It does this by changing the className in the dom. This works fine but the problem I have is that when I have a form that submits via Ajax I need to remove the added className. Currently if I override Form.onSubmit and check the RequestCycle.get().getRequestTarget() to see if it is Ajax then I can call appendJavascript. That is messy and the logic is not all contained in my behavior. Any ideas would be greatly appreciated. Thanks, Josh -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Detect-dirty-text-field-tp3856096p3856096.html Sent from the Users forum mailing list archive at Nabble.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
Re: Can we extend Wicket Filter
On Thu, Sep 29, 2011 at 9:09 AM, donx...@yahoo.com donx...@yahoo.com wrote: I am new to Wicket. I have two questions about filter: 1. Can use Servlet Filter with Wicket Application? yes, you can put one before or after 2. If not, can I extend Wicket Filter to handle some logic? what kind of logic are you looking to handle? -igor Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Can-we-extend-Wicket-Filter-tp3856466p3856466.html Sent from the Users forum mailing list archive at Nabble.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
Re: Can we extend Wicket Filter
I need to handle session related logic. Currently the application allow same user to create second session if the user login in another machine or try to login again in different browser. Basically I want to kill the first session. If user go back to machine with first session open it will tell user the session is not active. It also redirect the user to login page if the user click and url that is handled by Ajax. Any suggestions? Thanks in advance. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Can-we-extend-Wicket-Filter-tp3856466p3857615.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Can we extend Wicket Filter
use whatever mechanism you want to set the stale bit on the http session. then use an irequestcyclelistener#onbeginrequest() and call requestcycle.replaceall requesthandlers(new renderpagerequesthandler(new pageprovider(new mystalesessionpage(); -igor On Thu, Sep 29, 2011 at 1:48 PM, donx...@yahoo.com donx...@yahoo.com wrote: I need to handle session related logic. Currently the application allow same user to create second session if the user login in another machine or try to login again in different browser. Basically I want to kill the first session. If user go back to machine with first session open it will tell user the session is not active. It also redirect the user to login page if the user click and url that is handled by Ajax. Any suggestions? Thanks in advance. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Can-we-extend-Wicket-Filter-tp3856466p3857615.html Sent from the Users forum mailing list archive at Nabble.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
Can I use Servlet Filer in Wicket Application
Currently, our application allow user login in different machines. As a result two sessions are created. I killed the first session when user login the second time. The problem is when user go back to first machine some link are still working even though the session is being killed. I need a Filter to check the session and redirect the user to error page if the session is not active. I know using Servlet Filer can finish this job. My question is can Servlet Filter apply to Wicket application. Can I use Wicket Filter to do this job. Thanks in advance -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Can-I-use-Servlet-Filer-in-Wicket-Application-tp3856309p3856309.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Can I use Servlet Filer in Wicket Application
Filters are applied in the filter chain, in the order they're defined in the web.xml It's up to you how to set the order - I don't think wicket has to do anything here. Just make sure that your servlet filter is before wicket filter in the web.xml and it should do the job just fine, unless you have some fancy session management in wicket too :) Regards Žilvinas Vilutis Mobile: (+1) 623 330 6048 E-mail: cika...@gmail.com On Thu, Sep 29, 2011 at 8:36 AM, donx...@yahoo.com donx...@yahoo.com wrote: Currently, our application allow user login in different machines. As a result two sessions are created. I killed the first session when user login the second time. The problem is when user go back to first machine some link are still working even though the session is being killed. I need a Filter to check the session and redirect the user to error page if the session is not active. I know using Servlet Filer can finish this job. My question is can Servlet Filter apply to Wicket application. Can I use Wicket Filter to do this job. Thanks in advance -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Can-I-use-Servlet-Filer-in-Wicket-Application-tp3856309p3856309.html Sent from the Users forum mailing list archive at Nabble.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