You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Burton Rhodes <bu...@gmail.com> on 2022/10/07 20:37:47 UTC

s:url tag using includeParams=all include invalid url

After upgrading to Struts 6.0.x, the format of the url returned when using
includeParams seems to have changed. It now includes "!queue.action" which
is causing issues in my application. I am using it during an executeAndWait
call to refresh the page (using refresh logic in my javascript). Is this a
bug?

*Struts.xml Definifation Action*
<action name="SendEmail_queue"
class="com.afs.web.struts.action.email.SendEmailAction" method="queue">
    <interceptor-ref name="openSessionExecuteAndWaitInterceptor" >
        <param name="delay">500</param>
    </interceptor-ref>
    <result
name="wait">/struts/common/progressMonitorWait_popup.jsp</result>
    <result>/struts/email/sendEmailResult_popup.jsp</result>
    <result name="input">/struts/email/sendEmail_popup.jsp</result>
    <result name="error">/struts/common/error/error_popup.jsp</result>
    <result name="login">/struts/common/login/login_popup.jsp</result>
</action>

*Tag Application*
*(html)*
<input type="hidden" id="refreshUrl" value="<s:url includeParams="all"/>"/>

(javascript)
refreshUrl = new URL(window.location.origin + $('#refreshUrl').val());

*Current Output*
/afs/app/SendEmail_queue!queue.action?struts.token.name
=token&token=BJKMBT7FZH6LNTI553HE7ZP1EM6XZEMN&emailQueueId=1234

*Output Prior*
/afs/app/SendEmail_queue?struts.token.name
=token&token=BJKMBT7FZH6LNTI553HE7ZP1EM6XZEMN&emailQueueId=1234

Thanks in advance.

Re: s:url tag using includeParams=all include invalid url

Posted by Łukasz Lenart <lu...@gmail.com>.
Hi Burton

Feel free to open a ticket in JIRA and continue discussion there. I'm
missing a bit of information to investigate this problem.


Cheers
--
Łukasz



pon., 10 paź 2022 o 17:48 Burton Rhodes <bu...@gmail.com> napisał(a):
>
> After a bit more testing it seems all of my executeAndWait implementations
> are breaking using the standard recommended refresh implementation [1].
> The new <s:url> tag code appends the "method" to the action file name
> making the url invalid. So instead of "actionName.action" the result is
> "actionName!methodName.action".  I believe this change was introduced in
> v6.0.3 for WW-5190 [2] with the addition of
> line DefaultActionMapper.java:292 "extractMethodName(mapping,
> configManager);"
>
> A real world example is below:
>
> <action name="LetterMergeBulk_contactList"
> class="com.afs.web.struts.action.letters.LetterMergeBulkAction"
> method="contactList">
>     <interceptor-ref name="openSessionExecuteAndWaitInterceptor" />
>     <result
> name="wait">/struts/letters/letterMergeBulkWait_popup.jsp</result>
>     <result>/struts/letters/letterMerge_popup.jsp</result>
> </action>
>
> *Results in (v6.0.3)*
> /afs/app/LetterMergeBulk_contactList!contactList.action?struts.token.name
> =token&token=A9SIKBABK17IZFM6AHSP0QSFIJHLZKJB&letterTemplateId=14773
>
> *Instead of (v6.0.0)*
> /afs/app/LetterMergeBulk_contactList.action?struts.token.name
> =token&token=A9SIKBABK17IZFM6AHSP0QSFIJHLZKJB&letterTemplateId=14773
>
> *HTML Header*
> <head>
>    <title>Please wait</title>
>    <meta http-equiv="refresh" content="5;url=<s:url includeParams="all"
> />"/>
> </head>
>
> [1] https://struts.apache.org/core-developers/execute-and-wait-interceptor
> [2] https://github.com/apache/struts/pull/571/commits
>
>
> On Fri, Oct 7, 2022 at 3:37 PM Burton Rhodes <bu...@gmail.com> wrote:
>
> > After upgrading to Struts 6.0.x, the format of the url returned when using
> > includeParams seems to have changed. It now includes "!queue.action" which
> > is causing issues in my application. I am using it during an executeAndWait
> > call to refresh the page (using refresh logic in my javascript). Is this a
> > bug?
> >
> > *Struts.xml Definifation Action*
> > <action name="SendEmail_queue"
> > class="com.afs.web.struts.action.email.SendEmailAction" method="queue">
> >     <interceptor-ref name="openSessionExecuteAndWaitInterceptor" >
> >         <param name="delay">500</param>
> >     </interceptor-ref>
> >     <result
> > name="wait">/struts/common/progressMonitorWait_popup.jsp</result>
> >     <result>/struts/email/sendEmailResult_popup.jsp</result>
> >     <result name="input">/struts/email/sendEmail_popup.jsp</result>
> >     <result name="error">/struts/common/error/error_popup.jsp</result>
> >     <result name="login">/struts/common/login/login_popup.jsp</result>
> > </action>
> >
> > *Tag Application*
> > *(html)*
> > <input type="hidden" id="refreshUrl" value="<s:url includeParams="all"/>"/>
> >
> > (javascript)
> > refreshUrl = new URL(window.location.origin + $('#refreshUrl').val());
> >
> > *Current Output*
> > /afs/app/SendEmail_queue!queue.action?struts.token.name
> > =token&token=BJKMBT7FZH6LNTI553HE7ZP1EM6XZEMN&emailQueueId=1234
> >
> > *Output Prior*
> > /afs/app/SendEmail_queue?struts.token.name
> > =token&token=BJKMBT7FZH6LNTI553HE7ZP1EM6XZEMN&emailQueueId=1234
> >
> > Thanks in advance.
> >

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


Re: s:url tag using includeParams=all include invalid url

Posted by Burton Rhodes <bu...@gmail.com>.
After a bit more testing it seems all of my executeAndWait implementations
are breaking using the standard recommended refresh implementation [1].
The new <s:url> tag code appends the "method" to the action file name
making the url invalid. So instead of "actionName.action" the result is
"actionName!methodName.action".  I believe this change was introduced in
v6.0.3 for WW-5190 [2] with the addition of
line DefaultActionMapper.java:292 "extractMethodName(mapping,
configManager);"

A real world example is below:

<action name="LetterMergeBulk_contactList"
class="com.afs.web.struts.action.letters.LetterMergeBulkAction"
method="contactList">
    <interceptor-ref name="openSessionExecuteAndWaitInterceptor" />
    <result
name="wait">/struts/letters/letterMergeBulkWait_popup.jsp</result>
    <result>/struts/letters/letterMerge_popup.jsp</result>
</action>

*Results in (v6.0.3)*
/afs/app/LetterMergeBulk_contactList!contactList.action?struts.token.name
=token&token=A9SIKBABK17IZFM6AHSP0QSFIJHLZKJB&letterTemplateId=14773

*Instead of (v6.0.0)*
/afs/app/LetterMergeBulk_contactList.action?struts.token.name
=token&token=A9SIKBABK17IZFM6AHSP0QSFIJHLZKJB&letterTemplateId=14773

*HTML Header*
<head>
   <title>Please wait</title>
   <meta http-equiv="refresh" content="5;url=<s:url includeParams="all"
/>"/>
</head>

[1] https://struts.apache.org/core-developers/execute-and-wait-interceptor
[2] https://github.com/apache/struts/pull/571/commits


On Fri, Oct 7, 2022 at 3:37 PM Burton Rhodes <bu...@gmail.com> wrote:

> After upgrading to Struts 6.0.x, the format of the url returned when using
> includeParams seems to have changed. It now includes "!queue.action" which
> is causing issues in my application. I am using it during an executeAndWait
> call to refresh the page (using refresh logic in my javascript). Is this a
> bug?
>
> *Struts.xml Definifation Action*
> <action name="SendEmail_queue"
> class="com.afs.web.struts.action.email.SendEmailAction" method="queue">
>     <interceptor-ref name="openSessionExecuteAndWaitInterceptor" >
>         <param name="delay">500</param>
>     </interceptor-ref>
>     <result
> name="wait">/struts/common/progressMonitorWait_popup.jsp</result>
>     <result>/struts/email/sendEmailResult_popup.jsp</result>
>     <result name="input">/struts/email/sendEmail_popup.jsp</result>
>     <result name="error">/struts/common/error/error_popup.jsp</result>
>     <result name="login">/struts/common/login/login_popup.jsp</result>
> </action>
>
> *Tag Application*
> *(html)*
> <input type="hidden" id="refreshUrl" value="<s:url includeParams="all"/>"/>
>
> (javascript)
> refreshUrl = new URL(window.location.origin + $('#refreshUrl').val());
>
> *Current Output*
> /afs/app/SendEmail_queue!queue.action?struts.token.name
> =token&token=BJKMBT7FZH6LNTI553HE7ZP1EM6XZEMN&emailQueueId=1234
>
> *Output Prior*
> /afs/app/SendEmail_queue?struts.token.name
> =token&token=BJKMBT7FZH6LNTI553HE7ZP1EM6XZEMN&emailQueueId=1234
>
> Thanks in advance.
>