Re: [wicketstuff-restannotations] AbstractRestResource.toObject makes it impossible for mapped methods to know a parameter conversion went wrong.

2016-04-27 Thread Martin Grigorov
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
>


Wicket Redirects and Facebook

2016-04-27 Thread Parag
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. 
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.

In the Wicket app I have defined the URL as:
mount(new 
MountedMapperWithoutPageComponentInfo("tapMap/${tapcastName}-T${tapCastId}", 
TapMapPage.class));

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: Palette - AJAX functionality

2016-04-27 Thread PDiefent
Hi Sven,
thanks for your help - looks promising now!
Now I only have to improve the CSS ...
Peter

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Palette-AJAX-functionality-tp4674433p4674460.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: Draggable multiple containment

2016-04-27 Thread Sebastien
Hi Maxim,

I actually need to make a poc before giving an answer. Will try to do it
asap...

Thanks & best regards,
Sebastien.


On Wed, Apr 27, 2016 at 9:12 AM, Maxim Solodovnik 
wrote:

> Ok
>
> Another question:
> Currently Draggable has "revert" option
> Is it possible to check item being dropped inside Droppable::onDrop and
> "reject" it, so it will revert?
>
> It is not an option for me to setRevert(true), due to I need to perform
> some checks depending on where the item was dropped :)
>
>


Re: Palette - AJAX functionality

2016-04-27 Thread Sven Meier

Hi,

there are multiple things going wrong here:

- you didn't read Palette's javadoc:
 * Ajaxifying the palette: If you want to update a 
Palette with an
 * {@link AjaxFormComponentUpdatingBehavior}, you have to attach it to 
the contained
 * {@link Recorder} by overriding {@link #newRecorderComponent()} and 
calling

 * {@link #processInput()}:

- the following example code was bogus (my bad) and should read:

Palette palette=new Palette(...) {
protected Recorder newRecorderComponent()
{
 Recorder recorder=super.newRecorderComponent();
 recorder.add(new AjaxFormComponentUpdatingBehavior("change") {
protected void onUpdate(AjaxRequestTarget target) {
processInput(); // let Palette process input too
...
}
});
 return recorder;
}
}

- as written in the Javadoc too, you have to use unique ids, so your 
example has to be changed to use an id for the choices:


IChoiceRenderer renderer = new 
ChoiceRenderer("newAccName", "newAccIntAcc");


I'll improved the Javadoc, please let us know whether this fixes your issue.

Have fun
Sven




On 27.04.2016 08:32, PDiefent wrote:

Hi Sven,
thanks for your reply. Please find a QickStart attached.
Peter
palette.7z


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Palette-AJAX-functionality-tp4674433p4674453.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



[wicketstuff-restannotations] AbstractRestResource.toObject makes it impossible for mapped methods to know a parameter conversion went wrong.

2016-04-27 Thread Fabio Fioretti
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?

Many thanks,
Fabio


Re: [wicketstuff-restannotations] How to automatically generate Swagger definitions.

2016-04-27 Thread Fabio Fioretti
Hi Andrea,

Thanks anyway. No big deal in doing it manually with the Swagger editor for
me, but having some kind of built-in automation would be great for large
APIs.

By the way, I have another question more strictly related to
restannotations, for which I am going to start another thread.

Kind regards,
Fabio

On Tue, Apr 26, 2016 at 10:19 PM, Andrea Del Bene 
wrote:

> Hi,
>
> at the moment we don't have such kind of integration with Swagger. You may
> obtain some results if you use Spring in your application:
> https://dzone.com/articles/swagger-make-developers-love.
> However I've never tried this kind of solution.
>
>
> On 25/04/2016 16:08, Fabio Fioretti wrote:
>
>> Hi all,
>>
>> I have been successfully using wicketstuff-restannotations to create some
>> REST web services in my Wicket 6.22.0 application - thanks for that, very
>> straightforward.
>>
>> Now that my REST resources and methods are complete and correctly
>> annotated, I would need to generate the related Swagger definitions.
>>
>> Is there an easy way to do so?
>>
>> Many thanks,
>> Fabio
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Draggable multiple containment

2016-04-27 Thread Maxim Solodovnik
Ok

Another question:
Currently Draggable has "revert" option
Is it possible to check item being dropped inside Droppable::onDrop and
"reject" it, so it will revert?

It is not an option for me to setRevert(true), due to I need to perform
some checks depending on where the item was dropped :)


On Wed, Apr 27, 2016 at 1:06 PM, Sebastien  wrote:

> Hi Maxim,
>
>
> On Wed, Apr 27, 2016 at 6:38 AM, Maxim Solodovnik 
> wrote:
>
> > Hello Sebastien,
> >
> > It's about jqueryui draggable.
> > According to my tests it only works on first element being selected by
> > selector provided i.e. in case two elements on the page has class="drop
> > target", only one will work as containment
> >
>
> Right, this seems to be by design
>
> *Selector*: The draggable element will be contained to the bounding box of
> the first element found by the selector. If no element is found, no
> containment will be set.
>
>
> >
> > setting containment to empty string helps, but 
> >
>
> I'm afraid you should try to have a more generic/large containment...
> If should show me some code or example I may be more inspired ! :)
>
>
> >
> > On Wed, Apr 27, 2016 at 3:15 AM, Sebastien  wrote:
> >
> > > Hi Maxim,
> > >
> > > Is it about jQuery or Kendo draggable?
> > >
> > > Sebastien.
> > >
> > > On Tue, Apr 26, 2016 at 7:06 PM, Maxim Solodovnik <
> solomax...@gmail.com>
> > > wrote:
> > >
> > > > Hello Sebastien,
> > > >
> > > > I'm trying to use Draggable,
> > > > everything works as expected as long as I'm using single selector for
> > the
> > > > "containment" (for ex: ".drop.target" or ".drop.target1")
> > > >
> > > > but fails if I'm using both ".drop.target, .drop.target1"
> > > > Maybe you know are there any limitations?
> > > >
> > > >
> > > > --
> > > > WBR
> > > > Maxim aka solomax
> > > >
> > >
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>



-- 
WBR
Maxim aka solomax


Re: Palette - AJAX functionality

2016-04-27 Thread PDiefent
Hi Sven, 
thanks for your reply. Please find a QickStart attached.
Peter
palette.7z
  

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Palette-AJAX-functionality-tp4674433p4674453.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: Draggable multiple containment

2016-04-27 Thread Sebastien
Hi Maxim,


On Wed, Apr 27, 2016 at 6:38 AM, Maxim Solodovnik 
wrote:

> Hello Sebastien,
>
> It's about jqueryui draggable.
> According to my tests it only works on first element being selected by
> selector provided i.e. in case two elements on the page has class="drop
> target", only one will work as containment
>

Right, this seems to be by design

*Selector*: The draggable element will be contained to the bounding box of
the first element found by the selector. If no element is found, no
containment will be set.


>
> setting containment to empty string helps, but 
>

I'm afraid you should try to have a more generic/large containment...
If should show me some code or example I may be more inspired ! :)


>
> On Wed, Apr 27, 2016 at 3:15 AM, Sebastien  wrote:
>
> > Hi Maxim,
> >
> > Is it about jQuery or Kendo draggable?
> >
> > Sebastien.
> >
> > On Tue, Apr 26, 2016 at 7:06 PM, Maxim Solodovnik 
> > wrote:
> >
> > > Hello Sebastien,
> > >
> > > I'm trying to use Draggable,
> > > everything works as expected as long as I'm using single selector for
> the
> > > "containment" (for ex: ".drop.target" or ".drop.target1")
> > >
> > > but fails if I'm using both ".drop.target, .drop.target1"
> > > Maybe you know are there any limitations?
> > >
> > >
> > > --
> > > WBR
> > > Maxim aka solomax
> > >
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>