Package com.oorian
Interface AppContext
- All Known Implementing Classes:
JakartaAppContext,TestAppContext
public interface AppContext
Abstraction layer for servlet context access, decoupling framework code from servlet API specifics.
This interface wraps the subset of servlet context methods used by the Oorian framework, primarily resource loading and context path access.
- Since:
- 2.1
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
-
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String name) Returns the value of the named context attribute.Returns the context path of the web application.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.
-
Method Details
-
getContextPath
String getContextPath()Returns the context path of the web application.- Returns:
- the context path
-
getResourceAsStream
Returns an input stream for reading the specified resource.- Parameters:
path- the resource path (e.g., "/WEB-INF/config.xml")- Returns:
- an input stream for the resource, or null if not found
-
getRealPath
Returns the real filesystem path for the specified virtual path.- Parameters:
path- the virtual path (e.g., "/WEB-INF/config.xml")- Returns:
- the real path, or null if the translation cannot be performed
-
getAttribute
Returns the value of the named context attribute.- Parameters:
name- the attribute name- Returns:
- the attribute value, or null if not set
-
setAttribute
Sets a context attribute.- Parameters:
name- the attribute namevalue- the attribute value
-
getInitParameter
Returns the value of the named context initialization parameter.- Parameters:
name- the parameter name- Returns:
- the parameter value, or null if not defined
-
getMimeType
Returns the MIME type of the specified file, or null if unknown.- Parameters:
file- the file name- Returns:
- the MIME type, or null
-