|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.sling.maven.jspc.JspCServletContext
public class JspCServletContext
Simple ServletContext
implementation without HTTP-specific
methods.
This class has been copied from the JspCServletContext of the
Jasper 5.5.20 distribution and reformated to match the formating rules of
Sling. Additionally, the getResource(String)
method has special
knowledge of the /WEB-INF/web.xml file, which is not required by
the JspC plugin but by the TldLocationsCache. Hence this method simulates
the web.xml with an embedded empty resource.
Field Summary | |
---|---|
protected Hashtable<String,Object> |
attributes
Servlet context attributes. |
protected org.apache.maven.plugin.logging.Log |
log
The log writer we will write log messages to. |
protected URL |
resourceBaseURL
The base URL (document root) for this context. |
Constructor Summary | |
---|---|
JspCServletContext(org.apache.maven.plugin.logging.Log log,
URL resourceBaseURL)
Create a new instance of this ServletContext implementation. |
Method Summary | |
---|---|
Object |
getAttribute(String name)
Return the specified context attribute, if any. |
Enumeration<String> |
getAttributeNames()
Return an enumeration of context attribute names. |
javax.servlet.ServletContext |
getContext(String uripath)
Return the servlet context for the specified path. |
String |
getContextPath()
Return "/" as the context path for compilation. |
String |
getInitParameter(String name)
Return the specified context initialization parameter. |
Enumeration<String> |
getInitParameterNames()
Return an enumeration of the names of context initialization parameters. |
int |
getMajorVersion()
Return the Servlet API major version number. |
String |
getMimeType(String file)
Return the MIME type for the specified filename. |
int |
getMinorVersion()
Return the Servlet API minor version number. |
javax.servlet.RequestDispatcher |
getNamedDispatcher(String name)
Return a request dispatcher for the specified servlet name. |
String |
getRealPath(String path)
Return the real path for the specified context-relative virtual path. |
javax.servlet.RequestDispatcher |
getRequestDispatcher(String path)
Return a request dispatcher for the specified context-relative path. |
URL |
getResource(String path)
Return a URL object of a resource that is mapped to the specified context-relative path. |
InputStream |
getResourceAsStream(String path)
Return an InputStream allowing access to the resource at the specified context-relative path. |
Set<String> |
getResourcePaths(String path)
Return the set of resource paths for the "directory" at the specified context path. |
String |
getServerInfo()
Return descriptive information about this server. |
javax.servlet.Servlet |
getServlet(String name)
Deprecated. This method has been deprecated with no replacement |
String |
getServletContextName()
Return the name of this servlet context. |
Enumeration<String> |
getServletNames()
Deprecated. This method has been deprecated with no replacement |
Enumeration<javax.servlet.Servlet> |
getServlets()
Deprecated. This method has been deprecated with no replacement |
void |
log(Exception exception,
String message)
Deprecated. Use log(String,Throwable) instead |
void |
log(String message)
Log the specified message. |
void |
log(String message,
Throwable exception)
Log the specified message and exception. |
void |
removeAttribute(String name)
Remove the specified context attribute. |
void |
setAttribute(String name,
Object value)
Set or replace the specified context attribute. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Hashtable<String,Object> attributes
protected org.apache.maven.plugin.logging.Log log
protected URL resourceBaseURL
Constructor Detail |
---|
public JspCServletContext(org.apache.maven.plugin.logging.Log log, URL resourceBaseURL)
log
- The Log which is used for log()
callsresourceBaseURL
- Resource base URLMethod Detail |
---|
public Object getAttribute(String name)
getAttribute
in interface javax.servlet.ServletContext
name
- Name of the requested attributepublic Enumeration<String> getAttributeNames()
getAttributeNames
in interface javax.servlet.ServletContext
public javax.servlet.ServletContext getContext(String uripath)
getContext
in interface javax.servlet.ServletContext
uripath
- Server-relative path starting with '/'public String getInitParameter(String name)
name
- Name of the requested parameterpublic Enumeration<String> getInitParameterNames()
public int getMajorVersion()
getMajorVersion
in interface javax.servlet.ServletContext
public String getMimeType(String file)
getMimeType
in interface javax.servlet.ServletContext
file
- Filename whose MIME type is requestedpublic int getMinorVersion()
getMinorVersion
in interface javax.servlet.ServletContext
public javax.servlet.RequestDispatcher getNamedDispatcher(String name)
name
- Name of the requested servletpublic String getRealPath(String path)
getRealPath
in interface javax.servlet.ServletContext
path
- The context-relative virtual path to resolvepublic javax.servlet.RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher
in interface javax.servlet.ServletContext
path
- Context-relative path for which to acquire a dispatcherpublic URL getResource(String path) throws MalformedURLException
getResource
in interface javax.servlet.ServletContext
path
- Context-relative path of the desired resource
MalformedURLException
- if the resource path is not properly
formedpublic InputStream getResourceAsStream(String path)
getResourceAsStream
in interface javax.servlet.ServletContext
path
- Context-relative path of the desired resourcepublic Set<String> getResourcePaths(String path)
path
- Context-relative base pathpublic String getServerInfo()
getServerInfo
in interface javax.servlet.ServletContext
@Deprecated public javax.servlet.Servlet getServlet(String name)
getServlet
in interface javax.servlet.ServletContext
name
- Name of the requested servletpublic String getServletContextName()
public String getContextPath()
@Deprecated public Enumeration<String> getServletNames()
getServletNames
in interface javax.servlet.ServletContext
@Deprecated public Enumeration<javax.servlet.Servlet> getServlets()
getServlets
in interface javax.servlet.ServletContext
public void log(String message)
log
in interface javax.servlet.ServletContext
message
- The message to be logged@Deprecated public void log(Exception exception, String message)
log
in interface javax.servlet.ServletContext
exception
- The exception to be loggedmessage
- The message to be loggedpublic void log(String message, Throwable exception)
log
in interface javax.servlet.ServletContext
message
- The message to be loggedexception
- The exception to be loggedpublic void removeAttribute(String name)
removeAttribute
in interface javax.servlet.ServletContext
name
- Name of the attribute to removepublic void setAttribute(String name, Object value)
setAttribute
in interface javax.servlet.ServletContext
name
- Name of the context attribute to setvalue
- Corresponding attribute value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |