Package com.oorian.jakarta
Class JakartaAppContext
java.lang.Object
com.oorian.jakarta.JakartaAppContext
- All Implemented Interfaces:
AppContext
Adapter that wraps a
ServletContext to implement the
framework-agnostic AppContext interface.
This class is used by the thin Jakarta library to bridge between the servlet container and the Oorian common library.
- Since:
- 2.1
- Version:
- 1.0
- Author:
- Oorian Framework
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionJakartaAppContext(jakarta.servlet.ServletContext context) Creates a new adapter wrapping the given servlet context. -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String name) Returns the value of the named context attribute.Returns the context path of the web application.jakarta.servlet.ServletContextReturns the underlying Jakarta servlet context.getInitParameter(String name) Returns the value of the named context initialization parameter.getMimeType(String file) Returns the MIME type of the specified file, or null if unknown.getRealPath(String path) Returns the real filesystem path for the specified virtual path.getResourceAsStream(String path) Returns an input stream for reading the specified resource.voidsetAttribute(String name, Object value) Sets a context attribute.
-
Constructor Details
-
JakartaAppContext
public JakartaAppContext(jakarta.servlet.ServletContext context) Creates a new adapter wrapping the given servlet context.- Parameters:
context- The Jakarta servlet context to wrap.
-
-
Method Details
-
getContextPath
Description copied from interface:AppContextReturns the context path of the web application.- Specified by:
getContextPathin interfaceAppContext- Returns:
- the context path
-
getResourceAsStream
Description copied from interface:AppContextReturns an input stream for reading the specified resource.- Specified by:
getResourceAsStreamin interfaceAppContext- Parameters:
path- the resource path (e.g., "/WEB-INF/config.xml")- Returns:
- an input stream for the resource, or null if not found
-
getRealPath
Description copied from interface:AppContextReturns the real filesystem path for the specified virtual path.- Specified by:
getRealPathin interfaceAppContext- Parameters:
path- the virtual path (e.g., "/WEB-INF/config.xml")- Returns:
- the real path, or null if the translation cannot be performed
-
getAttribute
Description copied from interface:AppContextReturns the value of the named context attribute.- Specified by:
getAttributein interfaceAppContext- Parameters:
name- the attribute name- Returns:
- the attribute value, or null if not set
-
setAttribute
Description copied from interface:AppContextSets a context attribute.- Specified by:
setAttributein interfaceAppContext- Parameters:
name- the attribute namevalue- the attribute value
-
getInitParameter
Description copied from interface:AppContextReturns the value of the named context initialization parameter.- Specified by:
getInitParameterin interfaceAppContext- Parameters:
name- the parameter name- Returns:
- the parameter value, or null if not defined
-
getMimeType
Description copied from interface:AppContextReturns the MIME type of the specified file, or null if unknown.- Specified by:
getMimeTypein interfaceAppContext- Parameters:
file- the file name- Returns:
- the MIME type, or null
-
getDelegate
public jakarta.servlet.ServletContext getDelegate()Returns the underlying Jakarta servlet context.- Returns:
- The wrapped
ServletContext.
-