Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Won't Fix
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Sample Apps
-
Labels:None
-
Environment:any
-
Assignee Priority:P1
-
Affects:Sample App./Tutorial, Compatibility/Configuration
Description
During the development work to integration of Component Showcase into the Eclipse project environment. It was found that httpRequest.getLocalName() in the SourceCodeLoaderConnection.java was returning an 0.0.0.0.0.0 for the device's IP address. Liming is looking into possible configuration optioned within the IDE but there is an issue with the code block below
if ((request != null) && (request instanceof HttpServletRequest)) {
HttpServletRequest httpRequest = (HttpServletRequest)request;
SOURCE_SERVLET_URL = "http://" +
httpRequest.getLocalName() +
":" +
httpRequest.getLocalPort() +
httpRequest.getContextPath() +
"/";
}
else {
String fromFile = FacesUtils.getFacesParameter("org.icefaces.samples.showcase.SOURCE_SERVLET_URL");
if (fromFile != null) {
SOURCE_SERVLET_URL = fromFile;
}
else {
SOURCE_SERVLET_URL = "http://localhost:8080/comp-suite/";
}
}
As a potential work around the context param "org.icefaces.samples.showcase.SOURCE_SERVLET_URL" should be be able to be used to alter the SOURCE_SERVLET_URL but unfortunately the else block will never execute.
The code block should probably look something like this so the the context parameter can be detected and used.
String fromFile = FacesUtils.getFacesParameter("org.icefaces.samples.showcase.SOURCE_SERVLET_URL");
Object request = FacesContext.getCurrentInstance().getExternalContext().getRequest();
if ("".equals(fromFile)) {
HttpServletRequest httpRequest = (HttpServletRequest)request;
SOURCE_SERVLET_URL = "http://" +
httpRequest.getLocalName() +
":" +
httpRequest.getLocalPort() +
httpRequest.getContextPath() +
"/";
}
else {
SOURCE_SERVLET_URL = fromFile;
}
SOURCE_SERVLET_URL += "sourcecodeStream.html?path=";
if ((request != null) && (request instanceof HttpServletRequest)) {
HttpServletRequest httpRequest = (HttpServletRequest)request;
SOURCE_SERVLET_URL = "http://" +
httpRequest.getLocalName() +
":" +
httpRequest.getLocalPort() +
httpRequest.getContextPath() +
"/";
}
else {
String fromFile = FacesUtils.getFacesParameter("org.icefaces.samples.showcase.SOURCE_SERVLET_URL");
if (fromFile != null) {
SOURCE_SERVLET_URL = fromFile;
}
else {
SOURCE_SERVLET_URL = "http://localhost:8080/comp-suite/";
}
}
As a potential work around the context param "org.icefaces.samples.showcase.SOURCE_SERVLET_URL" should be be able to be used to alter the SOURCE_SERVLET_URL but unfortunately the else block will never execute.
The code block should probably look something like this so the the context parameter can be detected and used.
String fromFile = FacesUtils.getFacesParameter("org.icefaces.samples.showcase.SOURCE_SERVLET_URL");
Object request = FacesContext.getCurrentInstance().getExternalContext().getRequest();
if ("".equals(fromFile)) {
HttpServletRequest httpRequest = (HttpServletRequest)request;
SOURCE_SERVLET_URL = "http://" +
httpRequest.getLocalName() +
":" +
httpRequest.getLocalPort() +
httpRequest.getContextPath() +
"/";
}
else {
SOURCE_SERVLET_URL = fromFile;
}
SOURCE_SERVLET_URL += "sourcecodeStream.html?path=";
One more thing, it would also be great if the dependency on
import org.apache.commons.collections.OrderedBidiMap;
import org.apache.commons.collections.bidimap.TreeBidiMap;
Could be removed to in favour of java.util.