Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to get SlingRequest from saxon TransformerFactory | AEM Community Blog Seeding

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,127 likes

Total Posts

6,126 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,127 likes

Total Posts

6,126 posts

Correct Reply

1,144 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

26-05-2020

BlogImage.jpg

How to get SlingRequest from saxon TransformerFactory by howtoaem Blog

Abstract

How to get SlingRequest from saxon TransformerFactory
I want to get a current SlingRequest.getRequestURI() and pass it to new LinkTransformer(links, repository, <>). So I tried to add an annotation @Reference SlingRequest slingRequest and it throws me an exception. Here is my code:

Best How To:
You cannot obtain it in the TransformerFactory, but you don't need it to give it to the LinkTransformer. The Transformer will receive it in the init method.

The init method of the Transformer receives a ProcessingContext, you can use ProcessingContext.getRequest() to get it

Read Full Blog

How to get SlingRequest from saxon TransformerFactory

Q&A

Please use this thread to ask the related questions.

AEM AEMEBlogSeeding Experience Manager