I tested the InternalRequest in my use cases and its works just fine.
> On Jun 10, 2020, at 10:14 AM, Andreas Schaefer <[email protected]>
> wrote:
>
> I will try to fit into my use case. That said I am sort of confused with the
> OutputStream. As far as I understand it the output stream is when I write to
> a sink but not read from a source. If we want to support streaming in the
> InternalRequest it needs to provide an InputStream and the
> ResponseBondySupports needs to be using a Buffered Output Stream to
> facilitates that. I am thinking of having big files or images than then later
> are streamed to the caller outside of Sling.
>
> Also the current code from GitHub is having the checkStatus() on the
> execute(). I think that having a separate method (checkStatus()) is better
> than having on the execute(). That said I think we also should support
> multiple Status to be accepted.
>
> Cheers - Andy
>
>> On Jun 10, 2020, at 7:07 AM, Bertrand Delacretaz <[email protected]>
>> wrote:
>>
>> Hi,
>>
>> On Wed, Jun 3, 2020 at 11:03 AM Bertrand Delacretaz
>> <[email protected]> wrote:
>>> ...for my use cases a fluent interface to the SlingRequestProcessor would
>>> be nice...
>>
>> I have now implemented a fluent helper for internal requests, using
>> either the SlingRequestProcessor (for full fidelity compared to HTTP
>> requests) or the ServletResolver (faster, no Servlet Filters - thanks
>> Radu for mentioning that option), at SLING-9512 and [1].
>>
>> Here's a usage example, the tests [1] have more:
>>
>> OutputStream os = InternalRequest
>> .servletRequest(resourceResolver, servletResolver, "/some/path")
>> .withResourceType("website/article/news")
>> .withResourceSuperType("website/article")
>> .withSelectors("print", "a4")
>> .withExtension("pdf")
>> .execute()
>> .checkStatus(200)
>> .checkResponseContentType("application/pdf")
>> .getResponse()
>> .getOutputStream();
>>
>> Feedback is welcome! I'm using this in the GraphQL core that I'd like
>> to release soon, will need to release the servlet-helpers module as
>> well.
>>
>> -Bertrand
>>
>> [1] https://github.com/apache/sling-org-apache-sling-servlet-helpers
>