Skip to content

Commit 34822ee

Browse files
committed
Introduced ResourcesRoute.requestRelativePath(request) utility method
1 parent 424bedc commit 34822ee

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

restx-core/src/main/java/restx/ResourcesRoute.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public Optional<RestxHandlerMatch> match(RestxRequest req) {
108108

109109
@Override
110110
public void handle(RestxRequestMatch match, RestxRequest req, RestxResponse resp, RestxContext ctx) throws IOException {
111-
String relativePath = req.getRestxPath().substring(baseRestPath.length());
111+
String relativePath = this.requestRelativePath(req);
112112
relativePath = Optional.fromNullable(aliases.get(relativePath)).or(relativePath);
113113
try {
114114
URL resource = MoreResources.getResource(
@@ -130,6 +130,10 @@ public void handle(RestxRequestMatch match, RestxRequest req, RestxResponse resp
130130
}
131131
}
132132

133+
protected String requestRelativePath(RestxRequest req) {
134+
return req.getRestxPath().substring(baseRestPath.length());
135+
}
136+
133137
protected Optional<CachedResourcePolicy> cachePolicyMatching(String contentType, String path) {
134138
for(CachedResourcePolicy cachedResourcePolicy : cachedResourcePolicies){
135139
if(cachedResourcePolicy.matches(contentType, path)){

0 commit comments

Comments
 (0)