Re: Best practice for custom page renderer
Doing more investigations I found that the problem is gathering the extended browser info. Omitting that, BrowserInfoPage is stateless. Sorry for the noise. Regards Alberto On Thu, 2019-02-28 at 11:06 +0100, Alberto Brosich wrote: > On Thu, 2019-02-28 at 01:50 -0800, Bas Gooren wrote: > > Hi! > > > > We have many stateless pages in our apps (public-facing, indexed, > > e- > > commerce websites), and use the default render strategy provided by > > wicket. > > When a page is stateless, wicket does not redirect. > > > > Are you sure your pages are stateless? > > Yes, I am sure. > The problem could be that I'm using ClientInfo to collect info about > clients for analytics purposes. It uses BrowserInfoPage that is > stateful. For that reason I checked it in isOnePassRender() method. > > Is there a way to convert BrowserInfoPage to stateless? > For example every page I create has a form to submit a search but I > used a StatelessForm for that, therefore if a page does not contain > any > other stateful components or behaviors, it is stateless. > > Best regards > > Alberto > > Met vriendelijke groet, > > Kind regards, > > > > Bas Gooren > > > > Op 28 februari 2019 bij 10:48:25, Alberto Brosich ( > > abros...@inogs.it) > > schreef: > > > Hello, > > > > > > I didn't find any useful information about that in the > > > documentation. > > > > > > For some reasons (e.g. search engine bots or clients unable to > > > follow > > > redirects) on some pages I would like to have an http 200 > > > response. > > > By > > > default Wicket uses REDIRECT_TO_BUFFER render strategy that send > > > a > > > 302 > > > redirect first. > > > > > > Which is the best practice for use ONE_PASS_RENDER strategy? > > > > > > Is it reasonable to adopt ONE_PASS_RENDER for all stateless pages > > > or is > > > it better to change the render strategy only for specific pages? > > > > > > Is setPageRendererProvider() the good place where to handle > > > that? > > > > > > For example: > > > > > > setPageRendererProvider( new IPageRendererProvider() { > > > > > > @Override > > > public PageRenderer apply(RenderPageRequestHandler handler) { > > > br/> return new WebPageRenderer(handler) {{ > > > br/> @@Override > > > protected boolean isOnePassRender() { > > > br/> IRequestablePage page = > > > getRenderPageRequestHandler().getPage(); > > > > > > return page.isPageStateless() || > > > page instanceof BrowserInfoPage || super.isOnePassRender(); > > > } > > > }; > > > } > > > }); > > > > > > I' working with wicket version 8.3.0. > > > > > > Best regards > > > > > > Alberto > > > > > > > > > - > > > > > > 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: Best practice for custom page renderer
On Thu, 2019-02-28 at 01:50 -0800, Bas Gooren wrote: > Hi! > > We have many stateless pages in our apps (public-facing, indexed, e- > commerce websites), and use the default render strategy provided by > wicket. > When a page is stateless, wicket does not redirect. > > Are you sure your pages are stateless? Yes, I am sure. The problem could be that I'm using ClientInfo to collect info about clients for analytics purposes. It uses BrowserInfoPage that is stateful. For that reason I checked it in isOnePassRender() method. Is there a way to convert BrowserInfoPage to stateless? For example every page I create has a form to submit a search but I used a StatelessForm for that, therefore if a page does not contain any other stateful components or behaviors, it is stateless. Best regards Alberto > > Met vriendelijke groet, > Kind regards, > > Bas Gooren > > Op 28 februari 2019 bij 10:48:25, Alberto Brosich (abros...@inogs.it) > schreef: > > Hello, > > > > I didn't find any useful information about that in the > > documentation. > > > > For some reasons (e.g. search engine bots or clients unable to > > follow > > redirects) on some pages I would like to have an http 200 response. > > By > > default Wicket uses REDIRECT_TO_BUFFER render strategy that send a > > 302 > > redirect first. > > > > Which is the best practice for use ONE_PASS_RENDER strategy? > > > > Is it reasonable to adopt ONE_PASS_RENDER for all stateless pages > > or is > > it better to change the render strategy only for specific pages? > > > > Is setPageRendererProvider() the good place where to handle that? > > > > For example: > > > > setPageRendererProvider( new IPageRendererProvider() { > > > > @Override > > public PageRenderer apply(RenderPageRequestHandler handler) { > > br/> return new WebPageRenderer(handler) {{ > > br/> @@Override > > protected boolean isOnePassRender() { > > br/> IRequestablePage page = > > getRenderPageRequestHandler().getPage(); > > > > return page.isPageStateless() || > > page instanceof BrowserInfoPage || super.isOnePassRender(); > > } > > }; > > } > > }); > > > > I' working with wicket version 8.3.0. > > > > Best regards > > > > Alberto > > > > > > - > > > > 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
Best practice for custom page renderer
Hello, I didn't find any useful information about that in the documentation. For some reasons (e.g. search engine bots or clients unable to follow redirects) on some pages I would like to have an http 200 response. By default Wicket uses REDIRECT_TO_BUFFER render strategy that send a 302 redirect first. Which is the best practice for use ONE_PASS_RENDER strategy? Is it reasonable to adopt ONE_PASS_RENDER for all stateless pages or is it better to change the render strategy only for specific pages? Is setPageRendererProvider() the good place where to handle that? For example: setPageRendererProvider( new IPageRendererProvider() { @Override public PageRenderer apply(RenderPageRequestHandler handler) { return new WebPageRenderer(handler) { @Override protected boolean isOnePassRender() { IRequestablePage page = getRenderPageRequestHandler().getPage(); return page.isPageStateless() || page instanceof BrowserInfoPage || super.isOnePassRender(); } }; } }); I' working with wicket version 8.3.0. Best regards Alberto - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Custom type for
Hello, I need to put a script tag in the header with a custom type ("application/ld+json"). I used JavaScriptHeaderItem and it put "text/javascript" as type attribute and it seems it's not possible to set it. Also other HeaderItem classes do not help. Any suggest? Best regards Alberto Wicket version 8.0.0 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Override getStatelessHiint for InlineFrame
Hello, I have a page containing an InlineFrame component. This page should be stateless because the content of InlineFrame never change. Is it a good practice override getStatelessHint() method of InlineFrame component? Best regards Alberto - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: PropertyListView without inner component
On Thu, 2017-09-21 at 21:06 +0200, Sven Meier wrote: > Hi, > > as an alternative you can use a RepeatingView, it allows you to > repeat > markup for children without additional Item containers. Yes, but it doesn't work with lists. I have to add items manually, isn't it? Thanks Alberto > > Have fun > Sven > > > Am 21.09.2017 um 11:52 schrieb Alberto Brosich: > > Hello, > > > > I have a PropertyListView in a page with a CompoundPropertyModel on > > a > > JAXB generated class. > > > > I have simply to repeat a "" element. > > > > I found two solutions: > > - using an outer > > element; > > - using an inner element with > > setRenderBodyOnly(true). > > > > ex. > > > > queue(new PropertyListView("titles.title") { > > > > @Override > > protected void populateItem(ListItem item) { > > item.queue(new Label("value")); > > } > > }); > > > > "value" is the property of the model but I would not have an inner > > tag > > with that wicket:id. > > > > Is it possible? > > > > Regards > > > > Alberto > > > > > > > > - > > > > 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
PropertyListView without inner component
Hello, I have a PropertyListView in a page with a CompoundPropertyModel on a JAXB generated class. I have simply to repeat a "" element. I found two solutions: - using an outer element; - using an inner element with setRenderBodyOnly(true). ex. queue(new PropertyListView("titles.title") { @Override protected void populateItem(ListItem item) { item.queue(new Label("value")); } }); "value" is the property of the model but I would not have an inner tag with that wicket:id. Is it possible? Regards Alberto - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Custom http error pages
On Wed, 2014-09-10 at 11:21 +0300, Martin Grigorov wrote: > Hi, > > Instead of throwing AbortWithHttpErrorCodeException you can just use > RestartResponseException/setResponsePage(). > But using the standard way (web.xml) should be fine too. I think the > message set by #setError(code, message) is stored as request attribute. > Hi Martin, I used the second one and it works fine. Many thanks Alberto > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > > On Wed, Sep 10, 2014 at 11:09 AM, Alberto Brosich > wrote: > > > > > Hi, > > > > I'm using the latest version of wicket. > > I'm trying to write custom pages for http errors. The standard way, > > using web.xml, is not useful for me because I would print custom > > messages too. > > I tried to write a RequestCycleListener extending > > AbstractRequestCycleListener class, but it seems that > > AbortWithHttpErrorCodeException exceptions do not trigger onException > > method of the listener or they have been already consumed. > > > > Which are the best way to do that? > > > > Best regards. > > > > Alberto > > > > > > - > > 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
Custom http error pages
Hi, I'm using the latest version of wicket. I'm trying to write custom pages for http errors. The standard way, using web.xml, is not useful for me because I would print custom messages too. I tried to write a RequestCycleListener extending AbstractRequestCycleListener class, but it seems that AbortWithHttpErrorCodeException exceptions do not trigger onException method of the listener or they have been already consumed. Which are the best way to do that? Best regards. Alberto - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
onInitialize() and exception handling
Hi, I have a wicket application where I create page components (mainly labels and ListViews) using onInitialize() method of some panels I have in every page. In some cases, during the creation of the components, some exceptions can occur (for example if the content is downloaded from a webservice that returns error 404), and I would propagate it, but onInitialize() of Panel does not throw exceptions. So my questions are: which are the best practices to deal that cases? Is onInitialize() the best place where create components? Regards Alberto - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Best practices with subclassing and subpackaging
Hi, I have an application with several pages, mounted in webapplication, that do not have markup file associated. The markup file is selected using variations in the parent class. I would like to split pages in subpackages but if I move the markup file (ParentPageClass_variation.html) in the subpackages too, it doesn't work, obviously. So, some questions. Is it a good practice in wicket this kind of subclassing? Is there a way to override the resolving of the markup filename? I took a look to the apidocs without success. Best regards Alberto - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Does wicket:link tag work inside pages in different packages?
Yes, you are right. I will do in that way. The fact is I have a similar problem with some menu panels with several links. I just wanted to do the easiest thing. Now I have another problem with subclasses and subpackages but I will send a new mail to the list with another topic. Many thanks Alberto On Sun, 2014-03-02 at 13:57 -0500, Paul Bors wrote: > Instead of using in-line why not use a > and then add(new Link(“homePage”, HomePage.class)); to your parent class? > That will resolve no matter where its used from. > > After all is just a Link class at the end of the day. > Also see the examples page: > http://www.wicket-library.com/wicket-examples/linkomatic/home > > > On Feb 27, 2014, at 11:03 AM, Alberto Brosich wrote: > > > > > Yes, I read it. > > Does it mean that have to do a different header panel for every > > suppages level (using "../(../)HomePage.html" link)? > > > > Alberto > > > > > > On Thu, 2014-02-27 at 16:30 +0100, Sven Meier wrote: > >> Have you read http://wicket.apache.org/guide/guide/urls.html#urls_3 > >> ? > >> > >> Sven > >> > >> On 02/27/2014 03:44 PM, Alberto Brosich wrote: > >>> Hi, > >>> > >>> I have an header panel with a link to the homepage of the site. > >>> This panel is included in every page of the site. > >>> If I use the tag for that link it works fine (for example, > >>> it is disabled in the homepage) for the pages in the same package of the > >>> Homepage class. > >>> If I am on a page inside another package (subpackage in my case) the > >>> link became the name of that package plus the href specified in the html > >>> panel. For example: > >>> > >>> ... > >>> > >>> In a page inside package "subpackage" the link is: > >>> "subpackage/HomePage.html" and not "../". > >>> > >>> What I'm doing wrong? > >>> > >>> Regards > >>> > >>> Alberto > >>> > >>> > >>> - > >>> 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: Does wicket:link tag work inside pages in different packages?
Yes, I read it. Does it mean that have to do a different header panel for every suppages level (using "../(../)HomePage.html" link)? Alberto On Thu, 2014-02-27 at 16:30 +0100, Sven Meier wrote: > Have you read http://wicket.apache.org/guide/guide/urls.html#urls_3 > ? > > Sven > > On 02/27/2014 03:44 PM, Alberto Brosich wrote: > > Hi, > > > > I have an header panel with a link to the homepage of the site. > > This panel is included in every page of the site. > > If I use the tag for that link it works fine (for example, > > it is disabled in the homepage) for the pages in the same package of the > > Homepage class. > > If I am on a page inside another package (subpackage in my case) the > > link became the name of that package plus the href specified in the html > > panel. For example: > > > > ... > > > > In a page inside package "subpackage" the link is: > > "subpackage/HomePage.html" and not "../". > > > > What I'm doing wrong? > > > > Regards > > > > Alberto > > > > > > - > > 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
Does wicket:link tag work inside pages in different packages?
Hi, I have an header panel with a link to the homepage of the site. This panel is included in every page of the site. If I use the tag for that link it works fine (for example, it is disabled in the homepage) for the pages in the same package of the Homepage class. If I am on a page inside another package (subpackage in my case) the link became the name of that package plus the href specified in the html panel. For example: ... In a page inside package "subpackage" the link is: "subpackage/HomePage.html" and not "../". What I'm doing wrong? Regards Alberto - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Dealing with 3 choice components
I have a form with with 3 choice components: A) DropDownChoice B) DropDownChoice C) ListMultipleChoice The values of B depend on selected value of A. The values of C depend on selected values of A and B I override the wantOnSelectionChangedNotifications() and onSelectionChanged() methods of A and B. A#onSelectionChanged @Override protected void onSelectionChanged(IntegerSelectChoice newSelection) { super.onSelectionChanged(newSelection); SearchForm.this.getModelObject().setInstrument(null); SearchForm.this.getModelObject().setParams(null); } B#onSelectionChanged @Override protected void onSelectionChanged(IntegerSelectChoice newSelection) { super.onSelectionChanged(newSelection); SearchForm.this.getModelObject().setParams(null); } In A I set to null the model value of both B and C. In B I set to null the model value only of B. This code works only on the startup of the form. When I change the value in A the list of C become empty. I have to change the value of B to fill C. How can I manage this? A -- Alberto Brosich Istituto Nazionale di Oceanografia e di Geofisica Sperimentale - OGS Dipartimento di Oceanografia - OGA National Oceanographic Data Centre/IOC - NODC Borgo Grotta Gigante 42/c, 34010 Sgonico, Trieste (ITALY) Phone: +39 040 2140281 E-mail:abros...@ogs.trieste.it - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Call an external url setting method and header
On 11/16/2011 11:10 AM, Martin Grigorov wrote: On Wed, Nov 16, 2011 at 12:02 PM, Sven Meier wrote: Hi, just create you own IRequestHandler. No need to create, there are default ones: TextRequestHandler (for success) and ErrorCodeRequestHandler (for failure) Ok, it's working. I use the following statement: onSubmit() ... this.getRequestCycle().scheduleRequestHandlerAfterCurrent(new TextRequestHandler(contentType, "utf-8", result)); ... ) But is there a way to control the http header (for content location, for example)? When the result is a csv file the browser uses a weird filename to write to. Instead of interrupting request processing with an exception, just schedule it with RequestCycle#scheduleRequestHandlerAfterCurrent() in your form's submit method. Sven -Ursprüngliche Nachricht- Von: Alberto Brosich [mailto:abros...@ogs.trieste.it] Gesendet: Mittwoch, 16. November 2011 10:51 An: users@wicket.apache.org Betreff: Re: Call an external url setting method and header On 11/16/2011 08:16 AM, Martin Grigorov wrote: Hi, On Tue, Nov 15, 2011 at 8:45 PM, Albertowrote: Hi, I have to call an external url (a rest web service) from onSubmit of a form. I found this solution: |throw new RedirectToUrlException( "http://www.facebook.com/login.php?api_key="+ _apiKey + "&v=1.0", HttpServletResponse.SC_MOVED_PERMANENTLY); but it is just a redirect and I cannot post form data and set the accept header. The web service return different type of data (csv, xml, html, json) depending on the accept header. How can I handle that? Use Apache HttpClient or pure UrlConnection instead. Yes, I'm using Jersey client for that. But how can I send the output I read from web service to the browser. SetResponsePage() accept only a Page class parameter. Sorry if it is a silly question but I'm new to Wicket. I'm googling since 2 days without success. Best regards Alberto | -- Alberto Brosich Istituto Nazionale di Oceanografia e di Geofisica Sperimentale - OGS Dipartimento di Oceanografia - OGA National Oceanographic Data Centre/IOC - NODC Borgo Grotta Gigante 42/c, 34010 Sgonico, Trieste (ITALY) Phone: +39 040 2140281 E-mail:abros...@ogs.trieste.it - 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 -- Alberto Brosich Istituto Nazionale di Oceanografia e di Geofisica Sperimentale - OGS Dipartimento di Oceanografia - OGA National Oceanographic Data Centre/IOC - NODC Borgo Grotta Gigante 42/c, 34010 Sgonico, Trieste (ITALY) Phone: +39 040 2140281 E-mail:abros...@ogs.trieste.it - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Call an external url setting method and header
On 11/16/2011 08:16 AM, Martin Grigorov wrote: Hi, On Tue, Nov 15, 2011 at 8:45 PM, Alberto wrote: Hi, I have to call an external url (a rest web service) from onSubmit of a form. I found this solution: |throw new RedirectToUrlException( "http://www.facebook.com/login.php?api_key="+ _apiKey + "&v=1.0", HttpServletResponse.SC_MOVED_PERMANENTLY); but it is just a redirect and I cannot post form data and set the accept header. The web service return different type of data (csv, xml, html, json) depending on the accept header. How can I handle that? Use Apache HttpClient or pure UrlConnection instead. Yes, I'm using Jersey client for that. But how can I send the output I read from web service to the browser. SetResponsePage() accept only a Page class parameter. Sorry if it is a silly question but I'm new to Wicket. I'm googling since 2 days without success. Best regards Alberto | -- Alberto Brosich Istituto Nazionale di Oceanografia e di Geofisica Sperimentale - OGS Dipartimento di Oceanografia - OGA National Oceanographic Data Centre/IOC - NODC Borgo Grotta Gigante 42/c, 34010 Sgonico, Trieste (ITALY) Phone: +39 040 2140281 E-mail:abros...@ogs.trieste.it - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org