gnu.kawa.servlet
Class CGIServletWrapper
java.lang.Object
java.io.OutputStream
javax.servlet.ServletOutputStream
gnu.kawa.servlet.CGIServletWrapper
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.ServletConfig, javax.servlet.ServletContext, javax.servlet.ServletRequest, javax.servlet.ServletResponse
public class CGIServletWrapper
- extends javax.servlet.ServletOutputStream
- implements javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.ServletConfig, javax.servlet.ServletContext
Wrapper class to allow a Servlet to be run as a CGI script.
Invoked as:
java CGI_ARGS... gnu.kawa.servlet.CGIServletWrapper SERVLET
where CGI_ARGS... are properties set from CGI environment variables (for
example -DPATH_INFO="foo") and SERVLET is the name of the servlet class.
The cgi-wrapper program in ../../../bin can used do this.
Fields inherited from interface javax.servlet.http.HttpServletRequest |
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
Fields inherited from interface javax.servlet.http.HttpServletResponse |
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_TIMEOUT, SC_REQUEST_URI_TOO_LONG, SC_REQUESTED_RANGE_NOT_SATISFIABLE, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_TEMPORARY_REDIRECT, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY |
Method Summary |
void |
addCookie(javax.servlet.http.Cookie cookie)
|
void |
addDateHeader(java.lang.String str,
long l)
|
void |
addHeader(java.lang.String label,
java.lang.String value)
|
void |
addIntHeader(java.lang.String str,
int i)
|
boolean |
containsHeader(java.lang.String str)
|
java.lang.String |
encodeRedirectUrl(java.lang.String str)
|
java.lang.String |
encodeRedirectURL(java.lang.String str)
|
java.lang.String |
encodeUrl(java.lang.String str)
|
java.lang.String |
encodeURL(java.lang.String str)
|
void |
flushBuffer()
|
java.lang.Object |
getAttribute(java.lang.String name)
|
java.util.Enumeration |
getAttributeNames()
|
java.lang.String |
getAuthType()
|
int |
getBufferSize()
|
java.lang.String |
getCgiEnvVar(java.lang.String name)
|
java.lang.String |
getCharacterEncoding()
|
int |
getContentLength()
|
java.lang.String |
getContentType()
|
javax.servlet.ServletContext |
getContext(java.lang.String path)
|
java.lang.String |
getContextPath()
|
javax.servlet.http.Cookie[] |
getCookies()
|
long |
getDateHeader(java.lang.String str)
|
java.lang.String |
getHeader(java.lang.String str)
|
java.util.Enumeration |
getHeaderNames()
|
java.util.Enumeration |
getHeaders(java.lang.String str)
|
java.lang.String |
getInitParameter(java.lang.String name)
|
java.util.Enumeration |
getInitParameterNames()
|
javax.servlet.ServletInputStream |
getInputStream()
|
int |
getIntHeader(java.lang.String str)
|
java.lang.String |
getLocalAddr()
|
java.util.Locale |
getLocale()
|
java.util.Enumeration |
getLocales()
|
java.lang.String |
getLocalName()
|
int |
getLocalPort()
|
int |
getMajorVersion()
|
java.lang.String |
getMethod()
|
java.lang.String |
getMimeType(java.lang.String file)
|
int |
getMinorVersion()
|
javax.servlet.RequestDispatcher |
getNamedDispatcher(java.lang.String path)
|
javax.servlet.ServletOutputStream |
getOutputStream()
|
java.lang.String |
getParameter(java.lang.String name)
|
java.util.Map |
getParameterMap()
|
java.util.Enumeration |
getParameterNames()
|
java.lang.String[] |
getParameterValues(java.lang.String name)
|
java.lang.String |
getPathInfo()
|
java.lang.String |
getPathTranslated()
|
java.lang.String |
getProtocol()
|
java.lang.String |
getQueryString()
|
java.io.BufferedReader |
getReader()
|
java.lang.String |
getRealPath(java.lang.String path)
|
java.lang.String |
getRemoteAddr()
|
java.lang.String |
getRemoteHost()
|
int |
getRemotePort()
|
java.lang.String |
getRemoteUser()
|
javax.servlet.RequestDispatcher |
getRequestDispatcher(java.lang.String path)
|
java.lang.String |
getRequestedSessionId()
|
java.lang.String |
getRequestURI()
|
java.lang.StringBuffer |
getRequestURL()
|
java.net.URL |
getResource(java.lang.String path)
|
java.io.InputStream |
getResourceAsStream(java.lang.String path)
|
java.util.Set |
getResourcePaths(java.lang.String path)
|
java.lang.String |
getScheme()
|
java.lang.String |
getServerInfo()
|
java.lang.String |
getServerName()
|
int |
getServerPort()
|
javax.servlet.Servlet |
getServlet(java.lang.String name)
|
javax.servlet.ServletContext |
getServletContext()
|
java.lang.String |
getServletContextName()
|
java.lang.String |
getServletName()
|
java.util.Enumeration |
getServletNames()
|
java.lang.String |
getServletPath()
|
java.util.Enumeration |
getServlets()
|
javax.servlet.http.HttpSession |
getSession()
|
javax.servlet.http.HttpSession |
getSession(boolean b)
|
java.security.Principal |
getUserPrincipal()
|
java.io.PrintWriter |
getWriter()
|
boolean |
isCommitted()
|
boolean |
isRequestedSessionIdFromCookie()
|
boolean |
isRequestedSessionIdFromUrl()
|
boolean |
isRequestedSessionIdFromURL()
|
boolean |
isRequestedSessionIdValid()
|
boolean |
isSecure()
|
boolean |
isUserInRole(java.lang.String role)
|
void |
log(java.lang.Exception ex,
java.lang.String mgs)
|
void |
log(java.lang.String message)
|
void |
log(java.lang.String msg,
java.lang.Throwable ex)
|
static void |
main(java.lang.String[] args)
|
void |
removeAttribute(java.lang.String name)
|
void |
reset()
|
void |
resetBuffer()
|
void |
sendError(int i)
|
void |
sendError(int i,
java.lang.String str)
|
void |
sendRedirect(java.lang.String str)
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
|
void |
setBufferSize(int size)
|
void |
setCharacterEncoding(java.lang.String enc)
|
void |
setContentLength(int len)
|
void |
setContentType(java.lang.String type)
|
void |
setDateHeader(java.lang.String str,
long l)
|
void |
setHeader(java.lang.String label,
java.lang.String value)
|
void |
setIntHeader(java.lang.String str,
int i)
|
void |
setLocale(java.util.Locale locale)
|
void |
setStatus(int i)
|
void |
setStatus(int i,
java.lang.String str)
|
void |
write(int c)
|
Methods inherited from class javax.servlet.ServletOutputStream |
print, print, print, print, print, print, print, println, println, println, println, println, println, println, println |
Methods inherited from class java.io.OutputStream |
close, flush, write, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CGIServletWrapper
public CGIServletWrapper()
main
public static void main(java.lang.String[] args)
write
public void write(int c)
throws java.io.IOException
- Specified by:
write
in class java.io.OutputStream
- Throws:
java.io.IOException
getCgiEnvVar
public java.lang.String getCgiEnvVar(java.lang.String name)
getOutputStream
public javax.servlet.ServletOutputStream getOutputStream()
- Specified by:
getOutputStream
in interface javax.servlet.ServletResponse
getWriter
public java.io.PrintWriter getWriter()
- Specified by:
getWriter
in interface javax.servlet.ServletResponse
getParameterMap
public java.util.Map getParameterMap()
- Specified by:
getParameterMap
in interface javax.servlet.ServletRequest
setBufferSize
public void setBufferSize(int size)
- Specified by:
setBufferSize
in interface javax.servlet.ServletResponse
getBufferSize
public int getBufferSize()
- Specified by:
getBufferSize
in interface javax.servlet.ServletResponse
setLocale
public void setLocale(java.util.Locale locale)
- Specified by:
setLocale
in interface javax.servlet.ServletResponse
flushBuffer
public void flushBuffer()
throws java.io.IOException
- Specified by:
flushBuffer
in interface javax.servlet.ServletResponse
- Throws:
java.io.IOException
resetBuffer
public void resetBuffer()
- Specified by:
resetBuffer
in interface javax.servlet.ServletResponse
reset
public void reset()
- Specified by:
reset
in interface javax.servlet.ServletResponse
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
- Specified by:
getAttribute
in interface javax.servlet.ServletContext
- Specified by:
getAttribute
in interface javax.servlet.ServletRequest
setAttribute
public void setAttribute(java.lang.String name,
java.lang.Object value)
- Specified by:
setAttribute
in interface javax.servlet.ServletContext
- Specified by:
setAttribute
in interface javax.servlet.ServletRequest
removeAttribute
public void removeAttribute(java.lang.String name)
- Specified by:
removeAttribute
in interface javax.servlet.ServletContext
- Specified by:
removeAttribute
in interface javax.servlet.ServletRequest
getAttributeNames
public java.util.Enumeration getAttributeNames()
- Specified by:
getAttributeNames
in interface javax.servlet.ServletContext
- Specified by:
getAttributeNames
in interface javax.servlet.ServletRequest
getContentType
public java.lang.String getContentType()
- Specified by:
getContentType
in interface javax.servlet.ServletRequest
getPathInfo
public java.lang.String getPathInfo()
- Specified by:
getPathInfo
in interface javax.servlet.http.HttpServletRequest
getPathTranslated
public java.lang.String getPathTranslated()
- Specified by:
getPathTranslated
in interface javax.servlet.http.HttpServletRequest
getRequestURI
public java.lang.String getRequestURI()
- Specified by:
getRequestURI
in interface javax.servlet.http.HttpServletRequest
getRequestURL
public java.lang.StringBuffer getRequestURL()
- Specified by:
getRequestURL
in interface javax.servlet.http.HttpServletRequest
getProtocol
public java.lang.String getProtocol()
- Specified by:
getProtocol
in interface javax.servlet.ServletRequest
getServerPort
public int getServerPort()
- Specified by:
getServerPort
in interface javax.servlet.ServletRequest
getLocalPort
public int getLocalPort()
getLocalAddr
public java.lang.String getLocalAddr()
getLocalName
public java.lang.String getLocalName()
getRemotePort
public int getRemotePort()
isSecure
public boolean isSecure()
- Specified by:
isSecure
in interface javax.servlet.ServletRequest
getServerName
public java.lang.String getServerName()
- Specified by:
getServerName
in interface javax.servlet.ServletRequest
getMethod
public java.lang.String getMethod()
- Specified by:
getMethod
in interface javax.servlet.http.HttpServletRequest
isCommitted
public boolean isCommitted()
- Specified by:
isCommitted
in interface javax.servlet.ServletResponse
getCharacterEncoding
public java.lang.String getCharacterEncoding()
- Specified by:
getCharacterEncoding
in interface javax.servlet.ServletRequest
- Specified by:
getCharacterEncoding
in interface javax.servlet.ServletResponse
setCharacterEncoding
public void setCharacterEncoding(java.lang.String enc)
- Specified by:
setCharacterEncoding
in interface javax.servlet.ServletRequest
setContentType
public void setContentType(java.lang.String type)
- Specified by:
setContentType
in interface javax.servlet.ServletResponse
setContentLength
public void setContentLength(int len)
- Specified by:
setContentLength
in interface javax.servlet.ServletResponse
addCookie
public void addCookie(javax.servlet.http.Cookie cookie)
- Specified by:
addCookie
in interface javax.servlet.http.HttpServletResponse
containsHeader
public boolean containsHeader(java.lang.String str)
- Specified by:
containsHeader
in interface javax.servlet.http.HttpServletResponse
encodeURL
public java.lang.String encodeURL(java.lang.String str)
- Specified by:
encodeURL
in interface javax.servlet.http.HttpServletResponse
encodeUrl
public java.lang.String encodeUrl(java.lang.String str)
- Specified by:
encodeUrl
in interface javax.servlet.http.HttpServletResponse
encodeRedirectURL
public java.lang.String encodeRedirectURL(java.lang.String str)
- Specified by:
encodeRedirectURL
in interface javax.servlet.http.HttpServletResponse
encodeRedirectUrl
public java.lang.String encodeRedirectUrl(java.lang.String str)
- Specified by:
encodeRedirectUrl
in interface javax.servlet.http.HttpServletResponse
sendError
public void sendError(int i,
java.lang.String str)
- Specified by:
sendError
in interface javax.servlet.http.HttpServletResponse
sendError
public void sendError(int i)
- Specified by:
sendError
in interface javax.servlet.http.HttpServletResponse
sendRedirect
public void sendRedirect(java.lang.String str)
- Specified by:
sendRedirect
in interface javax.servlet.http.HttpServletResponse
setDateHeader
public void setDateHeader(java.lang.String str,
long l)
- Specified by:
setDateHeader
in interface javax.servlet.http.HttpServletResponse
addDateHeader
public void addDateHeader(java.lang.String str,
long l)
- Specified by:
addDateHeader
in interface javax.servlet.http.HttpServletResponse
setHeader
public void setHeader(java.lang.String label,
java.lang.String value)
- Specified by:
setHeader
in interface javax.servlet.http.HttpServletResponse
setIntHeader
public void setIntHeader(java.lang.String str,
int i)
- Specified by:
setIntHeader
in interface javax.servlet.http.HttpServletResponse
addHeader
public void addHeader(java.lang.String label,
java.lang.String value)
- Specified by:
addHeader
in interface javax.servlet.http.HttpServletResponse
addIntHeader
public void addIntHeader(java.lang.String str,
int i)
- Specified by:
addIntHeader
in interface javax.servlet.http.HttpServletResponse
setStatus
public void setStatus(int i)
- Specified by:
setStatus
in interface javax.servlet.http.HttpServletResponse
setStatus
public void setStatus(int i,
java.lang.String str)
- Specified by:
setStatus
in interface javax.servlet.http.HttpServletResponse
getScheme
public java.lang.String getScheme()
- Specified by:
getScheme
in interface javax.servlet.ServletRequest
getLocales
public java.util.Enumeration getLocales()
- Specified by:
getLocales
in interface javax.servlet.ServletRequest
getRealPath
public java.lang.String getRealPath(java.lang.String path)
- Specified by:
getRealPath
in interface javax.servlet.ServletContext
- Specified by:
getRealPath
in interface javax.servlet.ServletRequest
getLocale
public java.util.Locale getLocale()
- Specified by:
getLocale
in interface javax.servlet.ServletRequest
- Specified by:
getLocale
in interface javax.servlet.ServletResponse
getRequestDispatcher
public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
- Specified by:
getRequestDispatcher
in interface javax.servlet.ServletContext
- Specified by:
getRequestDispatcher
in interface javax.servlet.ServletRequest
getRemoteAddr
public java.lang.String getRemoteAddr()
- Specified by:
getRemoteAddr
in interface javax.servlet.ServletRequest
getRemoteHost
public java.lang.String getRemoteHost()
- Specified by:
getRemoteHost
in interface javax.servlet.ServletRequest
getReader
public java.io.BufferedReader getReader()
- Specified by:
getReader
in interface javax.servlet.ServletRequest
getInputStream
public javax.servlet.ServletInputStream getInputStream()
- Specified by:
getInputStream
in interface javax.servlet.ServletRequest
getParameter
public java.lang.String getParameter(java.lang.String name)
- Specified by:
getParameter
in interface javax.servlet.ServletRequest
getParameterNames
public java.util.Enumeration getParameterNames()
- Specified by:
getParameterNames
in interface javax.servlet.ServletRequest
getParameterValues
public java.lang.String[] getParameterValues(java.lang.String name)
- Specified by:
getParameterValues
in interface javax.servlet.ServletRequest
getContentLength
public int getContentLength()
- Specified by:
getContentLength
in interface javax.servlet.ServletRequest
getAuthType
public java.lang.String getAuthType()
- Specified by:
getAuthType
in interface javax.servlet.http.HttpServletRequest
getDateHeader
public long getDateHeader(java.lang.String str)
- Specified by:
getDateHeader
in interface javax.servlet.http.HttpServletRequest
getHeader
public java.lang.String getHeader(java.lang.String str)
- Specified by:
getHeader
in interface javax.servlet.http.HttpServletRequest
getHeaders
public java.util.Enumeration getHeaders(java.lang.String str)
- Specified by:
getHeaders
in interface javax.servlet.http.HttpServletRequest
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()
- Specified by:
isRequestedSessionIdValid
in interface javax.servlet.http.HttpServletRequest
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()
- Specified by:
isRequestedSessionIdFromCookie
in interface javax.servlet.http.HttpServletRequest
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()
- Specified by:
isRequestedSessionIdFromURL
in interface javax.servlet.http.HttpServletRequest
isRequestedSessionIdFromUrl
public boolean isRequestedSessionIdFromUrl()
- Specified by:
isRequestedSessionIdFromUrl
in interface javax.servlet.http.HttpServletRequest
getRequestedSessionId
public java.lang.String getRequestedSessionId()
- Specified by:
getRequestedSessionId
in interface javax.servlet.http.HttpServletRequest
getServletPath
public java.lang.String getServletPath()
- Specified by:
getServletPath
in interface javax.servlet.http.HttpServletRequest
getSession
public javax.servlet.http.HttpSession getSession(boolean b)
- Specified by:
getSession
in interface javax.servlet.http.HttpServletRequest
getSession
public javax.servlet.http.HttpSession getSession()
- Specified by:
getSession
in interface javax.servlet.http.HttpServletRequest
getRemoteUser
public java.lang.String getRemoteUser()
- Specified by:
getRemoteUser
in interface javax.servlet.http.HttpServletRequest
isUserInRole
public boolean isUserInRole(java.lang.String role)
- Specified by:
isUserInRole
in interface javax.servlet.http.HttpServletRequest
getUserPrincipal
public java.security.Principal getUserPrincipal()
- Specified by:
getUserPrincipal
in interface javax.servlet.http.HttpServletRequest
getContextPath
public java.lang.String getContextPath()
- Specified by:
getContextPath
in interface javax.servlet.http.HttpServletRequest
getQueryString
public java.lang.String getQueryString()
- Specified by:
getQueryString
in interface javax.servlet.http.HttpServletRequest
getHeaderNames
public java.util.Enumeration getHeaderNames()
- Specified by:
getHeaderNames
in interface javax.servlet.http.HttpServletRequest
getIntHeader
public int getIntHeader(java.lang.String str)
- Specified by:
getIntHeader
in interface javax.servlet.http.HttpServletRequest
getCookies
public javax.servlet.http.Cookie[] getCookies()
- Specified by:
getCookies
in interface javax.servlet.http.HttpServletRequest
getInitParameter
public java.lang.String getInitParameter(java.lang.String name)
- Specified by:
getInitParameter
in interface javax.servlet.ServletConfig
- Specified by:
getInitParameter
in interface javax.servlet.ServletContext
getInitParameterNames
public java.util.Enumeration getInitParameterNames()
- Specified by:
getInitParameterNames
in interface javax.servlet.ServletConfig
- Specified by:
getInitParameterNames
in interface javax.servlet.ServletContext
getServletContext
public javax.servlet.ServletContext getServletContext()
- Specified by:
getServletContext
in interface javax.servlet.ServletConfig
getServletName
public java.lang.String getServletName()
- Specified by:
getServletName
in interface javax.servlet.ServletConfig
getContext
public javax.servlet.ServletContext getContext(java.lang.String path)
- Specified by:
getContext
in interface javax.servlet.ServletContext
getMajorVersion
public int getMajorVersion()
- Specified by:
getMajorVersion
in interface javax.servlet.ServletContext
getMinorVersion
public int getMinorVersion()
- Specified by:
getMinorVersion
in interface javax.servlet.ServletContext
getMimeType
public java.lang.String getMimeType(java.lang.String file)
- Specified by:
getMimeType
in interface javax.servlet.ServletContext
getResourcePaths
public java.util.Set getResourcePaths(java.lang.String path)
- Specified by:
getResourcePaths
in interface javax.servlet.ServletContext
getResource
public java.net.URL getResource(java.lang.String path)
- Specified by:
getResource
in interface javax.servlet.ServletContext
getResourceAsStream
public java.io.InputStream getResourceAsStream(java.lang.String path)
- Specified by:
getResourceAsStream
in interface javax.servlet.ServletContext
getNamedDispatcher
public javax.servlet.RequestDispatcher getNamedDispatcher(java.lang.String path)
- Specified by:
getNamedDispatcher
in interface javax.servlet.ServletContext
getServlet
public javax.servlet.Servlet getServlet(java.lang.String name)
- Specified by:
getServlet
in interface javax.servlet.ServletContext
getServlets
public java.util.Enumeration getServlets()
- Specified by:
getServlets
in interface javax.servlet.ServletContext
getServletNames
public java.util.Enumeration getServletNames()
- Specified by:
getServletNames
in interface javax.servlet.ServletContext
log
public void log(java.lang.String message)
- Specified by:
log
in interface javax.servlet.ServletContext
log
public void log(java.lang.Exception ex,
java.lang.String mgs)
- Specified by:
log
in interface javax.servlet.ServletContext
log
public void log(java.lang.String msg,
java.lang.Throwable ex)
- Specified by:
log
in interface javax.servlet.ServletContext
getServerInfo
public java.lang.String getServerInfo()
- Specified by:
getServerInfo
in interface javax.servlet.ServletContext
getServletContextName
public java.lang.String getServletContextName()
- Specified by:
getServletContextName
in interface javax.servlet.ServletContext