In ResourceMapping, are patterns matched against full request URLs or request paths?
Also the "welcome pattern" example given in that page looks to be bogus:
For example, the:
Pattern ^[^/]+/[^/]+/welcome$
will trigger the:
Replacement /libs/cq/core/content/welcome.html.
to redirect a request:
to:
http://localhost:4503/libs/cq/core/content/welcome.html
That pattern does not match either of /welcome, localhost:4503/welcome, or http://localhost:4503/welcome.
Could please someone shed some light on what's going on how these patterns get evaluated?
So according to http://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html, these requests are "mingled" before being evaluated. There's an error in that page as well, though:
To accomplish this a path is constructed from the request as \{scheme\}/\{host.port\}/\{uri_path\
}
This should be
To accomplish this a path is constructed from the request as {scheme}/{serverName}.{port}/pathInfo
According to this code block in the same page:
1 2 3 4 5 6 7 8 9 10 11 12 13 | String path = request.getScheme + "/" + request.getServerName()+ "." + request.getServerPort() + "/" + request.getPathInfo();String result = null;for (MapEntry entry: mapEntries) {Matcher matcher = entry.pattern.matcher(path);if (matcher.find()) {StringBuffer buf = new StringBuffer();matcher.appendReplacement(buf, entry.getRedirect());matcher.appendTail(buf);result = buf.toString();break;}} |
Views
Replies
Total Likes
So according to http://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html, these requests are "mingled" before being evaluated. There's an error in that page as well, though:
To accomplish this a path is constructed from the request as \{scheme\}/\{host.port\}/\{uri_path\
}
This should be
To accomplish this a path is constructed from the request as {scheme}/{serverName}.{port}/pathInfo
According to this code block in the same page:
1 2 3 4 5 6 7 8 9 10 11 12 13 | String path = request.getScheme + "/" + request.getServerName()+ "." + request.getServerPort() + "/" + request.getPathInfo();String result = null;for (MapEntry entry: mapEntries) {Matcher matcher = entry.pattern.matcher(path);if (matcher.find()) {StringBuffer buf = new StringBuffer();matcher.appendReplacement(buf, entry.getRedirect());matcher.appendTail(buf);result = buf.toString();break;}} |
So according to http://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html, these requests are "mingled" before being evaluated. There's an error in that page as well, though:
To accomplish this a path is constructed from the request as \{scheme\}/\{host.port\}/\{uri_path\
}
This should be
To accomplish this a path is constructed from the request as {scheme}/{serverName}.{port}/pathInfo
According to this code block in the same page:
1 2 3 4 5 6 7 8 9 10 11 12 13 | String path = request.getScheme + "/" + request.getServerName()+ "." + request.getServerPort() + "/" + request.getPathInfo();String result = null;for (MapEntry entry: mapEntries) {Matcher matcher = entry.pattern.matcher(path);if (matcher.find()) {StringBuffer buf = new StringBuffer();matcher.appendReplacement(buf, entry.getRedirect());matcher.appendTail(buf);result = buf.toString();break;}} |
Views
Replies
Total Likes
Views
Like
Replies