How to manage Locale info in the URL path, but not the query string

We are building an application using Struts 1.1 and Tiles, on Oracle Application Server 10.1.3.3...
I know this is a strange question... but we have a requirement to represent the locale info in the URL string using one of the following options:
option 1: /eng/page.do?id=2 for english.../fra/page.do?id=2
option 2: /page-eng.do?id=2 for english.... and /page-fra.do?id=2 for french
We need to represent the 3 letter ISO lang code either in the directory structure, or suffix the page name (in our case, the struts action name)... we cannot replicate this using a parameter in the query string. I know this is odd, but that is what we are told to implement.
Is there any robust way of implementing either option in Struts 1.1, JSP, JSTL etc...?
Currently, we are looking at using a servlet filter to intercept the HTTP requests, parse the URL string, and extract the ISO lang value, and set locale and forward on the request.
This poses a few problems... adding additional action mappings (page-eng... page-fra... page) to our struts-xml.config file to handle lang permuations... but the biggest issue is all the embedded html:link action values throughout our code...
Because all our public facing URLs must comply with the rule, we need to change the html:link action to point to a different action, based on locale.
Very inefficent, and I'm sure not industry standard best practice... we are using Tiles, and resource bundles for all our labels etc... but fall short in meeting this rule with regards to URLs and locale.
Any advice or tips etc.. is greatly appreciated.

The filter option sounds like a good solution. So it can receive the urls and parse them appropriately.
You just need to take it one step further.
Additional actionmappings in your struts-config should not be necessary.
Filter:
- analyses the url and sets the appropriate locale
- adjusts the url such that the next level of the chain does not have to know anything about the locale being encoded in the url string.
Thus your struts classes and mappings can remain unchanged
/eng/page.do or /fra/page.do once through the filter should just look like /page.do to struts.
That should get rid of half of your headache.
Next the issue of generating urls.
There are two approaches I can see here
1 - use the filter approach again, this time with some post processing. Gather the generated HTML in a buffer, and do a find/replace on any urls generated, to put the locale encoding into them.
2 - Customise struts to produce urls in this format. This would involve the html:link tag, and the html:form tag at the least (maybe others?). Get the source code for struts, and grab the html:link tag code. Extend that class to generate urls as you want them to be generated. I think you would need to extend the class org.apache.struts.taglib.html.LinkTag and override the protected method calculateURL. You would then have to edit/modify the struts-html tld to point the link tag at your classes rather than the standard ones.
Option 1 is architecturally good because it gives you a well defined layer/border between having the locale encoded in the url, and not having it there. However it involves doing a find/replace on every html going out. This would catch all urls, whether generated by html:link tag or not.
Option 2 requires customising struts for your own requirements, which may be a bit daunting, but has the advantage of generating the urls correctly without the extra overhead involved with option 1. Of course you would have to ensure that ALL urls are generated with the html:link tag.
On reflection, I think option 1 is preferable, as both easier and quicker to implement, and doing a better separation in the architecture.
Cheers,
evnafets

Similar Messages

  • How do I get the downloaded music on my iphone to my new home pc and itunes, it took the info from the 1st device but not the 2nd

    how do I get the downloaded music on my iphone to my new home pc and itunes, it took the info from the 1st device but not the 2nd

    the appletv will not display your movies in folders.
    you could change the tags in itunes to include the genre in the "show" field in the "video" tab. this would replicate the view you want, but you will need to tag all your movies to do this.

  • How do I delete just the firefox bookmarks but not the the bookmarks toolbar icons

    I deleted my firefox bookmarks so I could import my gooogle bookmarks,but this also deleted my firefox bookmarks toolbar entries...it took me along time to put these in again.
    How do I delete just the firefox bookmarks but not the the bookmarks toolbar icons

    What kind of problems did you get after installing the extension?
    You can try to remove the history manually in the History Manager by doing a search for a colon.
    How many history items do you have to remove?
    If you only want to do this once or occasionally then you can consider to use this code:
    *http://kb.mozillazine.org/User:Dickvl/JavaScript_Error_Console#Expire_History_By_Days
    You will have to calculate the number of days that you want to keep to remove only history items from 2013 and older (365+31+28+26)
    You can open the Browser Console (Firefox/Tools > Web Developer).
    Paste the JavaScript code in the command line and press the Enter key to run the code.
    *Toggle the devtools.chrome.enabled pref on the <b>about:config</b> page to true to enable the command line
    *https://developer.mozilla.org/Tools/Browser_Console#Browser_Console_command_line
    <pre><nowiki>
    (function(){
    /* expire history by days, based upon bug 660646 comment 5/7 - [email protected] */
    var Cc = Components.classes, Ci = Components.interfaces;
    var his = Cc["@mozilla.org/browser/nav-history-service;1"].getService(Ci.nsIBrowserHistory);
    var prs = Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Ci.nsIPromptService);
    var day = 0, obj = new Object, txt = "Expire History"; obj.value = "90";
    if (prs.prompt(null,txt,"Days of history to keep",obj,null,{})){
    day = parseInt(obj.value);
    if(!isNaN(day)&&(day>0)){
    his.removeVisitsByTimeframe(0,(new Date().setHours(0,0,0,0) - day * 86400000) * 1000);
    }else{ prs.alert(null,txt,"Error Parsing Days: "+obj.value); }
    </nowiki></pre>
    If hat doesn't work then you may have a problem with the places.sqlite database file and you may have to reset places.sqlite.
    *Places Maintenance: https://addons.mozilla.org/firefox/addon/places-maintenance/
    You can move (copy/paste) history items that you want to keep to a bookmarks folder.
    See also:
    *Norwell History Tools: https://addons.mozilla.org/firefox/addon/norwell/

  • In the slide show view how can you pin the "next" Arrow to the ultimate edge so it is in the same place as the full screen image, it will pin to the left edge but not the right.

    In the slide show view how can you pin the "next" Arrow to the ultimate edge so it is in the same place as the full screen image, it will pin to the left edge but not the right.

    Hello,
    Please make sure that the next button is pinned to the right side as there in the attached image.
    If it is already pinned, you can try removing any embedded HTML code and checking it.
    Regards,
    Neha

  • Adobe Photoshop CS4 message: "Licensing for this product has stopped working." I have the serial number but not the media. How do I use the software?

    I recently tried to use Photoshop CS4 that I have on my computer but I get the message:"Licensing for this product has stopped working." I have the serial number but not the media. How can I use this version?

    You can get the installer here: Download CS4 products
    It will install as a fully functional 30 day trial. Entering your serial number will convert it to a permanent version, Standard or Extended, depending on what serial number you purchased.
    If you still have the license problem. get back to me with your OS details and the error code.
    Gene

  • I bought lightroom and need to register my student id, how do i do that, the trial has run out, i have the product code but not the serial number?

    i bought lightroom and need to register my student id, how do i do that, the trial has run out, i have the product code but not the serial number?

    If you purchased a package then there should have been instructions in the box on how to submit your academic credentials. If you purchased online from Adobe then you should have received instructions in an e-mail. But here is a link that might help you. There is a link under Step 2 that will take you to a place where you can enter the information, I think.
    Adobe - Adobe Education Store : Proof of Academic Indentification

  • How to restrict the user to change the project structure but not the documents?

    Hi,
    I have created one project assigning different users in Solution manger. I want to risitrict some of the users to change the project structure but simultaneously allwoing the project documents to be created, edited or deleted using solar01 under Project documentation tab. For that I have followed the steps provided in the follwoing link.
    http://wiki.scn.sap.com/wiki/display/SM/Howto+Restrict+Changes+to+Project+Nodes+to+Assigned+Team+Members
    I am able to restrict the users to change the project structure, but I am not able to allow access to the project documents. It gives me the message "You are not authorised to change the project". This fulfills my one of the requirements. But, Is there any way  to restrict the user to change the project structure but not the documents?. Any help will be apperitiated.
    Thanks,
    Rutvik Uapdhyay. 

    Hi Rutvik,
    Basically there are 2 different authorization role ...you should look for and customize as per requirement in Z* namespace.
    role  - SAP_SOLAR01_ALL
    this take care of objects in Solar01 like tab access etc
    role -SAP_SOL_KW_ALL
    this takes care of entire documentation within solman
    hope this helps
    Regards
    Prakhar

  • HT201272 I have tried several ways to transfer my itunes library and Playlists to a new computer. I get the music library but not the playlists. Can you advise? 2nd I purchased 21 new tunes yesterday on the new computer worked great but when I made a disc

    I have tried several ways to transfer my itunes library and Playlists to a new computer. I get the music library but not the playlists. Can you advise?
    2nd > I purchased 21 new tunes yesterday on the new computer> worked great> but when I made a disc to transfer the playlist. I get the music but no album info just 1,2,3,etc. So I have signup both computers to share thinking that would work. But no to that also.
    Please advise.
    Thanks,
    Bob

    Copy the entire /Music/iTunes/ folder from old computer to new computer.
    See this -> http://support.apple.com/kb/HT4527

  • 3rd gen iPod Nano will not sync with latest version of iTunes. It passes the connectivity test but not the sync test under diagnostics.  Worked fine on old Windows 7 laptop but not new one.  From Control Panel it shows up as an Apple iPod USB Device...

    3rd gen iPod Nano will not sync with latest version of iTunes on new laptop. It passes the connectivity test but not the sync test under diagnostics.  Worked fine on old Windows 7 laptop but not new one.  From Control Panel it shows up as an Apple iPod USB Device...

    Never mind, I think. I think I figured it out. There was 1 song (out of > 900!) that somehow had been purchased with the other ID - I have no idea how. Once I deleted that song, it stopped asking.
    There may be something with the newest iTunes version too. I didn't think in older versions that the "On this iPod" list of songs was greyed out. But at least it syncs ok.

  • I am using system 10.8.2 and have an issue with the screen saver not filling the screen. the desktop does, but not the screen saver. I find adjustments for the desktop, but not the saver. Would appreciate any suggestions.

    I am using system 10.8.2 and have an issue with the screen saver not filling the screen. the desktop does, but not the screen saver. I find adjustments for the desktop, but not the saver. Would appreciate any suggestions.

    I have a group of my images that rotate, and yes it happens oneach. I do believethat I have at one time had the images cover the entire screen, however I cannor remember how I made that happen, just like the desktop. I am sure it is old'ites setting in!

  • Outlook-2 different entries for the same person (but not the same email)

    i was asked to switch from outlook 2007 to outlook 2013 as a trial.
    For some reason, I get two different entries for the same person (but not the same email), one which is the name as normal and one where the name has ' around it. In the below example:
    I have 24 emails sent to Ciaran and then a further 14 sent to 'Ciaran'
    The email address for both is exactly the same and it does not seem to matter if I create a new email or reply to an incoming one.
    I switched back to Outlook 2007 and the issue is still the same.
    any suggestions?

    I would say that there is no way to prevent Outlook from doing it, it dependents on how the sender formatted the sending address, not the recipient who replies.
    To fix this:
    Open the message and double click the address and view source
    Just replace the generated Display As with the Display As you want
    Thanks,
    Ethan Hua CHN
    TechNet Community Support

  • I change my Pc and don't found my Original DVD from my Acrobat 9 STANDARD. I have the Key and found in Internet the Pro Version, but not the Standard Version. Where can i download the Standard Version?

    I change my Pc and don't found my Original DVD from my Acrobat 9 STANDARD. I have the Key and found in Internet the Pro Version, but not the Standard Version. Where can i download the Standard Version?

    Downloadable installation files available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4, CS4 Web Standard | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  13 |12 | 11, 10 | 9, 8, 7
    Photoshop Elements:  13 |12 | 11, 10 | 9,8,7
    Lightroom:  5.7.1| 5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5
    Contribute:  CS5 | CS4, CS3
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.window using the Lightroom 3 link to see those 'Important Instructions'.

  • I want to increase the ringer volume but not the background volume (ie texts, emails, etc)

    I want to increase the ringer volume but not the background volume (ie texts, emails, etc)

    nigelb999 wrote:
    Can anyone shed some light as to why it's not possible to adjust the ringer volume at the lock screen? Even though it's possible to adjust the volume during music playback and responses from Siri, etc.
    Cannot answer that question. That is a decision made by Apple.
    nigelb999 wrote:
    If there was a profile app available in the app store that allowed me to automatically set different volume levels at different times of the day it would be great - particularly if the app didn't require me to jailbreak the phone.
    There would not be an app like that, as they would not have access to the API. You can provide feedback to Apple if you would like to see this enhancement at http://www.apple.com/feedback and click on the appropriate link.

  • I can import my first clip to the video library, but not the second clip. I tried dragging-dropping and using the "E" key, but only the first clip will show up in the library. I use IMovie 9.0.9 and OSX 10.8.5. with no problems until yesterday.

    I can drag my first clip from the New Event window into the Project Library, but not the second. I can highlight the second clip in the New Event window, but it won't "drag". The "E" key works for the first clip, but not the second.I've been using IMovie daily and the problem just appeared. No upgrades to the computer and no new software installed.  IMovie 9.0.9 and OSX 10.8.5

    Thanks victoryhat.  I learned some new things from this very clear tutorial.  But it didn't answer my question about why the titles don't stay with the video when I export it.
    He did mention something that might be a clue however.  When he talked about importing a title he created as an image, he noted that he was careful to make the image the same size as the video he was adding it to: 1280 x 720.  Since I took the video with an iPhone in the vertical position, my video image isn't the same size and orientation as the titles.
    Maybe there is a way I should be setting the screen for this size???  I'll go back and play around.  Meanwhile thanks for alerting me to Gary Rosenzweig's MacMost tutorials.  Very clear.  I'll look for more.

  • Help, I have bought Creative Suite 6 student version, I have the product code but not the numbers I need to activate it, can you help?

    Help, I have bought Creative Suite 6 student version, I have the product code but not the numbers I need to activate it, can you help?

    This is not something we can help you with in a public forum.
    You'll either have to call Adobe Customer Service in your region, or use web chat. Here's link to web chat. Enter a product name and problem area. Ignore all the links except the one that says something like, "Still have a problem?" Click that, and you'll get a link to web chat:
    Contact Customer Care

Maybe you are looking for