Re: Backing components with map as model?
Hi, There is nothing special with the maps. YourComponent#getModelObject() will return a Map that you could use as you find appropriate, I guess you recall that (Compound)PropertyModel supports maps. Check PropertyModel and PropertyResolver's javadoc for examples. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Apr 29, 2016 at 8:13 AM, nino martinez wael < nino.martinez.w...@gmail.com> wrote: > Hi > > I weakly remember something about one being able to back a component > with a map as model.. > > The usecase are that the datamodel er not ready but we have a pretty > good picture of how the ui should look. So I want to be able to pseudo > implement it in wicket without having to wait for the backend design.. > > Could someone point me to an example? > > Thanks. > > -- > Best regards / Med venlig hilsen > Nino Martinez > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Backing components with map as model?
Hi I weakly remember something about one being able to back a component with a map as model.. The usecase are that the datamodel er not ready but we have a pretty good picture of how the ui should look. So I want to be able to pseudo implement it in wicket without having to wait for the backend design.. Could someone point me to an example? Thanks. -- Best regards / Med venlig hilsen Nino Martinez - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Use custom bootstrap.css/.js instead of bundled .css/.js
The demo application for the blog article I linked above shows how to filter out header items [1] E.g. you can set some custom MetaDataKey in the RequestCycle in your border component and in the filter to drop the default Bootstrap resources in the RequestCycle contains this metadata. 1. https://github.com/martin-g/blogs/blob/c29f0875910d3bd5e11bca0d2c0fa8cdd84e3736/wicket6-resource-management/src/main/java/com/wicketinaction/ResourceManagementApplication.java#L69 Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Apr 28, 2016 at 9:20 PM, Stefan Renz wrote: > Hi, > > for the records: I eliminated the component that contributes stock > bootstrap.css -- TooltipBehavior. Without it on the page, and without > autoinclusion of bootstrap resources, I am able to contribute just the > customized bootstrap.css > > This is, of course, just a haphazard solution, not one that I find > satisfying. > > Bye >Stefan > > Stefan Renz wrote: > > Hi, > > > > thanks for your answers, they put me on the right track. Problem is, I > > need to replace the stock bootstrap resources just for some pages (a > > particular border, to be precise), whereas both suggestes solutions of > > resource replacement and BootstrapSettings seem to be global to the > > Wicket WebApplication. This route I cannot take as other borders must > > not use my custom bootstrap css. > > > > Any more ideas on that? I'll go and search for an API to access the > > HeaderItems on the page, maybe that's a feasible way to get rid of the > > stock bootstrap.css. > > > > The CSS I need to use apparently has custom responsive breakpoints, > > which messes up when both bootstrap.css are included. > > > > Any more hints would be appreciated. > > > > Thanks, > >Stefan > > > > Martin Grigorov wrote: > >> Hi, > >> > >> Also you could use resource replacement. > >> Check http://wicketinaction.com/2012/07/wicket-6-resource-management/ > >> > >> Martin Grigorov > >> Wicket Training and Consulting > >> https://twitter.com/mtgrigorov > >> > >> On Thu, Apr 28, 2016 at 8:07 PM, Sebastien wrote: > >> > >>> Hi, > >>> > >>> I guess you can override BootstrapSettings > >>> https://github.com/l0rdn1kk0n/wicket-bootstrap/wiki/BootstrapSettings > >>> > >>> Hope this helps, > >>> Sebastien > >>> > >>> On Thu, Apr 28, 2016 at 8:00 PM, Stefan Renz > wrote: > >>> > Hi forum, > > for some parts of a web application I need to suppress delivering the > bundled webjar's bootstrap css and js, delivering custom versions of > the > respective resources. It there a way to "replace" the bundled > versions? > How can one suppress them? Is it possible to even do that for some > pages > only? > > I'm running on wicket 6.9 and wicket-bootstrap 0.9.8. > > I appreciate any hint, thanks for your time, > Stefan > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > -- > im Auftrag der eFonds Solutions AG, +49-89-579494-3417 > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: upgrade to wicket 7.2 append javascript to AjaxRequestTarget
On Thu, Apr 28, 2016 at 9:37 PM, fachhoch wrote: > the issue is due to a bug in my javascript , but wicket 6 never complained > about this, wicket 7 does it. > Yes, when not breaking it we try to improve it! :-) > Thanks > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/upgrade-to-wicket-7-2-append-javascript-to-AjaxRequestTarget-tp4674447p4674483.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: upgrade to wicket 7.2 append javascript to AjaxRequestTarget
the issue is due to a bug in my javascript , but wicket 6 never complained about this, wicket 7 does it. Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/upgrade-to-wicket-7-2-append-javascript-to-AjaxRequestTarget-tp4674447p4674483.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: Use custom bootstrap.css/.js instead of bundled .css/.js
Hi, for the records: I eliminated the component that contributes stock bootstrap.css -- TooltipBehavior. Without it on the page, and without autoinclusion of bootstrap resources, I am able to contribute just the customized bootstrap.css This is, of course, just a haphazard solution, not one that I find satisfying. Bye Stefan Stefan Renz wrote: > Hi, > > thanks for your answers, they put me on the right track. Problem is, I > need to replace the stock bootstrap resources just for some pages (a > particular border, to be precise), whereas both suggestes solutions of > resource replacement and BootstrapSettings seem to be global to the > Wicket WebApplication. This route I cannot take as other borders must > not use my custom bootstrap css. > > Any more ideas on that? I'll go and search for an API to access the > HeaderItems on the page, maybe that's a feasible way to get rid of the > stock bootstrap.css. > > The CSS I need to use apparently has custom responsive breakpoints, > which messes up when both bootstrap.css are included. > > Any more hints would be appreciated. > > Thanks, >Stefan > > Martin Grigorov wrote: >> Hi, >> >> Also you could use resource replacement. >> Check http://wicketinaction.com/2012/07/wicket-6-resource-management/ >> >> Martin Grigorov >> Wicket Training and Consulting >> https://twitter.com/mtgrigorov >> >> On Thu, Apr 28, 2016 at 8:07 PM, Sebastien wrote: >> >>> Hi, >>> >>> I guess you can override BootstrapSettings >>> https://github.com/l0rdn1kk0n/wicket-bootstrap/wiki/BootstrapSettings >>> >>> Hope this helps, >>> Sebastien >>> >>> On Thu, Apr 28, 2016 at 8:00 PM, Stefan Renz wrote: >>> Hi forum, for some parts of a web application I need to suppress delivering the bundled webjar's bootstrap css and js, delivering custom versions of the respective resources. It there a way to "replace" the bundled versions? How can one suppress them? Is it possible to even do that for some pages only? I'm running on wicket 6.9 and wicket-bootstrap 0.9.8. I appreciate any hint, thanks for your time, Stefan - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org > -- im Auftrag der eFonds Solutions AG, +49-89-579494-3417 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Use custom bootstrap.css/.js instead of bundled .css/.js
Hi, thanks for your answers, they put me on the right track. Problem is, I need to replace the stock bootstrap resources just for some pages (a particular border, to be precise), whereas both suggestes solutions of resource replacement and BootstrapSettings seem to be global to the Wicket WebApplication. This route I cannot take as other borders must not use my custom bootstrap css. Any more ideas on that? I'll go and search for an API to access the HeaderItems on the page, maybe that's a feasible way to get rid of the stock bootstrap.css. The CSS I need to use apparently has custom responsive breakpoints, which messes up when both bootstrap.css are included. Any more hints would be appreciated. Thanks, Stefan Martin Grigorov wrote: > Hi, > > Also you could use resource replacement. > Check http://wicketinaction.com/2012/07/wicket-6-resource-management/ > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Thu, Apr 28, 2016 at 8:07 PM, Sebastien wrote: > >> Hi, >> >> I guess you can override BootstrapSettings >> https://github.com/l0rdn1kk0n/wicket-bootstrap/wiki/BootstrapSettings >> >> Hope this helps, >> Sebastien >> >> On Thu, Apr 28, 2016 at 8:00 PM, Stefan Renz wrote: >> >>> Hi forum, >>> >>> for some parts of a web application I need to suppress delivering the >>> bundled webjar's bootstrap css and js, delivering custom versions of the >>> respective resources. It there a way to "replace" the bundled versions? >>> How can one suppress them? Is it possible to even do that for some pages >>> only? >>> >>> I'm running on wicket 6.9 and wicket-bootstrap 0.9.8. >>> >>> I appreciate any hint, thanks for your time, >>> Stefan >>> >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>> For additional commands, e-mail: users-h...@wicket.apache.org >>> >>> > -- im Auftrag der eFonds Solutions AG, +49-89-579494-3417 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Use custom bootstrap.css/.js instead of bundled .css/.js
Hi, Also you could use resource replacement. Check http://wicketinaction.com/2012/07/wicket-6-resource-management/ Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Apr 28, 2016 at 8:07 PM, Sebastien wrote: > Hi, > > I guess you can override BootstrapSettings > https://github.com/l0rdn1kk0n/wicket-bootstrap/wiki/BootstrapSettings > > Hope this helps, > Sebastien > > On Thu, Apr 28, 2016 at 8:00 PM, Stefan Renz wrote: > > > Hi forum, > > > > for some parts of a web application I need to suppress delivering the > > bundled webjar's bootstrap css and js, delivering custom versions of the > > respective resources. It there a way to "replace" the bundled versions? > > How can one suppress them? Is it possible to even do that for some pages > > only? > > > > I'm running on wicket 6.9 and wicket-bootstrap 0.9.8. > > > > I appreciate any hint, thanks for your time, > > Stefan > > > > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > >
Re: WicketTester + DateTimeField
You are very right! Please a ticket! In the meantime you can use tester.getSession().setLocale(locale) Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Apr 28, 2016 at 4:52 PM, Zbynek Vavros wrote: > Hi, > > finally got to fix that test and I don't have method setLocale(aLocale) on > MockHttpServletRequest. > I am on Wicket 7.0.0... > > Zbynek > > On Tue, Apr 26, 2016 at 6:12 PM, Zbynek Vavros > wrote: > > > Hey, > > > > good point, thanks a lot ! > > I was using the inner workings of DateTextField to get the formatted > > string with locale > > > > DateFormat.getDateInstance(DateFormat.SHORT, > > Locale.getDefault()).format(date) > > > > but setting the locale on request is much better, thanks again ! > > > > Zbynek > > > > On Tue, Apr 26, 2016 at 6:01 PM, Martin Grigorov < > > martin.grigo...@gmail.com> wrote: > > > >> Hi, > >> > >> WicketTester simulates browser behavior, so it sends String that is > >> converted to a Date by the Wicket component. > >> You can use tester.getRequest().setLocale(aLocale) to simulate localized > >> browser. > >> On Apr 26, 2016 4:22 PM, "Zbynek Vavros" > wrote: > >> > >> Hi, > >> > >> whats the proper way to work with WicketTester and DateTimeFields ? > >> I am using > >> > >> FormTester.setValue("myDateTimeField". "formattedDateTime"); > >> > >> is there any way using proper date instead of string (that differs with > >> locales) ? > >> using DateTimeField.setModelObject() or > >> DateTimeField.setDefaultModejObject > >> breaks our validator that works with getConvertedInput... > >> > >> Thanks, > >> Zbynek > >> > > > > >
Re: Use custom bootstrap.css/.js instead of bundled .css/.js
Hi, I guess you can override BootstrapSettings https://github.com/l0rdn1kk0n/wicket-bootstrap/wiki/BootstrapSettings Hope this helps, Sebastien On Thu, Apr 28, 2016 at 8:00 PM, Stefan Renz wrote: > Hi forum, > > for some parts of a web application I need to suppress delivering the > bundled webjar's bootstrap css and js, delivering custom versions of the > respective resources. It there a way to "replace" the bundled versions? > How can one suppress them? Is it possible to even do that for some pages > only? > > I'm running on wicket 6.9 and wicket-bootstrap 0.9.8. > > I appreciate any hint, thanks for your time, > Stefan > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Use custom bootstrap.css/.js instead of bundled .css/.js
Hi forum, for some parts of a web application I need to suppress delivering the bundled webjar's bootstrap css and js, delivering custom versions of the respective resources. It there a way to "replace" the bundled versions? How can one suppress them? Is it possible to even do that for some pages only? I'm running on wicket 6.9 and wicket-bootstrap 0.9.8. I appreciate any hint, thanks for your time, Stefan - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: WicketTester + DateTimeField
Hi, finally got to fix that test and I don't have method setLocale(aLocale) on MockHttpServletRequest. I am on Wicket 7.0.0... Zbynek On Tue, Apr 26, 2016 at 6:12 PM, Zbynek Vavros wrote: > Hey, > > good point, thanks a lot ! > I was using the inner workings of DateTextField to get the formatted > string with locale > > DateFormat.getDateInstance(DateFormat.SHORT, > Locale.getDefault()).format(date) > > but setting the locale on request is much better, thanks again ! > > Zbynek > > On Tue, Apr 26, 2016 at 6:01 PM, Martin Grigorov < > martin.grigo...@gmail.com> wrote: > >> Hi, >> >> WicketTester simulates browser behavior, so it sends String that is >> converted to a Date by the Wicket component. >> You can use tester.getRequest().setLocale(aLocale) to simulate localized >> browser. >> On Apr 26, 2016 4:22 PM, "Zbynek Vavros" wrote: >> >> Hi, >> >> whats the proper way to work with WicketTester and DateTimeFields ? >> I am using >> >> FormTester.setValue("myDateTimeField". "formattedDateTime"); >> >> is there any way using proper date instead of string (that differs with >> locales) ? >> using DateTimeField.setModelObject() or >> DateTimeField.setDefaultModejObject >> breaks our validator that works with getConvertedInput... >> >> Thanks, >> Zbynek >> > >
Re: [wicketstuff-restannotations] AbstractRestResource.toObject makes it impossible for mapped methods to know a parameter conversion went wrong.
Thanks Andrea, that would be excellent! Keep up the great work, Fabio On Thu, Apr 28, 2016 at 11:52 AM, Andrea Del Bene wrote: > Thank you for the issue! I think we can make it for next release 6.23.0 > which should come quite soon (at the moment we are voting to release Wicket > 6.23.0). > > Andrea. > > > On 28/04/2016 11:34, Fabio Fioretti wrote: > >> Done: https://github.com/wicketstuff/core/issues/490 >> >> Many thanks, >> Fabio >> >> On Thu, Apr 28, 2016 at 11:03 AM, Martin Grigorov < >> martin.grigo...@gmail.com >> >>> wrote: >>> Please file an issue at Wicketstuff GibHub. >>> On Apr 28, 2016 10:31 AM, "Fabio Fioretti" >>> wrote: >>> >>> Hi Martin, Thanks, I agree - findOffices() shouldn't be executed at all. In fact, handleMethodExecution() returns before invoking application code in all other cases (step 1 for unauthorized access, step 3 for validation >>> errors). >>> Any chance to have it fixed relatively soon? (maybe Andrea can answer >>> this) >>> Kind regards, Fabio On Thu, Apr 28, 2016 at 6:44 AM, Martin Grigorov wrote: Hi, > > > On Wed, Apr 27, 2016 at 12:07 PM, Fabio Fioretti < > windom.macroso...@gmail.com> wrote: > > Hi all, >> >> Please consider the following simple implementation of >> > AbstractRestResource > >> (6.22.0): >> >> @ResourcePath("/rest/api") >> public class MyRestResource extends >> AbstractRestResource >> { >> >> public MyRestResource () >> { >>super(new JsonWebSerialDeserial(new GsonObjectSerialDeserial())); >> } >> >> @MethodMapping(value = "/offices") >> public List findOffices( >> @RequestParam(value = "region", required = false) Integer >> > regionId) >>> { >>return findOfficesByRegion(regionId); >> } >> } >> >> My question relates to the findOffices method and its filtering >> > regionId > parameter when the value is not a valid integer. For example, >> > consider >>> the > >> request 'GET /rest/api/offices?region=AA'. >> >> At the second step of AbstractRestResource.handleMethodExecution, >> extractMethodParameters is invoked, which in turn triggers the >> > conversion > of all parameters through the static method toObject. >> >> When the conversion goes wrong and ConversionException is thrown, >> > toObject > >> catches it, sets the response status to 400 and returns null! >> >> Now, when my findOffices is finally executed, I get a null regionId >> > but I > don't know whether it was not valid or the parameter was not present >> > at >>> all. Checking the response status downstream is also particularly >> > hard >>> because I have no getStatus (Tomcat 6 here, ouch!). >> >> To my mind, findOffices should return null instead of the unfiltered >> > list > of offices if the conversion went wrong, even because the response >> status is 400 (as set by toObject). However, how can I know it? >> >> Any suggestions? >> >> IMO this is a bug in the library. > #findOffices() should not be executed at all. > A response with status code 400 should be returned immediately after > the >>> unsuccessful convention without giving a chance to the application code > to > be executed. > > Many thanks, >> Fabio >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: [wicketstuff-restannotations] AbstractRestResource.toObject makes it impossible for mapped methods to know a parameter conversion went wrong.
Thank you for the issue! I think we can make it for next release 6.23.0 which should come quite soon (at the moment we are voting to release Wicket 6.23.0). Andrea. On 28/04/2016 11:34, Fabio Fioretti wrote: Done: https://github.com/wicketstuff/core/issues/490 Many thanks, Fabio On Thu, Apr 28, 2016 at 11:03 AM, Martin Grigorov wrote: Please file an issue at Wicketstuff GibHub. On Apr 28, 2016 10:31 AM, "Fabio Fioretti" wrote: Hi Martin, Thanks, I agree - findOffices() shouldn't be executed at all. In fact, handleMethodExecution() returns before invoking application code in all other cases (step 1 for unauthorized access, step 3 for validation errors). Any chance to have it fixed relatively soon? (maybe Andrea can answer this) Kind regards, Fabio On Thu, Apr 28, 2016 at 6:44 AM, Martin Grigorov wrote: Hi, On Wed, Apr 27, 2016 at 12:07 PM, Fabio Fioretti < windom.macroso...@gmail.com> wrote: Hi all, Please consider the following simple implementation of AbstractRestResource (6.22.0): @ResourcePath("/rest/api") public class MyRestResource extends AbstractRestResource { public MyRestResource () { super(new JsonWebSerialDeserial(new GsonObjectSerialDeserial())); } @MethodMapping(value = "/offices") public List findOffices( @RequestParam(value = "region", required = false) Integer regionId) { return findOfficesByRegion(regionId); } } My question relates to the findOffices method and its filtering regionId parameter when the value is not a valid integer. For example, consider the request 'GET /rest/api/offices?region=AA'. At the second step of AbstractRestResource.handleMethodExecution, extractMethodParameters is invoked, which in turn triggers the conversion of all parameters through the static method toObject. When the conversion goes wrong and ConversionException is thrown, toObject catches it, sets the response status to 400 and returns null! Now, when my findOffices is finally executed, I get a null regionId but I don't know whether it was not valid or the parameter was not present at all. Checking the response status downstream is also particularly hard because I have no getStatus (Tomcat 6 here, ouch!). To my mind, findOffices should return null instead of the unfiltered list of offices if the conversion went wrong, even because the response status is 400 (as set by toObject). However, how can I know it? Any suggestions? IMO this is a bug in the library. #findOffices() should not be executed at all. A response with status code 400 should be returned immediately after the unsuccessful convention without giving a chance to the application code to be executed. Many thanks, Fabio - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [wicketstuff-restannotations] AbstractRestResource.toObject makes it impossible for mapped methods to know a parameter conversion went wrong.
Done: https://github.com/wicketstuff/core/issues/490 Many thanks, Fabio On Thu, Apr 28, 2016 at 11:03 AM, Martin Grigorov wrote: > Please file an issue at Wicketstuff GibHub. > On Apr 28, 2016 10:31 AM, "Fabio Fioretti" > wrote: > > > Hi Martin, > > > > Thanks, I agree - findOffices() shouldn't be executed at all. In fact, > > handleMethodExecution() returns before invoking application code in all > > other cases (step 1 for unauthorized access, step 3 for validation > errors). > > > > Any chance to have it fixed relatively soon? (maybe Andrea can answer > this) > > > > Kind regards, > > Fabio > > > > On Thu, Apr 28, 2016 at 6:44 AM, Martin Grigorov > > wrote: > > > > > Hi, > > > > > > > > > On Wed, Apr 27, 2016 at 12:07 PM, Fabio Fioretti < > > > windom.macroso...@gmail.com> wrote: > > > > > > > Hi all, > > > > > > > > Please consider the following simple implementation of > > > AbstractRestResource > > > > (6.22.0): > > > > > > > > @ResourcePath("/rest/api") > > > > public class MyRestResource extends > > > > AbstractRestResource > > > > { > > > > > > > > public MyRestResource () > > > > { > > > > super(new JsonWebSerialDeserial(new GsonObjectSerialDeserial())); > > > > } > > > > > > > > @MethodMapping(value = "/offices") > > > > public List findOffices( > > > >@RequestParam(value = "region", required = false) Integer > regionId) > > > > { > > > > return findOfficesByRegion(regionId); > > > > } > > > > } > > > > > > > > My question relates to the findOffices method and its filtering > > regionId > > > > parameter when the value is not a valid integer. For example, > consider > > > the > > > > request 'GET /rest/api/offices?region=AA'. > > > > > > > > At the second step of AbstractRestResource.handleMethodExecution, > > > > extractMethodParameters is invoked, which in turn triggers the > > conversion > > > > of all parameters through the static method toObject. > > > > > > > > When the conversion goes wrong and ConversionException is thrown, > > > toObject > > > > catches it, sets the response status to 400 and returns null! > > > > > > > > Now, when my findOffices is finally executed, I get a null regionId > > but I > > > > don't know whether it was not valid or the parameter was not present > at > > > > all. Checking the response status downstream is also particularly > hard > > > > because I have no getStatus (Tomcat 6 here, ouch!). > > > > > > > > To my mind, findOffices should return null instead of the unfiltered > > list > > > > of offices if the conversion went wrong, even because the response > > > > status is 400 (as set by toObject). However, how can I know it? > > > > > > > > Any suggestions? > > > > > > > > > > IMO this is a bug in the library. > > > #findOffices() should not be executed at all. > > > A response with status code 400 should be returned immediately after > the > > > unsuccessful convention without giving a chance to the application code > > to > > > be executed. > > > > > > > > > > > Many thanks, > > > > Fabio > > > > > > > > > >
Re: Wicket Redirects and Facebook
Hi, On Apr 28, 2016 6:05 AM, "Parag" wrote: > > Hi All, > > I have a problem which has me baffled. I am sure it is something minor but I just can’t figure it out, so I figured I would post to this group in the hope that someone knows how I could fix this problem which I never thought I had :) So here goes: > > We have a wicket based project under development and the problem we have with wicket redirects…. this is making it impossible for us to share our pages on facebook (and probably other social media site). The problem seems to be that wicket is redirecting slug based incoming requests. Because of this the facebook crawler (or scrapper) is not able to see our page and so returns an error. > > So the slug based user friendly URL is : > http://example.com/webapp/poll/who-is-the-most-important-person-in-the-country-in-2014-T196 > It causes a redirection to:- > http://example.com/mysite-webapp/wicket/page?1 > > So when I post this URL to Facebook it shows "Page Not Found" But if you click on the link it it works. Sorry. It is not very clear whether the url works when typed/pasted in the browser. Does it redirect always or only when coming from Facebook? > My question is why Wicket is redirecting it to " example.com/mysite-webapp/wicket/page?1". It doesn't happen for non-slug based URL. Wicket will produce "wicket/page?pageId" only for pages instantiated via custom contructor, i.e. neither non-arg contructor nor the one with PageParameters as a single argument. > > In the Wicket app I have defined the URL as: > mount(new MountedMapperWithoutPageComponentInfo("tapMap/${tapcastName}-T${tapCastId}", TapMapPage.class)); I don't see "tapMap/" in the urls above. Make sure the mounted page is the one that should handle such urls. > > Any help would be greatly appreciated. > > Thanks > Parag > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org >
Re: [wicketstuff-restannotations] AbstractRestResource.toObject makes it impossible for mapped methods to know a parameter conversion went wrong.
Please file an issue at Wicketstuff GibHub. On Apr 28, 2016 10:31 AM, "Fabio Fioretti" wrote: > Hi Martin, > > Thanks, I agree - findOffices() shouldn't be executed at all. In fact, > handleMethodExecution() returns before invoking application code in all > other cases (step 1 for unauthorized access, step 3 for validation errors). > > Any chance to have it fixed relatively soon? (maybe Andrea can answer this) > > Kind regards, > Fabio > > On Thu, Apr 28, 2016 at 6:44 AM, Martin Grigorov > wrote: > > > Hi, > > > > > > On Wed, Apr 27, 2016 at 12:07 PM, Fabio Fioretti < > > windom.macroso...@gmail.com> wrote: > > > > > Hi all, > > > > > > Please consider the following simple implementation of > > AbstractRestResource > > > (6.22.0): > > > > > > @ResourcePath("/rest/api") > > > public class MyRestResource extends > > > AbstractRestResource > > > { > > > > > > public MyRestResource () > > > { > > > super(new JsonWebSerialDeserial(new GsonObjectSerialDeserial())); > > > } > > > > > > @MethodMapping(value = "/offices") > > > public List findOffices( > > >@RequestParam(value = "region", required = false) Integer regionId) > > > { > > > return findOfficesByRegion(regionId); > > > } > > > } > > > > > > My question relates to the findOffices method and its filtering > regionId > > > parameter when the value is not a valid integer. For example, consider > > the > > > request 'GET /rest/api/offices?region=AA'. > > > > > > At the second step of AbstractRestResource.handleMethodExecution, > > > extractMethodParameters is invoked, which in turn triggers the > conversion > > > of all parameters through the static method toObject. > > > > > > When the conversion goes wrong and ConversionException is thrown, > > toObject > > > catches it, sets the response status to 400 and returns null! > > > > > > Now, when my findOffices is finally executed, I get a null regionId > but I > > > don't know whether it was not valid or the parameter was not present at > > > all. Checking the response status downstream is also particularly hard > > > because I have no getStatus (Tomcat 6 here, ouch!). > > > > > > To my mind, findOffices should return null instead of the unfiltered > list > > > of offices if the conversion went wrong, even because the response > > > status is 400 (as set by toObject). However, how can I know it? > > > > > > Any suggestions? > > > > > > > IMO this is a bug in the library. > > #findOffices() should not be executed at all. > > A response with status code 400 should be returned immediately after the > > unsuccessful convention without giving a chance to the application code > to > > be executed. > > > > > > > > Many thanks, > > > Fabio > > > > > >
Re: [wicketstuff-restannotations] AbstractRestResource.toObject makes it impossible for mapped methods to know a parameter conversion went wrong.
Hi Martin, Thanks, I agree - findOffices() shouldn't be executed at all. In fact, handleMethodExecution() returns before invoking application code in all other cases (step 1 for unauthorized access, step 3 for validation errors). Any chance to have it fixed relatively soon? (maybe Andrea can answer this) Kind regards, Fabio On Thu, Apr 28, 2016 at 6:44 AM, Martin Grigorov wrote: > Hi, > > > On Wed, Apr 27, 2016 at 12:07 PM, Fabio Fioretti < > windom.macroso...@gmail.com> wrote: > > > Hi all, > > > > Please consider the following simple implementation of > AbstractRestResource > > (6.22.0): > > > > @ResourcePath("/rest/api") > > public class MyRestResource extends > > AbstractRestResource > > { > > > > public MyRestResource () > > { > > super(new JsonWebSerialDeserial(new GsonObjectSerialDeserial())); > > } > > > > @MethodMapping(value = "/offices") > > public List findOffices( > >@RequestParam(value = "region", required = false) Integer regionId) > > { > > return findOfficesByRegion(regionId); > > } > > } > > > > My question relates to the findOffices method and its filtering regionId > > parameter when the value is not a valid integer. For example, consider > the > > request 'GET /rest/api/offices?region=AA'. > > > > At the second step of AbstractRestResource.handleMethodExecution, > > extractMethodParameters is invoked, which in turn triggers the conversion > > of all parameters through the static method toObject. > > > > When the conversion goes wrong and ConversionException is thrown, > toObject > > catches it, sets the response status to 400 and returns null! > > > > Now, when my findOffices is finally executed, I get a null regionId but I > > don't know whether it was not valid or the parameter was not present at > > all. Checking the response status downstream is also particularly hard > > because I have no getStatus (Tomcat 6 here, ouch!). > > > > To my mind, findOffices should return null instead of the unfiltered list > > of offices if the conversion went wrong, even because the response > > status is 400 (as set by toObject). However, how can I know it? > > > > Any suggestions? > > > > IMO this is a bug in the library. > #findOffices() should not be executed at all. > A response with status code 400 should be returned immediately after the > unsuccessful convention without giving a chance to the application code to > be executed. > > > > > Many thanks, > > Fabio > > >