Package org.apache.felix.http.base.internal.whiteboard

# Class PerBundleServletContextImpl

java.lang.Object
org.apache.felix.http.base.internal.whiteboard.PerBundleServletContextImpl

All Implemented Interfaces:
  `jakarta.servlet.ServletContext`, `ExtServletContext`

public class PerBundleServletContextImpl extends Object implements ExtServletContext
This servlet context implementation represents the per bundle specific part of a servlet context backed by a servlet context helper.

## Field Summary

### Fields inherited from interface jakarta.servlet.ServletContext

`ORDERED_LIBS, TEMPDIR`

## Constructor Summary

Constructors
Constructor
Description
`PerBundleServletContextImpl(org.osgi.framework.Bundle bundle, jakarta.servlet.ServletContext sharedContext, org.osgi.service.servlet.context.ServletContextHelper delegatee, PerContextHandlerRegistry handlerRegistry)`
Create a new context implementation

## Method Summary

Modifier and Type
Method
Description
`jakarta.servlet.FilterRegistration.Dynamic`
`addFilter(String filterName, jakarta.servlet.Filter filter)`
`jakarta.servlet.FilterRegistration.Dynamic`
`addFilter(String filterName, Class<? extends jakarta.servlet.Filter> filterClass)`
`jakarta.servlet.FilterRegistration.Dynamic`
`addFilter(String filterName, String className)`
`jakarta.servlet.ServletRegistration.Dynamic`
`addJspFile(String servletName, String jspFile)`
`void`
`addListener(Class<? extends EventListener> listenerClass)`
`void`
`addListener(String className)`
`<T extends EventListener>
void`
`addListener(T t)`
`jakarta.servlet.ServletRegistration.Dynamic`
`addServlet(String servletName, jakarta.servlet.Servlet servlet)`
`jakarta.servlet.ServletRegistration.Dynamic`
`addServlet(String servletName, Class<? extends jakarta.servlet.Servlet> servletClass)`
`jakarta.servlet.ServletRegistration.Dynamic`
`addServlet(String servletName, String className)`
`<T extends jakarta.servlet.Filter>
T`
`createFilter(Class<T> clazz)`
`<T extends EventListener>
T`
`createListener(Class<T> clazz)`
`<T extends jakarta.servlet.Servlet>
T`
`createServlet(Class<T> clazz)`
`void`
`declareRoles(String... roleNames)`
`void`
`finishSecurity(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res)`
`Object`
`getAttribute(String name)`
`Enumeration<String>`
`getAttributeNames()`
`ClassLoader`
`getClassLoader()`
`org.apache.felix.http.base.internal.HttpConfig`
`getConfig()`
`jakarta.servlet.ServletContext`
`getContext(String uripath)`
`String`
`getContextPath()`
`Set<jakarta.servlet.SessionTrackingMode>`
`getDefaultSessionTrackingModes()`
`int`
`getEffectiveMajorVersion()`
`int`
`getEffectiveMinorVersion()`
`Set<jakarta.servlet.SessionTrackingMode>`
`getEffectiveSessionTrackingModes()`
`jakarta.servlet.FilterRegistration`
`getFilterRegistration(String filterName)`
`Map<String,? extends jakarta.servlet.FilterRegistration>`
`getFilterRegistrations()`
`jakarta.servlet.http.HttpSessionAttributeListener`
`getHttpSessionAttributeListener()`
`jakarta.servlet.http.HttpSessionListener`
`getHttpSessionListener()`
`String`
`getInitParameter(String name)`
`Enumeration<String>`
`getInitParameterNames()`
`jakarta.servlet.descriptor.JspConfigDescriptor`
`getJspConfigDescriptor()`
`int`
`getMajorVersion()`
`String`
`getMimeType(String name)`
`int`
`getMinorVersion()`
`jakarta.servlet.RequestDispatcher`
`getNamedDispatcher(String name)`
`String`
`getRealPath(String path)`
`String`
`getRequestCharacterEncoding()`
`jakarta.servlet.RequestDispatcher`
`getRequestDispatcher(String path)`
`URL`
`getResource(String path)`
`InputStream`
`getResourceAsStream(String path)`
`Set<String>`
`getResourcePaths(String path)`
`String`
`getResponseCharacterEncoding()`
`String`
`getServerInfo()`
`jakarta.servlet.Servlet`
`getServlet(String name)`
`String`
`getServletContextName()`
`Enumeration<String>`
`getServletNames()`
`jakarta.servlet.ServletRegistration`
`getServletRegistration(String servletName)`
`Map<String,? extends jakarta.servlet.ServletRegistration>`
`getServletRegistrations()`
`jakarta.servlet.ServletRequestAttributeListener`
`getServletRequestAttributeListener()`
`jakarta.servlet.ServletRequestListener`
`getServletRequestListener()`
`Enumeration<jakarta.servlet.Servlet>`
`getServlets()`
`jakarta.servlet.SessionCookieConfig`
`getSessionCookieConfig()`
`int`
`getSessionTimeout()`
`String`
`getVirtualServerName()`
`boolean`
`handleSecurity(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res)`
`void`
`log(Exception exception, String msg)`
`void`
`log(String msg)`
`void`
`log(String message, Throwable throwable)`
`void`
`removeAttribute(String name)`
`void`
`setAttribute(String name, Object object)`
`boolean`
`setInitParameter(String name, String value)`
`void`
`setRequestCharacterEncoding(String encoding)`
`void`
`setResponseCharacterEncoding(String encoding)`
`void`
`setSessionTimeout(int sessionTimeout)`
`void`
`setSessionTrackingModes(Set<jakarta.servlet.SessionTrackingMode> sessionTrackingModes)`

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

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

### Methods inherited from interface jakarta.servlet.ServletContext

`setRequestCharacterEncoding, setResponseCharacterEncoding`

## Constructor Details

### PerBundleServletContextImpl

public PerBundleServletContextImpl(org.osgi.framework.Bundle bundle, jakarta.servlet.ServletContext sharedContext, org.osgi.service.servlet.context.ServletContextHelper delegatee, PerContextHandlerRegistry handlerRegistry)
Create a new context implementation

Parameters:
  `bundle` - The bundle
  `sharedContext` - The shared context
  `delegatee` - The delegatee
  `handlerRegistry` - The handler registry

## Method Details

### handleSecurity

public boolean handleSecurity(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) throws IOException

Specified by:
  `handleSecurity` in interface `ExtServletContext`
Throws:
  `IOException`

### finishSecurity

public void finishSecurity(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res)

Specified by:
  `finishSecurity` in interface `ExtServletContext`

### getHttpSessionListener

public jakarta.servlet.http.HttpSessionListener getHttpSessionListener()

Specified by:
  `getHttpSessionListener` in interface `ExtServletContext`

### getHttpSessionAttributeListener

public jakarta.servlet.http.HttpSessionAttributeListener getHttpSessionAttributeListener()

Specified by:
  `getHttpSessionAttributeListener` in interface `ExtServletContext`

### getServletRequestListener

public jakarta.servlet.ServletRequestListener getServletRequestListener()

Specified by:
  `getServletRequestListener` in interface `ExtServletContext`

### getServletRequestAttributeListener

public jakarta.servlet.ServletRequestAttributeListener getServletRequestAttributeListener()

Specified by:
  `getServletRequestAttributeListener` in interface `ExtServletContext`

### getConfig

public org.apache.felix.http.base.internal.HttpConfig getConfig()

Specified by:
  `getConfig` in interface `ExtServletContext`

### getClassLoader

public ClassLoader getClassLoader()

Specified by:
  `getClassLoader` in interface `jakarta.servlet.ServletContext`

### getResource

public URL getResource(String path)

Specified by:
  `getResource` in interface `jakarta.servlet.ServletContext`

### getMimeType

public String getMimeType(String name)

Specified by:
  `getMimeType` in interface `jakarta.servlet.ServletContext`

### getRealPath

public String getRealPath(String path)

Specified by:
  `getRealPath` in interface `jakarta.servlet.ServletContext`

### getResourcePaths

public Set<String> getResourcePaths(String path)

Specified by:
  `getResourcePaths` in interface `jakarta.servlet.ServletContext`

### getContextPath

public String getContextPath()

Specified by:
  `getContextPath` in interface `jakarta.servlet.ServletContext`

### getContext

public jakarta.servlet.ServletContext getContext(String uripath)

Specified by:
  `getContext` in interface `jakarta.servlet.ServletContext`

### getMajorVersion

public int getMajorVersion()

Specified by:
  `getMajorVersion` in interface `jakarta.servlet.ServletContext`

### getMinorVersion

public int getMinorVersion()

Specified by:
  `getMinorVersion` in interface `jakarta.servlet.ServletContext`

### getEffectiveMajorVersion

public int getEffectiveMajorVersion()

Specified by:
  `getEffectiveMajorVersion` in interface `jakarta.servlet.ServletContext`

### getEffectiveMinorVersion

public int getEffectiveMinorVersion()

Specified by:
  `getEffectiveMinorVersion` in interface `jakarta.servlet.ServletContext`

### getResourceAsStream

public InputStream getResourceAsStream(String path)

Specified by:
  `getResourceAsStream` in interface `jakarta.servlet.ServletContext`

### getRequestDispatcher

public jakarta.servlet.RequestDispatcher getRequestDispatcher(String path)

Specified by:
  `getRequestDispatcher` in interface `jakarta.servlet.ServletContext`

### getNamedDispatcher

public jakarta.servlet.RequestDispatcher getNamedDispatcher(String name)

Specified by:
  `getNamedDispatcher` in interface `jakarta.servlet.ServletContext`

### getServlet

public jakarta.servlet.Servlet getServlet(String name) throws jakarta.servlet.ServletException

Throws:
  `jakarta.servlet.ServletException`

### getServlets

public Enumeration<jakarta.servlet.Servlet> getServlets()

### getServletNames

public Enumeration<String> getServletNames()

### log

public void log(String msg)

Specified by:
  `log` in interface `jakarta.servlet.ServletContext`

### log

public void log(Exception exception, String msg)

### log

public void log(String message, Throwable throwable)

Specified by:
  `log` in interface `jakarta.servlet.ServletContext`

### getServerInfo

public String getServerInfo()

Specified by:
  `getServerInfo` in interface `jakarta.servlet.ServletContext`

### getInitParameter

public String getInitParameter(String name)

Specified by:
  `getInitParameter` in interface `jakarta.servlet.ServletContext`

### getInitParameterNames

public Enumeration<String> getInitParameterNames()

Specified by:
  `getInitParameterNames` in interface `jakarta.servlet.ServletContext`

### setInitParameter

public boolean setInitParameter(String name, String value)

Specified by:
  `setInitParameter` in interface `jakarta.servlet.ServletContext`

### getAttribute

public Object getAttribute(String name)

Specified by:
  `getAttribute` in interface `jakarta.servlet.ServletContext`

### getAttributeNames

public Enumeration<String> getAttributeNames()

Specified by:
  `getAttributeNames` in interface `jakarta.servlet.ServletContext`

### setAttribute

public void setAttribute(String name, Object object)

Specified by:
  `setAttribute` in interface `jakarta.servlet.ServletContext`

### removeAttribute

public void removeAttribute(String name)

Specified by:
  `removeAttribute` in interface `jakarta.servlet.ServletContext`

### getServletContextName

public String getServletContextName()

Specified by:
  `getServletContextName` in interface `jakarta.servlet.ServletContext`

### addServlet

public jakarta.servlet.ServletRegistration.Dynamic addServlet(String servletName, String className)

Specified by:
  `addServlet` in interface `jakarta.servlet.ServletContext`

### addServlet

public jakarta.servlet.ServletRegistration.Dynamic addServlet(String servletName, jakarta.servlet.Servlet servlet)

Specified by:
  `addServlet` in interface `jakarta.servlet.ServletContext`

### addServlet

public jakarta.servlet.ServletRegistration.Dynamic addServlet(String servletName, Class<? extends jakarta.servlet.Servlet> servletClass)

Specified by:
  `addServlet` in interface `jakarta.servlet.ServletContext`

### createServlet

public <T extends jakarta.servlet.Servlet> T createServlet(Class<T> clazz) throws jakarta.servlet.ServletException

Specified by:
  `createServlet` in interface `jakarta.servlet.ServletContext`
Throws:
  `jakarta.servlet.ServletException`

### getServletRegistration

public jakarta.servlet.ServletRegistration getServletRegistration(String servletName)

Specified by:
  `getServletRegistration` in interface `jakarta.servlet.ServletContext`

### getServletRegistrations

public Map<String,? extends jakarta.servlet.ServletRegistration> getServletRegistrations()

Specified by:
  `getServletRegistrations` in interface `jakarta.servlet.ServletContext`

### addFilter

public jakarta.servlet.FilterRegistration.Dynamic addFilter(String filterName, String className)

Specified by:
  `addFilter` in interface `jakarta.servlet.ServletContext`

### addFilter

public jakarta.servlet.FilterRegistration.Dynamic addFilter(String filterName, jakarta.servlet.Filter filter)

Specified by:
  `addFilter` in interface `jakarta.servlet.ServletContext`

### addFilter

public jakarta.servlet.FilterRegistration.Dynamic addFilter(String filterName, Class<? extends jakarta.servlet.Filter> filterClass)

Specified by:
  `addFilter` in interface `jakarta.servlet.ServletContext`

### createFilter

public <T extends jakarta.servlet.Filter> T createFilter(Class<T> clazz) throws jakarta.servlet.ServletException

Specified by:
  `createFilter` in interface `jakarta.servlet.ServletContext`
Throws:
  `jakarta.servlet.ServletException`

### getFilterRegistration

public jakarta.servlet.FilterRegistration getFilterRegistration(String filterName)

Specified by:
  `getFilterRegistration` in interface `jakarta.servlet.ServletContext`

### getFilterRegistrations

public Map<String,? extends jakarta.servlet.FilterRegistration> getFilterRegistrations()

Specified by:
  `getFilterRegistrations` in interface `jakarta.servlet.ServletContext`

### getSessionCookieConfig

public jakarta.servlet.SessionCookieConfig getSessionCookieConfig()

Specified by:
  `getSessionCookieConfig` in interface `jakarta.servlet.ServletContext`

### setSessionTrackingModes

public void setSessionTrackingModes(Set<jakarta.servlet.SessionTrackingMode> sessionTrackingModes)

Specified by:
  `setSessionTrackingModes` in interface `jakarta.servlet.ServletContext`

### getDefaultSessionTrackingModes

public Set<jakarta.servlet.SessionTrackingMode> getDefaultSessionTrackingModes()

Specified by:
  `getDefaultSessionTrackingModes` in interface `jakarta.servlet.ServletContext`

### getEffectiveSessionTrackingModes

public Set<jakarta.servlet.SessionTrackingMode> getEffectiveSessionTrackingModes()

Specified by:
  `getEffectiveSessionTrackingModes` in interface `jakarta.servlet.ServletContext`

### addListener

public void addListener(String className)

Specified by:
  `addListener` in interface `jakarta.servlet.ServletContext`

### addListener

public <T extends EventListener> void addListener(T t)

Specified by:
  `addListener` in interface `jakarta.servlet.ServletContext`

### addListener

public void addListener(Class<? extends EventListener> listenerClass)

Specified by:
  `addListener` in interface `jakarta.servlet.ServletContext`

### createListener

public <T extends EventListener> T createListener(Class<T> clazz) throws jakarta.servlet.ServletException

Specified by:
  `createListener` in interface `jakarta.servlet.ServletContext`
Throws:
  `jakarta.servlet.ServletException`

### getJspConfigDescriptor

public jakarta.servlet.descriptor.JspConfigDescriptor getJspConfigDescriptor()

Specified by:
  `getJspConfigDescriptor` in interface `jakarta.servlet.ServletContext`

### declareRoles

public void declareRoles(String... roleNames)

Specified by:
  `declareRoles` in interface `jakarta.servlet.ServletContext`

### getVirtualServerName

public String getVirtualServerName()

Specified by:
  `getVirtualServerName` in interface `jakarta.servlet.ServletContext`

### addJspFile

public jakarta.servlet.ServletRegistration.Dynamic addJspFile(String servletName, String jspFile)

Specified by:
  `addJspFile` in interface `jakarta.servlet.ServletContext`

### getSessionTimeout

public int getSessionTimeout()

Specified by:
  `getSessionTimeout` in interface `jakarta.servlet.ServletContext`

### setSessionTimeout

public void setSessionTimeout(int sessionTimeout)

Specified by:
  `setSessionTimeout` in interface `jakarta.servlet.ServletContext`

### getRequestCharacterEncoding

public String getRequestCharacterEncoding()

Specified by:
  `getRequestCharacterEncoding` in interface `jakarta.servlet.ServletContext`

### setRequestCharacterEncoding

public void setRequestCharacterEncoding(String encoding)

Specified by:
  `setRequestCharacterEncoding` in interface `jakarta.servlet.ServletContext`

### getResponseCharacterEncoding

public String getResponseCharacterEncoding()

Specified by:
  `getResponseCharacterEncoding` in interface `jakarta.servlet.ServletContext`

### setResponseCharacterEncoding

public void setResponseCharacterEncoding(String encoding)

Specified by:
  `setResponseCharacterEncoding` in interface `jakarta.servlet.ServletContext`