Details
-
Type: Improvement
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.2-EE-GA_P01
-
Fix Version/s: 1.8.2-EE-GA_P02
-
Component/s: Framework
-
Labels:None
-
Environment:ICEfaces portlet
-
Affects:Documentation (User Guide, Ref. Guide, etc.), Sample App./Tutorial
Description
A customer running a portlet on WebLogic wants to use the Authentication.login() API provided by the container. The signature of that method, surprisingly, requires direct access to the HttpServletRequest and HttpServletResponse:
http://download.oracle.com/docs/cd/E13155_01/wlp/docs103/javadoc/com/bea/p13n/security/Authentication.html
In WebLogic, it appears that calling ExternalRequest.getRequest() in a portlet actually returns something that can be used as an HttpServletRequest. However, with ICEfaces, we provide a PortletExternalContext implementation that returns a PortletRequest of our own and there doesn't currently seem to be a way to drill down and get at the original request to pass into the login() method.
http://download.oracle.com/docs/cd/E13155_01/wlp/docs103/javadoc/com/bea/p13n/security/Authentication.html
In WebLogic, it appears that calling ExternalRequest.getRequest() in a portlet actually returns something that can be used as an HttpServletRequest. However, with ICEfaces, we provide a PortletExternalContext implementation that returns a PortletRequest of our own and there doesn't currently seem to be a way to drill down and get at the original request to pass into the login() method.
Activity
Deryk Sinotte
created issue -
Deryk Sinotte
made changes -
Field | Original Value | New Value |
---|---|---|
Assignee | Deryk Sinotte [ deryk.sinotte ] |
Deryk Sinotte
made changes -
Salesforce Case | [] | |
Fix Version/s | 1.8.2-EE-GA_P02 [ 10226 ] |
Arran Mccullough
made changes -
Salesforce Case | [5007000000E6SKz] |
Deryk Sinotte
made changes -
Assignee Priority | P1 |
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #23046 | Fri Nov 05 14:40:15 MDT 2010 | deryk.sinotte | |
Files Changed | ||||
MODIFY
/icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/servlet/MainServlet.java
MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/BridgeExternalContext.java MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/servlet/ServletExternalContext.java MODIFY /icefaces/trunk/icefaces/core/src/org/icefaces/x/context/BridgeExternalContext2.java MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/jasper/Constants.java MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/portlet/PortletExternalContext.java |
Deryk Sinotte
made changes -
Status | Open [ 1 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Ken Fyten
made changes -
Affects | [Documentation (User Guide, Ref. Guide, etc.), Sample App./Tutorial] | |
Assignee Priority | P1 | |
Security | Private [ 10001 ] |
Ken Fyten
made changes -
Status | Resolved [ 5 ] | Closed [ 6 ] |
I've checked in a fix that allows developers access to the original request and response instances provided by the portlet or servlet container. The way to access this feature works something like this:
public HttpServletRequest getRequest(){
FacesContext fc = FacesContext.getCurrentInstance();
ExternalContext ec = fc.getExternalContext();
if( ec instanceof BridgeExternalContext ){
//The ICEfaces implementation of ExternalContext
BridgeExternalContext bec = (BridgeExternalContext)ec;
//BridgeExternalContext has two new methods:
// getOriginalRequest()
// getOriginalResponse()
Object originalReq = bec.getOriginalRequest();
//The implemenation returned here is container specific but will
//be an instance of HttpServletRequest or PortletRequest
//or, sometimes, both.
if( originalReq instanceof HttpServletRequest)
{ return (HttpServletRequest)originalReq; }PortletRequest portletReq = (PortletRequest)originalReq;
//Again, depending on the container, getting the HttpServletRequest
//from the PortletRequest is likely to be specific to the platform.
//For example on WebLogic Portal this could do the trick:
portletReq = (PortletRequest) portletReq.getAttribute("javax.portlet.request");
return (HttpServletRequest) portletReq.getAttribute("javax.servlet.request");
}
//If not ICEfaces, then just do it the plain JSF way.
return (HttpServletRequest)ec.getRequest();
}
I tested this on Liferay as well as WebLogic Portal 1.0.3 and WebSphere Portal 6.1 and it appears to do the trick. I made an effort to ensure that the references to the original request and response are not retained in the requestMap when the BridgeExternalContext is released as this previously caused memory issues.