Package org.apache.sling.testing.mock.sling

# Class MockSlingScriptHelper

java.lang.Object
org.apache.sling.testing.mock.sling.MockSlingScriptHelper

All Implemented Interfaces:
  `org.apache.sling.api.scripting.SlingScriptHelper`

public final class MockSlingScriptHelper extends Object implements org.apache.sling.api.scripting.SlingScriptHelper
Mock `SlingScriptHelper` implementation.

## Constructor Summary

Constructors
Constructor
Description
`MockSlingScriptHelper(@NotNull org.apache.sling.api.SlingJakartaHttpServletRequest request, @NotNull org.apache.sling.api.SlingJakartaHttpServletResponse response, @NotNull org.osgi.framework.BundleContext bundleContext)`
`MockSlingScriptHelper(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, @NotNull org.osgi.framework.BundleContext bundleContext)`
Deprecated.
Use `MockSlingScriptHelper(SlingJakartaHttpServletRequest, SlingJakartaHttpServletResponse, BundleContext)` instead.

## Method Summary

Modifier and Type
Method
Description
`void`
`dispose()`
`void`
`forward(@NotNull String path)`
`void`
`forward(@NotNull String path, String requestDispatcherOptions)`
`void`
`forward(@NotNull String path, org.apache.sling.api.request.RequestDispatcherOptions requestDispatcherOptions)`
`void`
`forward(@NotNull org.apache.sling.api.resource.Resource resource)`
`void`
`forward(@NotNull org.apache.sling.api.resource.Resource resource, String requestDispatcherOptions)`
`void`
`forward(@NotNull org.apache.sling.api.resource.Resource resource, org.apache.sling.api.request.RequestDispatcherOptions requestDispatcherOptions)`
`@NotNull org.apache.sling.api.SlingJakartaHttpServletRequest`
`getJakartaRequest()`
`@NotNull org.apache.sling.api.SlingJakartaHttpServletResponse`
`getJakartaResponse()`
`org.apache.sling.api.SlingHttpServletRequest`
`getRequest()`
Deprecated.
Use `getJakartaRequest()` instead.
`org.apache.sling.api.SlingHttpServletResponse`
`getResponse()`
Deprecated.
Use `getJakartaResponse()` instead.
`@NotNull org.apache.sling.api.scripting.SlingScript`
`getScript()`
`<T> T`
`getService(@NotNull Class<T> serviceType)`
`<T> T[]`
`getServices(@NotNull Class<T> serviceType, String filter)`
`void`
`include(@NotNull String path)`
`void`
`include(@NotNull String path, String requestDispatcherOptions)`
`void`
`include(@NotNull String path, org.apache.sling.api.request.RequestDispatcherOptions requestDispatcherOptions)`
`void`
`include(@NotNull org.apache.sling.api.resource.Resource resource)`
`void`
`include(@NotNull org.apache.sling.api.resource.Resource resource, String requestDispatcherOptions)`
`void`
`include(@NotNull org.apache.sling.api.resource.Resource resource, org.apache.sling.api.request.RequestDispatcherOptions requestDispatcherOptions)`
`void`
`setScript(@NotNull org.apache.sling.api.scripting.SlingScript script)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### MockSlingScriptHelper

@Deprecated(since="4.1.0") public MockSlingScriptHelper(@NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull org.apache.sling.api.SlingHttpServletResponse response, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext)
Deprecated.
Use `MockSlingScriptHelper(SlingJakartaHttpServletRequest, SlingJakartaHttpServletResponse, BundleContext)` instead.

Parameters:
  `request` - Sling HTTP servlet request
  `response` - Sling HTTP servlet response
  `bundleContext` - OSGi bundle context

### MockSlingScriptHelper

public MockSlingScriptHelper(@NotNull @NotNull org.apache.sling.api.SlingJakartaHttpServletRequest request, @NotNull @NotNull org.apache.sling.api.SlingJakartaHttpServletResponse response, @NotNull @NotNull org.osgi.framework.BundleContext bundleContext)

Parameters:
  `request` - Sling HTTP servlet request
  `response` - Sling HTTP servlet response
  `bundleContext` - OSGi bundle context

## Method Details

### getJakartaRequest

@NotNull public @NotNull org.apache.sling.api.SlingJakartaHttpServletRequest getJakartaRequest()

Specified by:
  `getJakartaRequest` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### getJakartaResponse

@NotNull public @NotNull org.apache.sling.api.SlingJakartaHttpServletResponse getJakartaResponse()

Specified by:
  `getJakartaResponse` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### getRequest

@Deprecated(since="4.1.0") @NotNull public org.apache.sling.api.SlingHttpServletRequest getRequest()
Deprecated.
Use `getJakartaRequest()` instead.

Specified by:
  `getRequest` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### getResponse

@Deprecated(since="4.1.0") @NotNull public org.apache.sling.api.SlingHttpServletResponse getResponse()
Deprecated.
Use `getJakartaResponse()` instead.

Specified by:
  `getResponse` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### getService

@Nullable public <T> T getService(@NotNull @NotNull Class<T> serviceType)

Specified by:
  `getService` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### getServices

@Nullable public <T> T[] getServices(@NotNull @NotNull Class<T> serviceType, String filter)

Specified by:
  `getServices` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### getScript

@NotNull public @NotNull org.apache.sling.api.scripting.SlingScript getScript()

Specified by:
  `getScript` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### setScript

public void setScript(@NotNull @NotNull org.apache.sling.api.scripting.SlingScript script)

Parameters:
  `script` - Script

### dispose

public void dispose()

Specified by:
  `dispose` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### forward

public void forward(@NotNull @NotNull String path, org.apache.sling.api.request.RequestDispatcherOptions requestDispatcherOptions)

Specified by:
  `forward` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### forward

public void forward(@NotNull @NotNull String path, String requestDispatcherOptions)

Specified by:
  `forward` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### forward

public void forward(@NotNull @NotNull String path)

Specified by:
  `forward` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### forward

public void forward(@NotNull @NotNull org.apache.sling.api.resource.Resource resource)

Specified by:
  `forward` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### forward

public void forward(@NotNull @NotNull org.apache.sling.api.resource.Resource resource, String requestDispatcherOptions)

Specified by:
  `forward` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### forward

public void forward(@NotNull @NotNull org.apache.sling.api.resource.Resource resource, org.apache.sling.api.request.RequestDispatcherOptions requestDispatcherOptions)

Specified by:
  `forward` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### include

public void include(@NotNull @NotNull String path, org.apache.sling.api.request.RequestDispatcherOptions requestDispatcherOptions)

Specified by:
  `include` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### include

public void include(@NotNull @NotNull String path, String requestDispatcherOptions)

Specified by:
  `include` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### include

public void include(@NotNull @NotNull String path)

Specified by:
  `include` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### include

public void include(@NotNull @NotNull org.apache.sling.api.resource.Resource resource)

Specified by:
  `include` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### include

public void include(@NotNull @NotNull org.apache.sling.api.resource.Resource resource, String requestDispatcherOptions)

Specified by:
  `include` in interface `org.apache.sling.api.scripting.SlingScriptHelper`

### include

public void include(@NotNull @NotNull org.apache.sling.api.resource.Resource resource, org.apache.sling.api.request.RequestDispatcherOptions requestDispatcherOptions)

Specified by:
  `include` in interface `org.apache.sling.api.scripting.SlingScriptHelper`