Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

not able to resolve my short url to a resource in my servlet though it is getting resolved in /system/console/jcrresolver and this url works in browser.

Avatar

Level 10
final String referer = request.getHeader("referer"); final String resourcePath = new URI(referer).getPath();//gives me short url /test1 ResourceResolver resolver = request.getResourceResolver(); Resource resource = resolver.getResource(resourcePath);// this gives me null

/test1" is getting resolved in /system/console/jcrresolver and this url works in browser.

4 Replies

Avatar

Level 3

check permissions on node /test1.

if you are requesting as anonymous make sure it has necessary access.

Avatar

Level 10

awadheshv wrote...

check permissions on node /test1.

if you are requesting as anonymous make sure it has necessary access.

 

Thank awadheshv, for your response.

If i say that i can access that in browser that mean i have access to this page in anonymous view. In short i double checked that there is no access issues.

Regards,

Amit

Avatar

Level 4

Hi,

I think , First you need to get the resource by passing the "referer" value like -  resolver.getResource("referer") then you can get the short url. Since the URL is resolved to Short URL, this resource path will not available when you do getResource.

Hope this makes some sense.

Avatar

Level 10

CQ_learner wrote...

Hi,

I think , First you need to get the resource by passing the "referer" value like -  resolver.getResource("referer") then you can get the short url. Since the URL is resolved to Short URL, this resource path will not available when you do getResource.

Hope this makes some sense.

 

Thanks, I already mentioned that i am getting the short url in my code.