Request object inside experience fragment | Community
Skip to main content
manikanthar1295
Level 5
September 26, 2022
Question

Request object inside experience fragment

  • September 26, 2022
  • 1 reply
  • 438 views

Hi Team,

 

We have one experience fragment  in experience fragment we have   one component.

component is working fine but when we tried to inject the request object and to get the browser URL inside @postconstruct method we are not able to get the request inside the post construct method.

 

any one faces this issue any time 

if any solution inside Experience Fragment  to get the request object.

 

@Model(adaptables = {SlingHttpServletRequest.class, Resource.class}, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class LinkItem {
@Self
private SlingHttpServletRequest request;
@PostConstruct
private void activate(){

String url=request.getRequestURI();
 
 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

arunpatidar
Community Advisor
Community Advisor
September 27, 2022

Hi,

It should work.

Can you check this component with minimum changes?

Arun Patidar