Details
-
Type:
Improvement
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.1
-
Component/s: ICE-Components
-
Labels:None
-
Environment:portlets dataexporter
-
ICEsoft Forum Reference:
-
Affects:Compatibility/Configuration
Description
In the DataExporter.createFile method, the following logic is used:
ServletContext context = ((HttpSession) FacesContext
.getCurrentInstance().getExternalContext().getSession(false))
.getServletContext();
Casting to an HttpSession and attempting to retrieve the ServletContext will not work in portlets. In this case, the context is used to access the getRealPath() API to determine the location in the filesystem for storing/reading documents. The Portlet API also makes this available via the PortletContext. The code would need to look something like this:
PortletContext pContext = ((PortletSession) FacesContext
.getCurrentInstance().getExternalContext().getSession(false))
.getPortletContext();
There is no JSF way to do this that will work in both environments unfortunately so we'll need to ensure that this is done in a way that doesn't require a runtime dependency on the portlet.jar as it will not be available in plain web-apps.
ServletContext context = ((HttpSession) FacesContext
.getCurrentInstance().getExternalContext().getSession(false))
.getServletContext();
Casting to an HttpSession and attempting to retrieve the ServletContext will not work in portlets. In this case, the context is used to access the getRealPath() API to determine the location in the filesystem for storing/reading documents. The Portlet API also makes this available via the PortletContext. The code would need to look something like this:
PortletContext pContext = ((PortletSession) FacesContext
.getCurrentInstance().getExternalContext().getSession(false))
.getPortletContext();
There is no JSF way to do this that will work in both environments unfortunately so we'll need to ensure that this is done in a way that doesn't require a runtime dependency on the portlet.jar as it will not be available in plain web-apps.
Issue Links
- blocks
-
ICE-4367 dataExporter does not work in portal environment
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Assignee | Ken Fyten [ ken.fyten ] |
Salesforce Case | [] | |
Fix Version/s | 1.8.2 [ 10190 ] | |
Assignee Priority | P2 | |
Assignee | Ken Fyten [ ken.fyten ] | Adnan Durrani [ adnan.durrani ] |
Salesforce Case | [] | |
Affects | [Compatibility/Configuration] |
Repository | Revision | Date | User | Message |
ICEsoft Public SVN Repository | #19188 | Mon Aug 24 08:41:37 MDT 2009 | adnan.durrani | Fix for |
Files Changed | ||||
![]() ![]() |
Status | Open [ 1 ] | In Progress [ 3 ] |
Status | In Progress [ 3 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Issue Type | Bug [ 1 ] | Improvement [ 4 ] |
Salesforce Case | [] |
Fix Version/s | 1.8.2-RC1 [ 10210 ] |
Status | Resolved [ 5 ] | Closed [ 6 ] |
Assignee Priority | P2 |
Please correct, you'll need to implement using reflection to avoid runtime dependencies on portlet APIs in a none-portlet environment.