struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <jeromy.ev...@blueskyminds.com.au>
Subject Re: [S2] REST Plugin + Validation
Date Mon, 01 Sep 2008 13:14:19 GMT
alvins wrote:
> Hi guys,
>
> I have been wrestling with the REST plugin for the last couple of days and
> have posted some notes in another thread.
>
> I have hit a problem which I need a little help with. Basically in my REST
> controller I have a create and update method as per the REST guidelines. I
> need separate validations for each of these which I do via annotating the
> methods respectively. 
>
> A problem arises as I need to separate INPUT results in the case of
> validation failure 0 one for the create and one for the update but of course
> this is not doable.
>
>   

I posted a similar response to this list a a few minutes ago. Here's a 
paraphrase for your specific question:

The default configuration for the validation interceptor is not suitable 
for this.  The parameter validateAnnotatedMethodOnly needs to be sets to 
true so the annotations only apply for the specific method instead of 
the entire class.  

What I've done is replace the rest default stack with one that includes 
the validation interceptor with better configuration:

<interceptor-ref name="validation">
  <param name="excludeMethods">input,back,cancel,browse,index</param>
  <param name="validateAnnotatedMethodOnly">true</param>
</interceptor-ref>
<interceptor-ref name="restWorkflow">
  <param name="excludeMethods">input,back,cancel,browse,index</param>
</interceptor-ref>


Hope that helps.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message