New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
h:outputLink etc strange URL encoding #1019
Comments
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented http://javaserverfaces.java.net/nonav/docs/2.1/renderkitdocs/index.html The entire "href" string must be passed through a call to the encodeResourceURL() method of the ExternalContext. Which ends up calling: javax.servlet.http.HttpServletResponse method encodeURL(url). |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented public class URLConverter implements Converter { return string; } @OverRide { if (path.indexOf(' ') >= 0) path = new URI(null, path, null).toASCIIString(); } catch (URISyntaxException exc) { // logger.log(Level.SEVERE, "uri="+path, exc); } return path; |
@glassfishrobot Commented h:graphicImage value="{{lab.path}}VisualObjective.jpg" where lab.path evaluates to /cLabsTest/EDSILabs/vLearning/Cisco Courses/Enterprise (Routers & Switches)/Interconnecting Cisco Network Devices 1/ICND1 Lab 2-2 Performing Switch Startup and Initial Configuration/VisualObjective.jpg becomes img src="/cLabsTest/EDSILabs/vLearning/Cisco+Courses/Enterprise+(Routers+&+Switches)/Interconnecting+Cisco+Network+Devices+1/ICND1+Lab+2-2+Performing+Switch+Startup+and+Initial+Configuration/VisualObjective.jpg" Should I report this as a new bug? |
@glassfishrobot Commented |
@glassfishrobot Commented |
|
If I have an h:outputLink with a value containing spaces, it is rendered with the spaces converted to +.
It seems to me that if it is going to convert this at all, it should do so correctly, i.e. to %20. Alternatively it should leave it alone and let it fail as originally supplied.
Am I missing something here?
I have a legacy content database where the document index provides URLs contain spaces. I can change that, and probably will, but maybe this is a bug and will get fixed the way I would like?
Discussion here. Appears to involve use of URLEncoder for the one thing it cannot do, which is encode a URL. Should be using URI.toASCIIString().
Environment
All
Affected Versions
[2.1]
The text was updated successfully, but these errors were encountered: