2

I am using the share Component provided with the example site. Here request.getURl resolves to the view page and not the actual url shown on the browser.

https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2website%2FWEB-INF%2FViews%2FCore%2FPage%2FGeneralPage.jsp

I want to share http://website/scoreboard/image-library

How can I get the current page?

1 Answer 1

2

In DXA .NET we use var pageUrl = Url.Encode(Request.Url.ToString()); (as you can see in https://github.com/sdl/dxa-web-application-dotnet/blob/master/Site/Areas/Core/Views/Entity/SocialSharing.cshtml), and in DXA Java that is:

<% pageContext.setAttribute("pageUrl", URLEncoder.encode(request.getAttribute(com.sdl.webapp.common.controller.RequestAttributeNames.SOCIALSHARE_URL).toString(), "UTF-8")); %>

(as you can see in https://github.com/sdl/dxa-web-application-java/blob/develop/dxa-coremodule/src/main/resources/META-INF/resources/WEB-INF/Views/Core/Entity/SocialSharing.jsp)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.