ok, maybe I found the problems. Now, what about the follows: I extend my package from struts-default, it does not work, but when I extend my package from rest-default, it works. So, I want to know the details of the interceptorStack of rest-default package. Or is there a way to find reference? I need to define a new interceptorStack myself.
I read the source of rest plugin, and found the following: <interceptors> <interceptor name="rest" class="org.apache.struts2.rest.ContentTypeInterceptor"/> <interceptor name="restWorkflow" class="org.apache.struts2.rest.RestWorkflowInterceptor"/> <interceptor name="messages" class="org.apache.struts2.interceptor.MessageStoreInterceptor" /> <!-- A complete stack with all the common interceptors in place. Generally, this stack should be the one you use, though it may do more than you need. Also, the ordering can be switched around (ex: if you wish to have your servlet-related objects applied before prepare() is called, you'd need to move servletConfig interceptor up. This stack also excludes from the normal validation and workflow the method names input, back, and cancel. These typically are associated with requests that should not be validated. --> <interceptor-stack name="restDefaultStack"> <interceptor-ref name="exception"/> <interceptor-ref name="alias"/> <interceptor-ref name="servletConfig"/> <interceptor-ref name="messages"> <param name="operationMode">AUTOMATIC</param> </interceptor-ref> <interceptor-ref name="prepare"/> <interceptor-ref name="i18n"/> <interceptor-ref name="chain"/> <interceptor-ref name="debugging"/> <interceptor-ref name="profiling"/> <interceptor-ref name="actionMappingParams"/> <interceptor-ref name="scopedModelDriven"/> <interceptor-ref name="modelDriven"> <param name="refreshModelBeforeResult">true</param> </interceptor-ref> <interceptor-ref name="fileUpload"/> <interceptor-ref name="checkbox"/> <interceptor-ref name="staticParams"/> <interceptor-ref name="params"> <param name="excludeParams">dojo\..*</param> </interceptor-ref> <interceptor-ref name="rest" /> <interceptor-ref name="conversionError"/> <interceptor-ref name="validation"> <param name="excludeMethods">input,back,cancel,browse,index,show,edit,editNew</param> </interceptor-ref> <interceptor-ref name="restWorkflow"> <param name="excludeMethods">input,back,cancel,browse,index,show,edit,editNew</param> </interceptor-ref> </interceptor-stack> </interceptors> Is this the default interceptor stack for rest plugin? Thanks. --------------------------------------- Thanks! Mobile: +086-15864011231 Website:http://www.openmotel.cn http://www.vvthumb.com GTalk:[EMAIL PROTECTED] Skype:saharabear Haulyn Runner Jason ----- Original Message ---- From: Haulyn Jason <[EMAIL PROTECTED]> To: Struts Users Mailing List <user@struts.apache.org> Sent: Thursday, October 16, 2008 7:05:27 AM Subject: Re: How to setup Interceptor when using struts2.1.2 rest plugin with codebehind? Thanks Musachy: My application breaks means that something wrong occurs. I debug my application and the interceptor invoked, but when it execute into my OrdersController, struts tell me I didn't define result and input. But I have defined @Result. --------------------------------------- Thanks! Mobile: +086-15864011231 Website:http://www.openmotel.cn http://www.vvthumb.com GTalk:[EMAIL PROTECTED] Skype:saharabear Haulyn Runner Jason ----- Original Message ---- From: Musachy Barroso <[EMAIL PROTECTED]> To: Struts Users Mailing List <user@struts.apache.org> Sent: Thursday, October 16, 2008 12:51:03 AM Subject: Re: How to setup Interceptor when using struts2.1.2 rest plugin with codebehind? What do you mean by "application breaks"? Could it be that codebehind is not picking up the default interceptor (I doubt it anyway)? musachy On Wed, Oct 15, 2008 at 10:12 AM, Haulyn Jason <[EMAIL PROTECTED]> wrote: > it's very simple, just as below: > > <package name="newpackage" extends="struts-default" > namespace="/newpackage"> > <interceptors> > <interceptor name="paginationSupportInterceptor" > class="cn.openmotel.lorenzo.web.struts2.PaginationSupportInterceptor" /> > <interceptor-stack name="defaultInterceprotStack"> > <interceptor-ref name="checkbox" /> > <interceptor-ref name="params" /> > <interceptor-ref name="paginationSupportInterceptor" /> > <interceptor-ref name="defaultStack" /> > </interceptor-stack> > </interceptors> > <default-interceptor-ref > name="defaultInterceprotStack"></default-interceptor-ref> > </package> > > Thanks! > > > Mobile: +086-15864011231 > Website:http://www.openmotel.cn > http://www.vvthumb.com > GTalk:[EMAIL PROTECTED] <[EMAIL PROTECTED]> > Skype:saharabear > > > > > Haulyn Runner Jason > > > > ----- Original Message ---- > From: Musachy Barroso <[EMAIL PROTECTED]> > To: Struts Users Mailing List <user@struts.apache.org> > Sent: Wednesday, October 15, 2008 10:04:51 PM > Subject: Re: How to setup Interceptor when using struts2.1.2 rest plugin > with codebehind? > > Can you post the definition of your "newpackage" package? > > musachy > > On Wed, Oct 15, 2008 at 9:58 AM, Haulyn Jason <[EMAIL PROTECTED]> > wrote: > > > Hi,all > > My application is running on struts2.1.2 with rest plugin and codebehind. > > The code is like Struts2.1.2-rest-showcase.war. But when I want to add > my > > own Interceptors, something broken. > > > > I add a new package extends "struts-default" and re-defined the > > interceptor-stack as below: > > > > <interceptors> > > <interceptor name="paginationSupportInterceptor" > > class="cn.openmotel.lorenzo.web.struts2.PaginationSupportInterceptor" /> > > <interceptor-stack name="defaultInterceprotStack"> > > <interceptor-ref name="checkbox" /> > > <interceptor-ref name="params" /> > > <interceptor-ref name="paginationSupportInterceptor" /> > > <interceptor-ref name="defaultStack" /> > > </interceptor-stack> > > </interceptors> > > <default-interceptor-ref > > name="defaultInterceprotStack"></default-interceptor-ref> > > > > I want my OrdersController run under this package, so I add annotation > > @ParentPackage(value="newpackage"). Then something break. > > > > I debug my application and found the OrdersController worked but struts2 > > can not find the result setting. But before I add > > @ParentPackage(value="newpackage"), everything works well. > > > > I defind my Result as > > @Results({ > > @Result(name="success", type=ServletActionRedirectResult.class, > > value="website/orders") > > }) > > > > I spent two days on this but it didn't work anymore. I found two > > Interceptors in the REST plugin, did I lose something? > > > > Thanks! > > > > > > Mobile: +086-15864011231 > > Website:http://www.openmotel.cn > > http://www.vvthumb.com > > GTalk:[EMAIL PROTECTED] <[EMAIL PROTECTED]> < > [EMAIL PROTECTED] <[EMAIL PROTECTED]>> > > Skype:saharabear > > > > > > > > > > Haulyn Runner Jason > > > > > > > > > > > > > -- > "Hey you! Would you help me to carry the stone?" Pink Floyd > > > > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd