You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Magnus Haraldsen Amundsen <Ma...@computas.com> on 2008/03/05 22:32:26 UTC

REST and i18n

Hi,
 
Using the REST-plugin (Struts 2.1.1) and with a requirement for i18n URLs. Is it possible to have a single action that maps to different URLs using the REST-plugin?
 
Ie.
 
OrdersController.index() kicks in on both the english and the norwegian word in the URL:
 
/orders --> OrdersController.index() --> /orders-index.jsp
/bestillinger --> OrdersController.index() --> /orders-index.jsp
 
Or do I have to implement BestillingerController.index() and bestillinger-index.jsp also?

IMPORTANT NOTICE:
This message may contain confidential information. 
If you have received this e-mail in error, do not use, copy or 
distribute it. Do not open any attachments. Delete it immediately from
your system and notify the sender promptly by e-mail that you 
have done so. Thank you.


Re: REST and i18n

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Magnus Haraldsen Amundsen wrote:
> Hi,
>  
> Using the REST-plugin (Struts 2.1.1) and with a requirement for i18n URLs. Is it possible to have a single action that maps to different URLs using the REST-plugin?
>  
> Ie.
>  
> OrdersController.index() kicks in on both the english and the norwegian word in the URL:
>  
> /orders --> OrdersController.index() --> /orders-index.jsp
> /bestillinger --> OrdersController.index() --> /orders-index.jsp
>  
> Or do I have to implement BestillingerController.index() and bestillinger-index.jsp also?
>
>   

The REST plugin doesn't support this. Your suggestion of creating a 
BestillingerController would work. 

Thinking about it a little further, is the requirement that:
  - a controller should allow multiple names (eg. with the @Action 
annotation); or
  - the ActionMapper should support a resource bundle to match the URL 
to an action name?

In the next few weeks I'll be sharing a new ActionMapper on GoogleCode 
that allows the latter case as the algorithm to select the 
action/controller can be plugged-in.  In the meantime your only other 
option is to create a custom ActionMapper based on the RestActionMapper 
though.

regards,
 Jeromy Evans


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