History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WW-1018
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Jason Carreira
Reporter: jacky hua
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
WebWork

validation problem for webwork's !command pattern action

Created: 18/Dec/05 08:25 AM   Updated: 18/Jun/06 05:05 AM
Component/s: Misc
Affects Version/s: 2.2
Fix Version/s: 2.2.3

Environment: jdk:java 1.4.2 os:windows xp sp2 app server: tomcat 5.0.28


 Description  « Hide
for webwork 2.1.7 we can use Action1Class-alias!method1-validation.xml to do validation for Action's method1,
but for webwork 2.2 beta4 it does not work.

I went through the java sources of ww 2.1.7 and 2.2 beta, and found ww 2.2 use ActionMapper for getting and storing
action's information instead of xwork's ConfigurationManager in ww 2.1.7 for runtime.
and then ww 2.2 creates ActionProxy accroding to ActionMapper's information, set method property to method1,
set action property to Action1, so destroies the information about action invoked by !command pattern request.
and xwork's validation interceptor and validator have not done something to fit this adjustment.
so I recommand to adjust xwork's ValidationInterceptor to do action's method level validation,
e.g. we can use Action1Class-method1-validation.xml or Action1Class-alias-method1-validation to do validation for a specific method.

 All   Comments   Change History      Sort Order:
tm_jee - [18/Dec/05 09:13 AM ]
I am not sure, but maybe Pat and Jason could give some more valueable feedback on this issue. I am guessing that this is one of those magic that was removed from pre-2.2 release.

jacky hua - [18/Dec/05 07:54 PM ]
Hi, tm_jee, thanks for your comments.
I saw the adjustment by Patrick, does it mean this issue will be fixed in the final release of webwork 2.2(build 21320)? if it's true, could you tell me when webwork 2.2 final will released?

tm_jee - [18/Dec/05 08:02 PM ]
Hi Jacky, If it is one of those "magic" feature that was removed, then it probably will not get fixed. I'll get Pat or Jason to comment on this issue. :-)

jacky hua - [18/Dec/05 10:03 PM ]
Hi, tm_jee, thanks for your explaination.
But I think this feature is very important, and should not be removed. if it is been removed, it will result in expansion of xwork.xml, because very !command need a alias action declaration.
and if we think this feature should not be supported, i recommend whether we may add a flag to webwork.properties, e.g. needCommand=true. if this flag is setted to true, this feature is there, or there is not this feature:-)

tm_jee - [18/Dec/05 10:10 PM ]
>But I think this feature is very important, and should not be removed. if it is been removed, it will
>result in expansion of xwork.xml, because very !command need a alias action declaration

I think the idea behind, is as you have pointed out to have an alias instead. If not mistaken the reason behind removing these "magics" are to make it easier for new people to get up using webwork. I guess the side effect will be rapid expansion of xwork.xml. The alternative would be to used <include file="..." /> to group related actions. :-)

We'll just have to wait for the time being for Pat or Jason, to comment on this issue. I've send them an email and they should response soon. :-)

jacky hua - [18/Dec/05 10:56 PM ]
thank you very much, tm_jee:-)

Patrick Lightbody - [20/Dec/05 10:00 PM ]
Jason, please comment

Patrick Lightbody - [20/Dec/05 10:01 PM ]
My opinion would be that, given WW-991, we should support this syntax just to make it easier for users to get started.

jacky hua - [21/Dec/05 12:28 AM ]
Hi, Patrick, Thansk for your comment.
I understand your opinion, but if don't use !command pattern, it will result in the expansion of xwork.xml. is your solution same with the one provided by tm_jee who suggested me using <include file="..." /> to group related actions in order to avoid expansion of xwork.xml? or you have another suggestion?
Anyway, thanks a lot.

jacky hua - [21/Dec/05 12:51 AM ]
Sorry, I have found another problem about using !command.
I have a action defination as below
        <action name="sa.role"
            class="net.ema.examples.sa.presentation.RoleAction">
            <result name="default" type="redirect">/sa.role!query.action</result>
            <result name="query">/sa/role_query.jsp</result>
            <result name="queryresult">/sa/role_query.jsp</result>
            <result name="view">/sa/role_view.jsp</result>
            <result name="create">/sa/role_create.jsp</result>
            <result name="update">/sa/role_update.jsp</result>
            <result name="create_valadate_error" type="chain">/sa.role!enterCreate.action</result>
        </action>
I use filterdispatcher instead of servletdispatcher which has been deprecated according to http://wiki.opensymphony.com/display/WW/web.xml+2.1.x+compatibility. so I use result type chain, but got the error like below. I think it also has closed relationship with !command pattern's implementaion, am I right?

com.opensymphony.xwork.config.ConfigurationException: There is no Action mapped for action name /sa.role!enterCreate.action
at com.opensymphony.xwork.DefaultActionProxy.<init>(DefaultActionProxy.java:70)
at com.opensymphony.xwork.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:39)
at com.opensymphony.xwork.ActionChainResult.execute(ActionChainResult.java:111)
at com.opensymphony.xwork.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:300)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:198)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:32)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:180)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:32)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:180)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:32)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:180)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:32)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:180)
at com.opensymphony.webwork.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:136)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:180)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:32)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:180)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:32)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:180)
at com.opensymphony.xwork.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:146)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:180)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:32)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:180)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:32)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:180)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:32)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:180)
at com.opensymphony.xwork.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:94)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:180)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:32)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:180)
at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:117)
at com.opensymphony.webwork.dispatcher.DispatcherUtils.serviceAction(DispatcherUtils.java:172)
at com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:180)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:71)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:75)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:188)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)


jacky hua - [21/Dec/05 02:56 AM ]
Hi, Patrick:
I checked source code of com.opensymphony.xwork.ActionChainResult, and found some code like below in execute method:
...
        proxy = ActionProxyFactory.getFactory().createActionProxy(finalNamespace, finalActionName, extraContext);
        proxy.execute();
...
did not judge if the finalActionName was !command, so I recommend modifying them like below:
...
        if (isActionCommand(finalActionName)) {
            proxy = ActionProxyFactory.getFactory().createActionProxy(finalNamespace, getActionName(finalActionName), extraContext);
            proxy.setMethod(getActionCommandName(finalActionName));
        } else {
            proxy = ActionProxyFactory.getFactory().createActionProxy(finalNamespace, finalActionName, extraContext);
        }
        proxy.execute();
...

Remark:
1) isActionCommand is to judge if the action is a !command pattern
2) getActionName is to get the substring of action name before '!'
3) getActionCommandName is to get the substring of action name after '!'

Patrick Lightbody - [07/Jan/06 05:27 PM ]
We've decided to get the 2.2 release out and then we'll put this in 2.3 (or Struts Action 2.0) soon after. Sorry about that, but we need to push the release out.

jacky hua - [08/Jan/06 12:57 AM ]
Ok, I'm looking forward to it.

tm_jee - [17/Jun/06 10:10 AM ]
Resolving this as won't fix, cause foo!bar is going to be removed from SAF2 anyway.

See also http://forums.opensymphony.com/thread.jspa?threadID=30434&tstart=0