|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.gdata.server.GDataResponse
public class GDataResponse
The FeedRequest Class wraps the current HttpServletResponse. Any action on the
HttpServletRequest will be executed via this class. This represents an
abstraction on the plain HttpServletResponse
. Any action which has
to be performed on the underlying HttpServletResponse
will be
executed within this class.
The GData basically writes two different kinds of response to the output stream.
GDataResponse
class provides the overloaded
method
org.apache.lucene.gdata.server.GDataResponse#sendResponse(BaseEntry, ExtensionProfile)
which sends the entry e.g feed to the output stream.
This class will set the HTTP Last-Modified Header to enable clients to send If-Modified-Since request header to avoid retrieving the content again if it hasn't changed. If the content hasn't changed since the If-Modified-Since time, then the GData service returns a 304 (Not Modified) HTTP response.
Field Summary | |
---|---|
static int |
BAD_REQUEST
Response code bad request |
static int |
CONFLICT
Response code version conflict |
static int |
CREATED
Response code created |
static int |
FORBIDDEN
Response code forbidden access |
static int |
NOT_FOUND
Response code not found |
static int |
NOT_MODIFIED
Response code not modified since |
static int |
SERVER_ERROR
Response code internal server error |
static int |
UNAUTHORIZED
Response code unauthorized access |
protected static String |
XMLMIME_ATOM
|
protected static String |
XMLMIME_RSS
|
Constructor Summary | |
---|---|
GDataResponse(javax.servlet.http.HttpServletResponse response)
Creates a new GDataResponse |
Method Summary | |
---|---|
String |
getEncoding()
This encoding will be used to encode the xml representation of feed or entry written to the HttpServletResponse output stream. |
GDataRequest.OutputFormat |
getOutputFormat()
|
Writer |
getWriter()
|
void |
sendError()
This method sends the specified error to the user if set |
void |
sendResponse(com.google.gdata.data.BaseEntry entry,
ProvidedService service)
Sends a response for an update, insert or delete request. |
void |
sendResponse(com.google.gdata.data.BaseFeed feed,
ProvidedService service)
Sends a response for a get e.g. |
void |
setEncoding(String encoding)
This encoding will be used to encode the xml representation of feed or entry written to the HttpServletResponse output stream. |
void |
setError(int errorCode)
Sets an error code to this FeedResponse. |
protected void |
setLastModifiedHeader(long lastModified)
|
void |
setOutputFormat(GDataRequest.OutputFormat outputFormat)
|
void |
setResponseCode(int responseCode)
Sets the status of the underlying response |
void |
setStatus(int status)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int BAD_REQUEST
public static final int CONFLICT
public static final int FORBIDDEN
public static final int SERVER_ERROR
public static final int NOT_FOUND
public static final int NOT_MODIFIED
public static final int CREATED
public static final int UNAUTHORIZED
protected static final String XMLMIME_ATOM
protected static final String XMLMIME_RSS
Constructor Detail |
---|
public GDataResponse(javax.servlet.http.HttpServletResponse response)
response
- -
The underlying HttpServletResponse
Method Detail |
---|
public void setError(int errorCode)
errorCode
- -
HttpServletResponse
error codepublic void setResponseCode(int responseCode)
responseCode
- -
the status of the responseHttpServletResponse
public void sendError() throws IOException
IOException
- -
if an I/O Exception occurspublic Writer getWriter() throws IOException
HttpServletResponse
writer
IOException
- -
If an I/O exception occurspublic void sendResponse(com.google.gdata.data.BaseFeed feed, ProvidedService service) throws IOException
feed
- -
the feed to respond to the clientservice
- - the service to render the feed
IOException
- -
if an I/O exception occurs, often caused by an already
closed Writer or OutputStreampublic void sendResponse(com.google.gdata.data.BaseEntry entry, ProvidedService service) throws IOException
entry
- -
the modified / created entry to sendservice
- - the service to render the feed
IOException
- -
if an I/O exception occurs, often caused by an already
closed Writer or OutputStreampublic String getEncoding()
HttpServletResponse
output stream.
public void setEncoding(String encoding)
HttpServletResponse
output stream. UTF-8
ISO-8859-1
encoding
- -
string represents the encodingpublic GDataRequest.OutputFormat getOutputFormat()
GDataRequest.OutputFormat
public void setOutputFormat(GDataRequest.OutputFormat outputFormat)
outputFormat
- -
the response
GDataRequest.OutputFormat
public String toString()
toString
in class Object
Object.toString()
protected void setLastModifiedHeader(long lastModified)
public void setStatus(int status)
status
- - the request status codeHttpServletResponse.setStatus(int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |