Class SlingInternalRequest
- java.lang.Object
-
- org.apache.sling.servlethelpers.internalrequests.InternalRequest
-
- org.apache.sling.servlethelpers.internalrequests.SlingInternalRequest
-
public class SlingInternalRequest extends InternalRequest
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 theServletInternalRequestwhich 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.InternalRequest
contentType, DEFAULT_METHOD, extension, log, MDC_KEY, path, requestMethod, resourceResolver, selectorString
-
-
Constructor Summary
Constructors Constructor Description SlingInternalRequest(@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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddelegateExecute(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, org.apache.sling.api.resource.ResourceResolver resourceResolver)Execute the supplied Requestprotected org.apache.sling.api.resource.ResourcegetExecutionResource()Provide the Resource to use to execute the requestStringtoString()Return essential request info, used to set the logging MDCSlingInternalRequestwithResourceSuperType(String resourceSuperType)Sets the sling:resourceSuperType of the fake Resource used to resolve the Script or Servlet used for the internal requestSlingInternalRequestwithResourceType(String resourceType)Sets the sling:resourceType of the fake Resource used to resolve the Script or Servlet used for the internal request-
Methods inherited from class org.apache.sling.servlethelpers.internalrequests.InternalRequest
assertRequestExecuted, checkNotNull, checkNotNull, checkResponseContentType, checkStatus, execute, getResponse, getResponseAsString, getStatus, withBody, withContentType, withExtension, withParameter, withParameters, withRequestMethod, withSelectors
-
-
-
-
Constructor Detail
-
SlingInternalRequest
public SlingInternalRequest(@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 Detail
-
toString
public String toString()
Return essential request info, used to set the logging MDC
-
withResourceSuperType
public SlingInternalRequest withResourceSuperType(String resourceSuperType)
Sets the sling:resourceSuperType of the fake Resource used to resolve the Script or Servlet used for the internal request
-
withResourceType
public SlingInternalRequest withResourceType(String resourceType)
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.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, org.apache.sling.api.resource.ResourceResolver resourceResolver) throws javax.servlet.ServletException, IOExceptionDescription copied from class:InternalRequestExecute the supplied Request- Specified by:
delegateExecutein classInternalRequest- Throws:
javax.servlet.ServletExceptionIOException
-
getExecutionResource
protected org.apache.sling.api.resource.Resource getExecutionResource()
Description copied from class:InternalRequestProvide the Resource to use to execute the request- Specified by:
getExecutionResourcein classInternalRequest
-
-