Class JakartaSlingInternalRequest
java.lang.Object
org.apache.sling.servlethelpers.internalrequests.BaseInternalRequest
org.apache.sling.servlethelpers.internalrequests.JakartaInternalRequest
org.apache.sling.servlethelpers.internalrequests.JakartaSlingInternalRequest
Internal request that uses a SlingRequestProcessor.
This executes the complete Sling request processing
pipeline.
That's the same processing than Sling uses
for HTTP requests, but it's not as efficient as the
ServletInternalRequest which resolves and
calls a Servlet or Script directly.
This variant of internal requests is useful when no
Resource is available, as it builds its own Resource
based on the supplied parameters to drive the
Servlet/Script resolution mechanism.-
Field Summary
Fields inherited from class org.apache.sling.servlethelpers.internalrequests.BaseInternalRequest
bodyReader, contentType, DEFAULT_METHOD, explicitStatusCheck, extension, log, MDC_KEY, parameters, path, requestMethod, resourceResolver, selectorString -
Constructor Summary
ConstructorsConstructorDescriptionJakartaSlingInternalRequest(@NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver, @NotNull org.apache.sling.engine.SlingRequestProcessor p, @NotNull String path) Setup an internal request that uses a SlingRequestProcessor -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddelegateExecute(org.apache.sling.api.SlingJakartaHttpServletRequest request, org.apache.sling.api.SlingJakartaHttpServletResponse response, org.apache.sling.api.resource.ResourceResolver resourceResolver) Execute the supplied Requestprotected org.apache.sling.api.resource.ResourceProvide the Resource to use to execute the requesttoString()Return essential request info, used to set the logging MDCwithResourceSuperType(String resourceSuperType) Sets the sling:resourceSuperType of the fake Resource used to resolve the Script or Servlet used for the internal requestwithResourceType(String resourceType) Sets the sling:resourceType of the fake Resource used to resolve the Script or Servlet used for the internal requestMethods inherited from class org.apache.sling.servlethelpers.internalrequests.JakartaInternalRequest
assertRequestExecuted, checkResponseContentType, checkStatus, execute, getResponse, getResponseAsString, getStatus, withBody, withContentType, withExtension, withParameter, withParameters, withRequestMethod, withSelectorsMethods inherited from class org.apache.sling.servlethelpers.internalrequests.BaseInternalRequest
checkNotNull, checkNotNull
-
Constructor Details
-
JakartaSlingInternalRequest
public JakartaSlingInternalRequest(@NotNull @NotNull org.apache.sling.api.resource.ResourceResolver resourceResolver, @NotNull @NotNull org.apache.sling.engine.SlingRequestProcessor p, @NotNull @NotNull String path) Setup an internal request that uses a SlingRequestProcessor
-
-
Method Details
-
toString
Return essential request info, used to set the logging MDC -
withResourceSuperType
Sets the sling:resourceSuperType of the fake Resource used to resolve the Script or Servlet used for the internal request -
withResourceType
Sets the sling:resourceType of the fake Resource used to resolve the Script or Servlet used for the internal request -
delegateExecute
protected void delegateExecute(org.apache.sling.api.SlingJakartaHttpServletRequest request, org.apache.sling.api.SlingJakartaHttpServletResponse response, org.apache.sling.api.resource.ResourceResolver resourceResolver) throws jakarta.servlet.ServletException, IOException Description copied from class:JakartaInternalRequestExecute the supplied Request- Specified by:
delegateExecutein classJakartaInternalRequest- Throws:
jakarta.servlet.ServletExceptionIOException
-
getExecutionResource
protected org.apache.sling.api.resource.Resource getExecutionResource()Description copied from class:BaseInternalRequestProvide the Resource to use to execute the request- Specified by:
getExecutionResourcein classBaseInternalRequest
-