![BlogImage.jpg](https://t3.ftcdn.net/jpg/03/45/88/10/240_F_345881000_1Kr5gFTmhJBzp7f5dM66oLxEBXtP3OPu.jpg)
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
Q&A
Please use this thread to ask the related questions.
Kautuk Sahni