java.lang.Object
com.meterware.pseudoserver.WebResource
- public class WebResource
- extends java.lang.Object
A resource to be returned from the simulated server.
DEFAULT_CONTENT_TYPE
static final java.lang.String DEFAULT_CONTENT_TYPE
- See Also:
- Constant Field Values
DEFAULT_CHARACTER_SET
static final java.lang.String DEFAULT_CHARACTER_SET
- See Also:
- Constant Field Values
_closesConnection
private boolean _closesConnection
_contents
private byte[] _contents
_string
private java.lang.String _string
_stream
private java.io.InputStream _stream
_responseCode
private int _responseCode
_sendCharacterSet
private boolean _sendCharacterSet
_contentType
private java.lang.String _contentType
_characterSet
private java.lang.String _characterSet
_hasExplicitContentTypeHeader
private boolean _hasExplicitContentTypeHeader
_hasExplicitContentLengthHeader
private boolean _hasExplicitContentLengthHeader
_headers
private java.util.Vector _headers
_isChunked
private boolean _isChunked
WebResource
public WebResource(java.lang.String contents)
WebResource
public WebResource(java.lang.String contents,
java.lang.String contentType)
WebResource
public WebResource(byte[] contents,
java.lang.String contentType)
WebResource
WebResource(java.lang.String contents,
int responseCode)
WebResource
WebResource(java.lang.String contents,
java.lang.String contentType,
int responseCode)
WebResource
WebResource(byte[] contents,
java.lang.String contentType,
int responseCode)
WebResource
public WebResource(java.io.InputStream stream,
java.lang.String contentType,
int responseCode)
addHeader
public void addHeader(java.lang.String header)
setCharacterSet
public void setCharacterSet(java.lang.String characterSet)
setSendCharacterSet
public void setSendCharacterSet(boolean enabled)
suppressAutomaticLengthHeader
public void suppressAutomaticLengthHeader()
getHeaders
java.lang.String[] getHeaders()
throws java.io.UnsupportedEncodingException
isChunked
private boolean isChunked()
closesConnection
boolean closesConnection()
writeTo
void writeTo(java.io.OutputStream outputStream)
throws java.io.IOException
toString
static java.lang.String toString(byte[] contentsAsBytes)
getContentsAsBytes
private byte[] getContentsAsBytes()
throws java.io.UnsupportedEncodingException
getContentTypeHeader
private java.lang.String getContentTypeHeader()
getContentLengthHeader
private java.lang.String getContentLengthHeader()
throws java.io.UnsupportedEncodingException
getCharacterSet
java.lang.String getCharacterSet()
getCharacterSetParameter
java.lang.String getCharacterSetParameter()
getResponseCode
int getResponseCode()
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object
- Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method
never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string
concatenation with this object. If the result is
null, string concatenation will instead
use "null".
The default implementation returns
getClass().getName() + "@" +
Integer.toHexString(hashCode()).
getContentsAsString
private java.lang.String getContentsAsString()