|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.representation.Variant
org.restlet.representation.RepresentationInfo
org.restlet.representation.Representation
org.restlet.representation.StreamRepresentation
org.restlet.representation.OutputRepresentation
org.opentox.error.ErrorRepresentation
public class ErrorRepresentation
An error representation is the web representation of an exception that is thrown by a method during following some HTTP request.
Field Summary | |
---|---|
private org.restlet.data.Status |
internalStatus
Internal Status of the error representation. |
private java.util.Map<java.lang.String,java.lang.Throwable> |
map
Maps a Throwable to a corresponding explanation. |
Fields inherited from class org.restlet.representation.Representation |
---|
UNKNOWN_SIZE |
Constructor Summary | |
---|---|
ErrorRepresentation()
Constructor for a new ErrorRepresentation. |
|
ErrorRepresentation(java.util.Map<java.lang.String,java.lang.Throwable> map,
org.restlet.data.Status status)
Constructs a new ErrorRepresentation, given a set of Trowable-Explanation pairs, materialized by a Map and a Status characterization
of the Representation, i.e. |
|
ErrorRepresentation(java.lang.Throwable throwable,
java.lang.String message,
org.restlet.data.Status status)
Constructs a new ErrorRepresentation given a Throwable - the error
or exception - a Status and an explanatory message that contains
instructions to the client such as if it is recommended that the client
repeats the same request etc. |
Method Summary | |
---|---|
ErrorRepresentation |
append(ErrorRepresentation other)
Concatenates two Error Representations by mixing together their explanatory messages and their lists of Throwables. |
ErrorRepresentation |
append(java.lang.Throwable throwable,
java.lang.String message,
org.restlet.data.Status status)
Adds a Throwable and an explanatory message for it to the current
ErrorRepresentation. |
int |
getErrorLevel()
The Error Level is defined to be the number of Error or exception in this object. |
java.util.Set<java.lang.String> |
getMessages()
The explanatory messages about the errors. |
org.restlet.data.Status |
getStatus()
Returns the status that accompanies the ErrorRepresentaiton. |
java.io.InputStream |
getStream()
Returns a stream with the content of the representation. |
java.lang.String |
getText()
Returns the representation as plain text. |
ErrorRepresentation |
updateStatus(org.restlet.data.Status newStatus)
Updates the (internal) status.The status can be updated only in the following cases: The current status is less than 300, i.e. |
void |
write(java.io.OutputStream outputStream)
Writes the representation to an output stream. |
Methods inherited from class org.restlet.representation.OutputRepresentation |
---|
release |
Methods inherited from class org.restlet.representation.StreamRepresentation |
---|
getChannel, getReader, write, write |
Methods inherited from class org.restlet.representation.Representation |
---|
checkDigest, checkDigest, computeDigest, createEmpty, exhaust, finalize, getAvailableSize, getDigest, getDigester, getDigester, getDownloadName, getExpirationDate, getRange, getSize, isAvailable, isDownloadable, isTransient, setAvailable, setDigest, setDownloadable, setDownloadName, setExpirationDate, setRange, setSize, setTransient |
Methods inherited from class org.restlet.representation.RepresentationInfo |
---|
getModificationDate, getTag, setModificationDate, setTag |
Methods inherited from class org.restlet.representation.Variant |
---|
createClientInfo, getCharacterSet, getEncodings, getIdentifier, getLanguages, getMediaType, isCompatible, setCharacterSet, setEncodings, setIdentifier, setIdentifier, setLanguages, setMediaType |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.Map<java.lang.String,java.lang.Throwable> map
private volatile org.restlet.data.Status internalStatus
Constructor Detail |
---|
public ErrorRepresentation()
public ErrorRepresentation(java.util.Map<java.lang.String,java.lang.Throwable> map, org.restlet.data.Status status)
Map
and a Status
characterization
of the Representation, i.e. the status that fits this representation.
map
- Map of Explanatory Messages to Error Causes (Throwables)status
- The corresponding status .public ErrorRepresentation(java.lang.Throwable throwable, java.lang.String message, org.restlet.data.Status status)
Throwable
- the error
or exception - a Status
and an explanatory message that contains
instructions to the client such as if it is recommended that the client
repeats the same request etc.
throwable
- The cause of the error/exception.message
- An explanatory message that the client shall receive along with
the ErrorRepresentation.status
- The corresponding status that accompanies the ErrorRepresentation.Method Detail |
---|
public ErrorRepresentation append(ErrorRepresentation other)
other
- Some other error representation.
public ErrorRepresentation append(java.lang.Throwable throwable, java.lang.String message, org.restlet.data.Status status)
Throwable
and an explanatory message for it to the current
ErrorRepresentation. The status of the new ErrorRepresentation comes up as
a function of the current status and the new one accoriding to the method
updateStatus(org.restlet.data.Status)
.
throwable
- The new throwable to be added.message
- An explanatory message for the error.status
- The new status.
public int getErrorLevel()
public java.util.Set<java.lang.String> getMessages()
public ErrorRepresentation updateStatus(org.restlet.data.Status newStatus)
newStatus
- The new status.
getStatus()
public org.restlet.data.Status getStatus()
updateStatus(org.restlet.data.Status)
public java.lang.String getText()
getText
in class org.restlet.representation.Representation
public java.io.InputStream getStream() throws java.io.IOException
getStream
in class org.restlet.representation.OutputRepresentation
java.io.IOException
Representation.getStream()
public void write(java.io.OutputStream outputStream) throws java.io.IOException
write
in class org.restlet.representation.Representation
outputStream
-
java.io.IOException
StreamRepresentation.write(java.nio.channels.WritableByteChannel)
,
StreamRepresentation.write(java.io.Writer)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |