|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jgit.http.server.ServletUtils
public final class ServletUtils
Common utility functions for servlets.
Field Summary | |
---|---|
static java.lang.String |
ATTRIBUTE_HANDLER
Request attribute storing either UploadPack or ReceivePack. |
static java.lang.String |
ATTRIBUTE_REPOSITORY
Request attribute which stores the Repository instance. |
Method Summary | |
---|---|
static java.io.InputStream |
getInputStream(javax.servlet.http.HttpServletRequest req)
Open the request input stream, automatically inflating if necessary. |
static Repository |
getRepository(javax.servlet.ServletRequest req)
Get the selected repository from the request. |
static void |
send(byte[] content,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse rsp)
Send a response to a GET or HEAD HTTP request. |
static void |
sendPlainText(java.lang.String content,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse rsp)
Send a plain text response to a GET or HEAD HTTP request. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ATTRIBUTE_REPOSITORY
Repository
instance.
public static final java.lang.String ATTRIBUTE_HANDLER
Method Detail |
---|
public static Repository getRepository(javax.servlet.ServletRequest req)
req
- the current request.
java.lang.IllegalStateException
- the repository was not set by the filter, the servlet is
being invoked incorrectly and the programmer should ensure
the filter runs before the servlet.ATTRIBUTE_REPOSITORY
public static java.io.InputStream getInputStream(javax.servlet.http.HttpServletRequest req) throws java.io.IOException
This method automatically inflates the input stream if the request
Content-Encoding
header was set to gzip
or the legacy
x-gzip
.
req
- the incoming request whose input stream needs to be opened.
java.io.IOException
- if an input or output exception occurred.public static void sendPlainText(java.lang.String content, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp) throws java.io.IOException
GET
or HEAD
HTTP request.
The text response is encoded in the Git character encoding, UTF-8.
If the user agent supports a compressed transfer encoding and the content is large enough, the content may be compressed before sending.
The ETag
and Content-Length
headers are automatically set
by this method. Content-Encoding
is conditionally set if the user
agent supports a compressed transfer. Callers are responsible for setting
any cache control headers.
content
- to return to the user agent as this entity's body.req
- the incoming request.rsp
- the outgoing response.
java.io.IOException
- the servlet API rejected sending the body.public static void send(byte[] content, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp) throws java.io.IOException
GET
or HEAD
HTTP request.
If the user agent supports a compressed transfer encoding and the content is large enough, the content may be compressed before sending.
The ETag
and Content-Length
headers are automatically set
by this method. Content-Encoding
is conditionally set if the user
agent supports a compressed transfer. Callers are responsible for setting
Content-Type
and any cache control headers.
content
- to return to the user agent as this entity's body.req
- the incoming request.rsp
- the outgoing response.
java.io.IOException
- the servlet API rejected sending the body.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |