You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Denis Cabasson (JIRA)" <ji...@apache.org> on 2009/04/20 23:13:06 UTC

[jira] Issue Comment Edited: (WW-3090) The ServletUrlRenderer should use the current action / namespace as a default in #renderUrl

    [ https://issues.apache.org/struts/browse/WW-3090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46073#action_46073 ] 

Denis Cabasson edited comment on WW-3090 at 4/20/09 2:12 PM:
-------------------------------------------------------------

Hi Wes,

Thank you for taking the time to look into my issue. I'm already using a custom version of the UrlRenderer in my project. However, I found the current behaviour to be wrong (or at least different from my expectations). I was expecting a tag with no action and no value to be the same as a tag with the current action, and it is not the case.
So the point of this ticket is more to see if the behaviour of struts is actually unexpected or not. As far as I am concerned, my project is doing fine.

I have created a new test case, however, I haven't been able to run it yet (as I would need to pull out all of the SNAPSHOT dependencies from one of the SNAPSHOT repository). I will probably give that a shot tommorrow by creating a new local repo so as not to contaminate my current one.

Anyway, the un-expected behaviour only happens if you use a weird action mapper, so I tried providing a simple one in the test case. Feel free to have a look if you have time, and let me know if it is working. Otherwise I will do my best to give it a try tommorrow.

Thanks again for your time.

      was (Author: dcabasson):
    Hi Wes,

Thank you for taking the time to look into my issue. I'm still already using a custom version of the UrlRenderer in my project. However, I found the current behaviour to be wrong (or at least different from my expectations). I was expecting a tag with no action and no value to be the same as a tag with the current action, and it is not the case.
So the point of this ticket is more to see if the behaviour of struts is actually unexpected or not. As far as I am concerned, my project is doing fine.

I have created a new test case, however, I haven't been able to run it yet (as I would need to pull out all of the SNAPSHOT dependencies from one of the SNAPSHOT repository). I will probably give that a shot tommorrow by creating a new local repo so as not to contaminate my current one.

Anyway, the un-expected behaviour only happens if you use a weird action mapper, so I tried providing a simple one in the test case. Feel free to have a look if you have time, and let me know if it is working. Otherwise I will do my best to give it a try tommorrow.

Thanks again for your time.
  
> 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, WW-3090-testCase.diff, ww-3090-unit-test.patch
>
>
> 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.