Details
Description
D2DViewHandler, getResourceURL(FacesContext context, String path) checks to see if the path contains a leading '/'. If so, it blindly appends the request context path, whether or not the given path already contains the context root path. This conflicts with the behaviour of the ResourceRegistry, which returns URLs that contain the root context path, and makes it difficult to use a URL derived from the ResourceRegistry on any component that first calls getResourceURL(..) to transform a path. We should first check if the given path argument contains the context path before appending, if it does, we should simply return the path unchanged, as we do if the path does not contain a leading '/'.
suggested fix:
Index: C:/work/workspace/icefaces-trunk-ossrepo/core/src/com/icesoft/faces/application/D2DViewHandler.java
===================================================================
--- C:/work/workspace/icefaces-trunk-ossrepo/core/src/com/icesoft/faces/application/D2DViewHandler.java (revision 19267)
+++ C:/work/workspace/icefaces-trunk-ossrepo/core/src/com/icesoft/faces/application/D2DViewHandler.java (working copy)
@@ -308,9 +308,9 @@
}
public String getResourceURL(FacesContext context, String path) {
- ExternalContext extContext = context.getExternalContext();
- if (path.startsWith("/")) {
- return (extContext.getRequestContextPath() + path);
+ String requestContextPath = context.getExternalContext().getRequestContextPath();
+ if (path.startsWith("/") && !path.startsWith(requestContextPath)) {
+ return (requestContextPath + path);
} else {
return path;
}
suggested fix:
Index: C:/work/workspace/icefaces-trunk-ossrepo/core/src/com/icesoft/faces/application/D2DViewHandler.java
===================================================================
--- C:/work/workspace/icefaces-trunk-ossrepo/core/src/com/icesoft/faces/application/D2DViewHandler.java (revision 19267)
+++ C:/work/workspace/icefaces-trunk-ossrepo/core/src/com/icesoft/faces/application/D2DViewHandler.java (working copy)
@@ -308,9 +308,9 @@
}
public String getResourceURL(FacesContext context, String path) {
- ExternalContext extContext = context.getExternalContext();
- if (path.startsWith("/")) {
- return (extContext.getRequestContextPath() + path);
+ String requestContextPath = context.getExternalContext().getRequestContextPath();
+ if (path.startsWith("/") && !path.startsWith(requestContextPath)) {
+ return (requestContextPath + path);
} else {
return path;
}
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
Ken Fyten
made changes -
Status | Resolved [ 5 ] | Closed [ 6 ] |
Assignee Priority | P2 |
Ken Fyten
made changes -
Salesforce Case | [] | |
Affects Version/s | 1.8.1 [ 10170 ] | |
Affects Version/s | 1.8.2-RC1 [ 10210 ] |
Mircea Toma
made changes -
Status | Reopened [ 4 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Deryk Sinotte
made changes -
Resolution | Invalid [ 6 ] | |
Status | Resolved [ 5 ] | Reopened [ 4 ] |
Mircea Toma
made changes -
Status | Reopened [ 4 ] | Resolved [ 5 ] |
Resolution | Invalid [ 6 ] |
Mircea Toma
made changes -
Resolution | Fixed [ 1 ] | |
Status | Resolved [ 5 ] | Reopened [ 4 ] |
Mircea Toma
made changes -
Status | Open [ 1 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Philip Breau
made changes -
Summary | D2DViewHandler.getResourceURL() should check for context in path before re-prepending it | ResourceRegistry should allow registering resources without pre-pending the request context path |
Salesforce Case | [] |
Philip Breau
made changes -
Summary | D2DViewHandler.getResourceURL() should check for context in path before re-appending it | D2DViewHandler.getResourceURL() should check for context in path before re-prepending it |
Salesforce Case | [] |
Deryk Sinotte
made changes -
Assignee | Deryk Sinotte [ deryk.sinotte ] | Mircea Toma [ mircea.toma ] |
Philip Breau
made changes -
Attachment | ICE-4292.zip [ 11996 ] |
Ken Fyten
made changes -
Issue Type | Bug [ 1 ] | Improvement [ 4 ] |
Salesforce Case | [] | |
Fix Version/s | 1.8.2 [ 10190 ] | |
Assignee Priority | P2 | |
Assignee | Ken Fyten [ ken.fyten ] | Deryk Sinotte [ deryk.sinotte ] |
Philip Breau
made changes -
Assignee | Ken Fyten [ ken.fyten ] |
Philip Breau
made changes -
Field | Original Value | New Value |
---|---|---|
Salesforce Case | [] | |
Description |
In D2DViewHandler, getResourceURL(FacesContext context, String path) checks to see if the path contains a leading '/', if so, it blindly appends the request context path, whether or not the given path already contains the context root path. This conflicts with the behaviour of the ResourceRegistry, which returns URLs that contain the root context path, and makes it difficult to use a URL derived from the ResourceRegistry on any component that first calls getResourceURL(..) to transform a path. We should first check if the given path argument contains the context path before appending, if it does, we should simply return the path unchanged, as we do if the path does not contain a leading '/'. suggested fix: Index: C:/work/workspace/icefaces-trunk-ossrepo/core/src/com/icesoft/faces/application/D2DViewHandler.java =================================================================== --- C:/work/workspace/icefaces-trunk-ossrepo/core/src/com/icesoft/faces/application/D2DViewHandler.java (revision 19267) +++ C:/work/workspace/icefaces-trunk-ossrepo/core/src/com/icesoft/faces/application/D2DViewHandler.java (working copy) @@ -308,9 +308,9 @@ } public String getResourceURL(FacesContext context, String path) { - ExternalContext extContext = context.getExternalContext(); - if (path.startsWith("/")) { - return (extContext.getRequestContextPath() + path); + String requestContextPath = context.getExternalContext().getRequestContextPath(); + if (path.startsWith("/") && !path.startsWith(requestContextPath)) { + return (requestContextPath + path); } else { return path; } |
D2DViewHandler, getResourceURL(FacesContext context, String path) checks to see if the path contains a leading '/'. If so, it blindly appends the request context path, whether or not the given path already contains the context root path. This conflicts with the behaviour of the ResourceRegistry, which returns URLs that contain the root context path, and makes it difficult to use a URL derived from the ResourceRegistry on any component that first calls getResourceURL(..) to transform a path. We should first check if the given path argument contains the context path before appending, if it does, we should simply return the path unchanged, as we do if the path does not contain a leading '/'. suggested fix: Index: C:/work/workspace/icefaces-trunk-ossrepo/core/src/com/icesoft/faces/application/D2DViewHandler.java =================================================================== --- C:/work/workspace/icefaces-trunk-ossrepo/core/src/com/icesoft/faces/application/D2DViewHandler.java (revision 19267) +++ C:/work/workspace/icefaces-trunk-ossrepo/core/src/com/icesoft/faces/application/D2DViewHandler.java (working copy) @@ -308,9 +308,9 @@ } public String getResourceURL(FacesContext context, String path) { - ExternalContext extContext = context.getExternalContext(); - if (path.startsWith("/")) { - return (extContext.getRequestContextPath() + path); + String requestContextPath = context.getExternalContext().getRequestContextPath(); + if (path.startsWith("/") && !path.startsWith(requestContextPath)) { + return (requestContextPath + path); } else { return path; } |
Philip Breau
created issue -