org.weborganic.berlioz.servlet
Class XMLResponse

java.lang.Object
  extended by org.weborganic.berlioz.servlet.XMLResponse

public final class XMLResponse
extends Object

An XML response produced from content generators.

This class is not thread-safe.

Since:
Berlioz 0.7
Version:
Berlioz 0.9.14 - 22 January 2013
Author:
Christophe Lauret

Constructor Summary
XMLResponse(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, BerliozConfig config, MatchingService match, boolean profile)
          Creates a new XML response for the specified arguments.
 
Method Summary
 String generate()
          Generates an XML response for the wrapped HTTP request and response objects.
 BerliozException getError()
          Returns a Berlioz Exception wrapping any error(s) that may have been thrown by the generators.
 String getEtag()
          Returns the Etag for this response.
 String getRedirectURL()
          Returns the URL to redirect to.
 Service getService()
          Returns the service corresponding to this response.
 ContentStatus getStatus()
          Returns the status of this service response.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLResponse

public XMLResponse(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse res,
                   BerliozConfig config,
                   MatchingService match,
                   boolean profile)
Creates a new XML response for the specified arguments.

Parameters:
req - The HTTP servlet request.
res - The HTTP servlet response.
config - The Berlioz configuration environment.
match - The matching service
profile - Whether to enable profiling.
Method Detail

getService

public Service getService()
Returns the service corresponding to this response.

Returns:
the service corresponding to this response.

getEtag

public String getEtag()
Returns the Etag for this response.

The Etag is computed from the Etags returned by each generator.

If any one of the generators is not cacheable, this response is not considered cacheable and the Etag returned will be null.

Returns:
the Etag for this response if it is cacheable; null if it is not.
Since:
Berlioz 0.8.0

getStatus

public ContentStatus getStatus()
Returns the status of this service response.

Returns:
the status of this service response.
Since:
Berlioz 0.8.2

getError

public BerliozException getError()
Returns a Berlioz Exception wrapping any error(s) that may have been thrown by the generators.

Returns:
a Berlioz Exception wrapping any error(s) that may have been thrown by the generators.

getRedirectURL

public String getRedirectURL()
Returns the URL to redirect to.

Returns:
the URL to redirect to.

generate

public String generate()
                throws IOException
Generates an XML response for the wrapped HTTP request and response objects.

Returns:
The XML content for the appropriate content generator.
Throws:
IOException - Should an I/O error occur.