Hi All, I have a sling model and I am using @SlingObject SlingHttpServletReponse reponse to get a reference to the response object
same works fine in author but in publisher the response object is null
Any thoughts on why this might be?
Solved! Go to Solution.
Views
Replies
Total Likes
You can also access that object in HTL by using WCMUSEPOJO.
You can easily get it by invoking the getRequest method"
Views
Replies
Total Likes
If it works fine in Author - but not in Publisher - this means there is something missing on Publisher that is present in the Author instance.
Views
Replies
Total Likes
You can also access that object in HTL by using WCMUSEPOJO.
You can easily get it by invoking the getRequest method"
Views
Replies
Total Likes
Thanks SmacDonald. I'm using Resource as the adaptable. From the documentation, I understand that response object may not be available if resource is used as the adaptable. Workaround would be to use @Via to get the response object from request adaptable. And @SlingObject is supposed to be a replacement of @Via so @SlingObject should be able to inject the response object too even if the adaptable is Resource. Am I right in my understanding?
Views
Replies
Total Likes
Or should be using @Inject @Via(SlingHttpServletRequest.class) SlingHttpServletResponse response
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies