Fields Summary |
---|
public static final int | BAD_REQUESTResponse code bad request |
public static final int | CONFLICTResponse code version conflict |
public static final int | FORBIDDENResponse code forbidden access |
public static final int | SERVER_ERRORResponse code internal server error |
public static final int | NOT_FOUNDResponse code not found |
public static final int | NOT_MODIFIEDResponse code not modified since |
public static final int | CREATEDResponse code created |
public static final int | UNAUTHORIZEDResponse code unauthorized access |
static final Log | LOG |
private int | error |
private boolean | isError |
private String | encoding |
private org.apache.lucene.gdata.server.GDataRequest.OutputFormat | outputFormat |
private final HttpServletResponse | response |
protected static final String | XMLMIME_ATOM |
protected static final String | XMLMIME_RSS |
private static final String | HEADER_LASTMODIFIED |
Methods Summary |
---|
public java.lang.String | getEncoding()This encoding will be used to encode the xml representation of feed or
entry written to the {@link HttpServletResponse} output stream.
return this.encoding;
|
public org.apache.lucene.gdata.server.GDataRequest.OutputFormat | getOutputFormat()
return this.outputFormat;
|
public java.io.Writer | getWriter()
return this.response.getWriter();
|
public void | sendError()This method sends the specified error to the user if set
if (this.isError)
this.response.sendError(this.error);
|
public void | sendResponse(com.google.gdata.data.BaseFeed feed, org.apache.lucene.gdata.server.registry.ProvidedService service)Sends a response for a get e.g. query request. This method must not
invoked in a case of an error performing the requested action.
if (feed == null)
throw new IllegalArgumentException("feed must not be null");
if (service == null)
throw new IllegalArgumentException(
"provided service must not be null");
DateTime time = feed.getUpdated();
if (time != null)
setLastModifiedHeader(time.getValue());
FormatWriter writer = FormatWriter.getFormatWriter(this,service);
writer.generateOutputFormat(feed,this.response);
|
public void | sendResponse(com.google.gdata.data.BaseEntry entry, org.apache.lucene.gdata.server.registry.ProvidedService service)Sends a response for an update, insert or delete request. This method
must not invoked in a case of an error performing the requested action. If
the specified response format is ATOM the default namespace will be set
to ATOM.
if (entry == null)
throw new IllegalArgumentException("entry must not be null");
if (service == null)
throw new IllegalArgumentException(
"service must not be null");
DateTime time = entry.getUpdated();
if (time != null)
setLastModifiedHeader(time.getValue());
FormatWriter writer = FormatWriter.getFormatWriter(this,service);
writer.generateOutputFormat(entry,this.response);
|
public void | setEncoding(java.lang.String encoding)This encoding will be used to encode the xml representation of feed or
entry written to the {@link HttpServletResponse} output stream. UTF-8
ISO-8859-1
this.encoding = encoding;
|
public void | setError(int errorCode)Sets an error code to this FeedResponse.
this.isError = true;
this.error = errorCode;
|
protected void | setLastModifiedHeader(long lastModified)
String lastMod = DateFormater.formatDate(new Date(lastModified),
DateFormater.HTTP_HEADER_DATE_FORMAT);
this.response.setHeader(HEADER_LASTMODIFIED, lastMod);
|
public void | setOutputFormat(org.apache.lucene.gdata.server.GDataRequest.OutputFormat outputFormat)
this.outputFormat = outputFormat;
|
public void | setResponseCode(int responseCode)Sets the status of the underlying response
this.response.setStatus(responseCode);
|
public void | setStatus(int status)
this.response.setStatus(status);
|
public java.lang.String | toString()
StringBuilder builder = new StringBuilder(" GDataResponse: ");
builder.append("Error: ").append(this.error);
builder.append(" outputFormat: ").append(getOutputFormat());
builder.append(" encoding: ").append(this.encoding);
return builder.toString();
|