[jboss-user] [JBoss Portal] - Re: How can I set the language for all portlets in the porta

Red Eagle do-not-reply at jboss.com
Wed Sep 20 10:13:04 EDT 2006


Hi @ all,

i have a similiar problem like rkiesi.
I want to change the localization of the whole portal without userlogin!
I have build up a jsf portlet which contains a combo box where you can select your language and i store the selected language in the session:

Code inside my managed bean:
session.setAttribute("locale", selectedLanguage, PortletSession.APPLICATION_SCOPE);

After that i wrote a new ServerInterceptor which will be called after the LocalInterceptor of the portal:
public class LocaleInterceptor extends ServerInterceptor {
  | 	private static Logger logger = LoggerFactory
  | 			.getLogger(LocaleInterceptor.class);
  | 
  | 	protected void invoke(ServerInvocation invocation) throws Exception,
  | 			InvocationException {
  | 
  | 		ServerRequest req = invocation.getRequest();
  | 		HttpSession session = req.getContext()
  | 				.getClientRequest().getSession(false);
  | 		if(session!=null){
  | 			String locale = (String) session.getAttribute("locale");
  | 			logger.info("locale "+locale);
  | 			logger.info("id: "+session.getId());
  | 		}
  | 		invocation.invokeNext();
  | 	}
  | 
  | }

Everything is working fine. The ServerInterceptor is called but i only get a null- value out of the session.

Both session that one i access in my jsf page and that one i access in my Interceptor have the same ids!

Another point i have to mention is the project- structure:
 - the portlet where i want to change the locale is a web- project
 - the interceptor is in a separated project because the classloader needs the interceptor first.

Anyone knows why i cannot get the value out of the session?
(is it possible that i'm accessing this attribute)
or is there another way to change the locale for the whole portlet?

regards,
Red

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972944#3972944

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3972944



More information about the jboss-user mailing list