java.lang.Object
raining.protocol.http.Http503Response
- All Implemented Interfaces:
- raining.core.Response
- public class Http503Response
- extends java.lang.Object
- implements raining.core.Response
Interface for Response, including response header creation.
Remember that headers need to b cached as does data.
TODO. I need to refactor this. only the 503 200 resp code differs.
XXX : Are we even required to send content? i think we can SHOULD avoid.
|
Method Summary |
byte[] |
getBytes()
Return as a stream of bytes. |
static byte[] |
getStaticContent()
Returns a static 503 string to be used, when a server is
reaching capacity, and wants to reject connections with a reply. |
java.lang.String |
getString()
return content as a String: to start with we use this, this does a conversion 3 times, so
avoid. |
static void |
main(java.lang.String[] args)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
content
static byte[] content
sheader
static java.lang.String sheader
HTTP_VERSION
public static final java.lang.String HTTP_VERSION
- See Also:
- Constant Field Values
CRLF
public static final java.lang.String CRLF
- See Also:
- Constant Field Values
CRLF2
public static final java.lang.String CRLF2
- See Also:
- Constant Field Values
contentType
public static final java.lang.String contentType
- See Also:
- Constant Field Values
scontent
protected static final java.lang.String scontent
- See Also:
- Constant Field Values
thiscontent
protected byte[] thiscontent
P
public static final java.lang.String P
- See Also:
- Constant Field Values
Http503Response
public Http503Response(raining.core.Request request)
- ctor that takes a request object.
Usually the URL would be used in the reply, and logged.
Currently a static response is returned.
Http503Response
public Http503Response(raining.core.Request request,
java.lang.String cause)
getBytes
public byte[] getBytes()
- Return as a stream of bytes.
Preferred since we can use bytes
throughout and avoid costly string to byte conversions.
- Specified by:
getBytes in interface raining.core.Response
getString
public java.lang.String getString()
- return content as a String: to start with we use this, this does a conversion 3 times, so
avoid.
- Specified by:
getString in interface raining.core.Response
getStaticContent
public static byte[] getStaticContent()
- Returns a static 503 string to be used, when a server is
reaching capacity, and wants to reject connections with a reply.
main
public static void main(java.lang.String[] args)