[ https://issues.apache.org/jira/browse/SLING-1629?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alexander Klimetschek updated SLING-1629: ----------------------------------------- Attachment: SLING-1629.patch Patch adding the two externalize() methods, including javadocs and a unit test. Apart from whether this makes sense at all, there are some questions probably: - detail of javadocs ok? - are two methods ok? or only add the one with the new feature: externalize(scheme,path)? (as noted, the other one is shorter than the identical map call, thus still useful) - changes sling api (but could be included in upcoming release) > Add methods for externalizing links to SlingHttpServletRequest > -------------------------------------------------------------- > > Key: SLING-1629 > URL: https://issues.apache.org/jira/browse/SLING-1629 > Project: Sling > Issue Type: New Feature > Components: API, Engine > Reporter: Alexander Klimetschek > Priority: Minor > Attachments: SLING-1629.patch > > > When creating links in responses there are two cases: > 1) create it for use by the browser: URLs relative to the current request > 2) link used by external apps: absolute URL including hostname etc. > For 1), you can already use ResourceResolver.map(request, path) (important to > use the request-based here). > For 2), when you explicitly want absolute URLs (eg. for rss feeds, links in > emails, etc.), the ResourceResolver map methods will only add a host/port if > such a configuration is part of /etc/map. There is no default to use the > host/port from the current request. > In order to provide convenient short access to those features, an externalize > method on the sling request object is better for both cases: > case 1) relative url > slingRequest.externalize("/my/path") > same as slingRequest.getResourceResolver().map(slingRequest, "/my/path")) > case 2) absolute url > slingRequest.externalize("http", "/my/path") > produces e.g. http://localhost:8080/my/path -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.