hello,

this get the dispatched request, which seem not be usefull in my case (retrieve 
the session for setting a whole portal session parameter, that is the locale 
for all the portlet).

I did this, through the PortletRequest, PortletInvocation and 
AbstractInvocationContext class.

Not sure it is full correct, but it works. If someone has an comment on this ? 
may be another way to get the http session ?


  | private static final Logger log = Logger
  |                     .getLogger(MyClass.class);
  | 
  |     public static final HttpServletRequest getOuterRequest(
  |                     PortletRequest request) {
  |             PortletInvocation portletInvocation = (PortletInvocation) 
request
  |                             
.getAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
  |             // return portletInvocation.getDispatchedRequest();
  | 
  |             // Get the context of the invocation
  |             InvocationContext invocationContext = 
portletInvocation.getContext();
  | 
  |             // Try to cast the context of invocation to an 
AbstractInvocationContext
  |             AbstractInvocationContext abstractInvCtxt = null;
  |             if (invocationContext != null) {
  |                     if (invocationContext instanceof 
AbstractInvocationContext) {
  |                             abstractInvCtxt = (AbstractInvocationContext) 
invocationContext;
  |                     } else {
  |                             log
  |                                             .warn("The InvocationContext is 
not of instance of AbstractInvocationContext !");
  |                             log.warn("The InvocationContext is : " + 
invocationContext
  |                                             + " // " + 
invocationContext.getClass().getName()
  |                                             + " // " + 
invocationContext.toString());
  |                     }
  | 
  |             } else {
  |                     log.warn("The invocationContext is null !");
  |             }
  |             HttpServletRequest httpServletRequest = null;
  |             if (abstractInvCtxt != null) {
  |                     // The AbstractInvocationContext exists : try to 
retrieve the client
  |                     // httpServletRequest.
  |                     httpServletRequest = abstractInvCtxt.getClientRequest();
  |                     if (httpServletRequest == null) {
  |                             log.warn("The HttpServletRequest is null !");
  |                     }
  |             } else {
  |                     log.warn("The AbstractInvocationContext is null !");
  |             }
  |             return httpServletRequest;
  |     }
  | 




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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4025615
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to