[
https://issues.apache.org/struts/browse/WW-3090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46065#action_46065
]
Wes Wannemacher commented on WW-3090:
-------------------------------------
Denis,
I created a simple unit test, I'm not sure if it is testing exactly what you
want and I'll attach it. But, I also noticed a few things while testing out
your change on our reference apps. In some cases, it seems to work and in
others it does not... For instance, on the struts2-blank app, I put an empty
s:url tag on the Welcome.action page and the URL it generated was -
/struts2-blank/example/Welcome!execute.action, which, if clicked, does not
work. Now in the struts2-showcase app, that sort of link would work. I think it
might have to do with the allow dynamic method invocation property, but I don't
have time to check into it tonight.
Another thing I wanted to ask was whether you tried to simply subclass
ServletUrlRenderer... I think you could probably make your own version of it
and jam it into the framework through the xml configuration. It might be easier
for you to do it that way, if possible, then we could add your new version to
the framework and make it a configuration option. That way, the option is there
and we aren't making a change to an existing component.
> The ServletUrlRenderer should use the current action / namespace as a default
> in #renderUrl
> -------------------------------------------------------------------------------------------
>
> Key: WW-3090
> URL: https://issues.apache.org/struts/browse/WW-3090
> Project: Struts 2
> Issue Type: Bug
> Components: Core Actions
> Affects Versions: 2.1.6
> Environment: Struts 2.1.6
> Reporter: Denis Cabasson
> Fix For: 2.1.7
>
> Attachments: WW-3090-patch.txt
>
>
> So, here is a bit of a background on the why of that bug.
> I' m working for the canadian governement, and there is a strong need to
> internationalize applications to be english and french. That goes as far as
> bilinguifying the URLs. So the url shouldn't be inbox.action but
> *inbox-reception.action* if the locale is English or *reception-inbox.action*
> if the locale is French. So, of course, it's a nightmare, but hey, that's
> what make the job interesting ;)
> Anyway, my approach to enable those weird urls is to use a custom
> ActionMapper. Our actions are actually named after their english names, and
> the action mapper is adding the French part correctly, and stripping it out
> when trying to find the right ActionMapping. That's working fine (after some
> tweaking of the Locale, but nothing really important).
> So where my issue kicks in is that for bilinguilism we have a link on each
> page using a <s:url /> without any actions, so that it redirects to the
> current page (with of course a different request_locale).
> Now, the thing that happens when we click the link is that the locale
> changes, and the url of the page changes. My understanding was that in this
> case, s:url would use the current namespace and action to generate the actual
> url. After reading through the code, that's the behaviour in
> ServletUrlRenderer#renderFormUrl, but ServletUrlRenderer#renderUrl is just
> recycling the current URL hoping it will still work. Actually that's not
> working in my case, as the URL changes after the Locale switched. So I'd like
> for #renderUrl to use the current action / namespace, instead of going for a
> wild guess based on the current URL.
> In most cases, that doesn't make a difference, as the same page usually have
> the same URL. However, it's not the same URL generated in my case, and I
> think the behaviour of ServletUrlRenderer is quite unexpected.
> I'll try to provide a patch ASAP.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.