Package org.apache.sling.api.wrappers

# Class JakartaToJavaxServletWrapper

java.lang.Object
org.apache.sling.api.wrappers.JakartaToJavaxServletWrapper

All Implemented Interfaces:
  `javax.servlet.Servlet`

Direct Known Subclasses:
  `JakartaToJavaxServletWrapper.JakartaToJavaxOptingServletWrapper`

public class JakartaToJavaxServletWrapper extends Object implements javax.servlet.Servlet
This class wraps a servlet based on the Jakarta Servlet API to implement Servlet API 3.

Since:
  2.9.0

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`JakartaToJavaxServletWrapper.JakartaToJavaxOptingServletWrapper`

## Constructor Summary

Constructors
Constructor
Description
`JakartaToJavaxServletWrapper(jakarta.servlet.Servlet servlet)`

## Method Summary

Modifier and Type
Method
Description
`void`
`destroy()`
`javax.servlet.ServletConfig`
`getServletConfig()`
`String`
`getServletInfo()`
`void`
`init(javax.servlet.ServletConfig config)`
`void`
`service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)`
`static @Nullable javax.servlet.Servlet`
`toJavaxServlet(jakarta.servlet.Servlet servlet)`
Create a new wrapper

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

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

## Constructor Details

### JakartaToJavaxServletWrapper

public JakartaToJavaxServletWrapper(jakarta.servlet.Servlet servlet)

## Method Details

### toJavaxServlet

@Nullable public static @Nullable javax.servlet.Servlet toJavaxServlet(@Nullable jakarta.servlet.Servlet servlet)
Create a new wrapper

Parameters:
  `servlet` - The servlet to wrap
Returns:
  The wrapped servlet

### init

public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException

Specified by:
  `init` in interface `javax.servlet.Servlet`
Throws:
  `javax.servlet.ServletException`

### service

public void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) throws javax.servlet.ServletException, IOException

Specified by:
  `service` in interface `javax.servlet.Servlet`
Throws:
  `javax.servlet.ServletException`
  `IOException`

### destroy

public void destroy()

Specified by:
  `destroy` in interface `javax.servlet.Servlet`

### getServletConfig

public javax.servlet.ServletConfig getServletConfig()

Specified by:
  `getServletConfig` in interface `javax.servlet.Servlet`

### getServletInfo

public String getServletInfo()

Specified by:
  `getServletInfo` in interface `javax.servlet.Servlet`