Skip to content

Commit

Permalink
Introduced ResourcesRoute.requestRelativePath(request) utility method
Browse files Browse the repository at this point in the history
  • Loading branch information
fcamblor committed Jan 19, 2017
1 parent 424bedc commit 34822ee
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion restx-core/src/main/java/restx/ResourcesRoute.java
Expand Up @@ -108,7 +108,7 @@ public Optional<RestxHandlerMatch> match(RestxRequest req) {

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

protected String requestRelativePath(RestxRequest req) {
return req.getRestxPath().substring(baseRestPath.length());
}

protected Optional<CachedResourcePolicy> cachePolicyMatching(String contentType, String path) {
for(CachedResourcePolicy cachedResourcePolicy : cachedResourcePolicies){
if(cachedResourcePolicy.matches(contentType, path)){
Expand Down

0 comments on commit 34822ee

Please sign in to comment.