Permalink
Browse files

Introduced ResourcesRoute.requestRelativePath(request) utility method

  • Loading branch information...
fcamblor committed Jan 19, 2017
1 parent 424bedc commit 34822ee3f01bcfd70ec5a1d14f4feca6d6f708ed
Showing with 5 additions and 1 deletion.
  1. +5 −1 restx-core/src/main/java/restx/ResourcesRoute.java
@@ -108,7 +108,7 @@ public ResourcesRoute(String name, String baseRestPath, String baseResourcePath,
@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(
@@ -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)){

0 comments on commit 34822ee

Please sign in to comment.