Get resource path from full url
Hi All,
I am implementing login component in which I want to support goto parameter for example
https://myDomain/login.html?goto=https://myDomain/securePage.html.
I am able to get the redirect path in my servlet from the query parameter but from query parameter how do i get the resource path? I was hoping resolve method might come handy but it does not seem to work :(. Anything more elegant that string manipulation to solve this problem?
final String gotoPath = xssApi.filterHTML(request.getParameter(gotoParam)); if (StringUtils.isNotEmpty(gotoPath)) { final Resource gotoPathResource = request.getResourceResolver().resolve(gotoPath); if (null != gotoPathResource && null != gotoPathResource.adaptTo(Page.class)) { response.sendRedirect(gotoPath); return; } }Above code is giving resource as non existent
Thanks!
Shehjad