|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Throwable java.lang.Exception java.io.IOException ccs.http.HException
public class HException
An Exception related to the HTTP protocol, which will be returned to the client via HTTP's response mechanism. Not all HTTP responses constitute error conditions; it may be found convenient to use the exception handling mechanism to handle some types of these non-error returns as well, and this is permissible. HException is also used to wrap other exceptions, as an aide to displaying them.
Constructor Summary | |
---|---|
HException(int code)
Create an HException with the specified code and no extra information. |
|
HException(int code,
java.lang.String msg)
Create an HException with the specified code and the specified extra information. |
|
HException(java.lang.Throwable th)
Create a suitable HException to wrap the specified Throwable. |
Method Summary | |
---|---|
SwappingBuffer |
defaultBody(java.lang.String method,
java.lang.String uri)
Builds a default HTML message body which describes this exception. |
int |
getCode()
The HTTP response code responding to this exception. |
java.lang.String |
getCodeString()
The human-friendly version of this response code. |
java.lang.String |
getLocalizedMessage()
The annotated, I18N'ed, message. |
void |
send(java.io.OutputStream os,
java.lang.String authCookie,
SwappingBuffer body,
java.lang.String method)
send this HException back to the client, as a raw HTTP response. |
protected void |
sendln(java.io.OutputStream os,
java.lang.String s)
Send a string as a line of ASCII text. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Throwable |
---|
fillInStackTrace, getCause, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HException(int code)
code
- The HTTP response code (see RFC2616 and good luck too you).public HException(java.lang.Throwable th)
getCause
to retrieve
the throwable.
public HException(int code, java.lang.String msg)
code
- The HTTP response code (see RFC2616 and good luck too you).msg
- Anything else you want to say. This should usually be a short-form
message code: before display, it will be washed through the I18N machinery
in ccs.utils.MsgHelper
.Method Detail |
---|
public int getCode()
public java.lang.String getCodeString()
public java.lang.String getLocalizedMessage()
getMessage
will usually contain a short error code, if anything. The return is never null.
getLocalizedMessage
in class java.lang.Throwable
public java.lang.String toString()
toString
in class java.lang.Throwable
public SwappingBuffer defaultBody(java.lang.String method, java.lang.String uri) throws java.io.IOException
method
- The HTTP method in force at the time.uri
- The URI being requested.
java.io.IOException
protected void sendln(java.io.OutputStream os, java.lang.String s) throws java.io.IOException
os
- The stream to send the string to.s
- The string to send.
java.io.IOException
public void send(java.io.OutputStream os, java.lang.String authCookie, SwappingBuffer body, java.lang.String method) throws java.io.IOException
os
- The stream to send on.authCookie
- An authentication cookie, to be returned by
the browser with subsequent requests. Ommitted if null.body
- An HTML body describing this exception. Use
defaultBody()
if nothing better is handy.method
- The HTTP method requested.
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |