Constructors Summary |
---|
public BasicHttpResponse(StatusLine statusline, ReasonPhraseCatalog catalog, Locale locale)Creates a new response.
This is the constructor to which all others map.
super();
if (statusline == null) {
throw new IllegalArgumentException("Status line may not be null.");
}
this.statusline = statusline;
this.reasonCatalog = catalog;
this.locale = (locale != null) ? locale : Locale.getDefault();
|
public BasicHttpResponse(StatusLine statusline)Creates a response from a status line.
The response will not have a reason phrase catalog and
use the system default locale.
this(statusline, null, null);
|
public BasicHttpResponse(ProtocolVersion ver, int code, String reason)Creates a response from elements of a status line.
The response will not have a reason phrase catalog and
use the system default locale.
this(new BasicStatusLine(ver, code, reason), null, null);
|
Methods Summary |
---|
public org.apache.http.HttpEntity | getEntity()
return this.entity;
|
public java.util.Locale | getLocale()
return this.locale;
|
public org.apache.http.ProtocolVersion | getProtocolVersion()
return this.statusline.getProtocolVersion();
|
protected java.lang.String | getReason(int code)Looks up a reason phrase.
This method evaluates the currently set catalog and locale.
It also handles a missing catalog.
return (this.reasonCatalog == null) ?
null : this.reasonCatalog.getReason(code, this.locale);
|
public org.apache.http.StatusLine | getStatusLine()
return this.statusline;
|
public void | setEntity(org.apache.http.HttpEntity entity)
this.entity = entity;
|
public void | setLocale(java.util.Locale loc)
if (loc == null) {
throw new IllegalArgumentException("Locale may not be null.");
}
this.locale = loc;
final int code = this.statusline.getStatusCode();
this.statusline = new BasicStatusLine
(this.statusline.getProtocolVersion(), code, getReason(code));
|
public void | setReasonPhrase(java.lang.String reason)
if ((reason != null) && ((reason.indexOf('\n") >= 0) ||
(reason.indexOf('\r") >= 0))
) {
throw new IllegalArgumentException("Line break in reason phrase.");
}
this.statusline = new BasicStatusLine(this.statusline.getProtocolVersion(),
this.statusline.getStatusCode(),
reason);
|
public void | setStatusCode(int code)
// argument checked in BasicStatusLine constructor
ProtocolVersion ver = this.statusline.getProtocolVersion();
this.statusline = new BasicStatusLine(ver, code, getReason(code));
|
public void | setStatusLine(org.apache.http.ProtocolVersion ver, int code, java.lang.String reason)
// arguments checked in BasicStatusLine constructor
this.statusline = new BasicStatusLine(ver, code, reason);
|
public void | setStatusLine(org.apache.http.StatusLine statusline)
if (statusline == null) {
throw new IllegalArgumentException("Status line may not be null");
}
this.statusline = statusline;
|
public void | setStatusLine(org.apache.http.ProtocolVersion ver, int code)
// arguments checked in BasicStatusLine constructor
this.statusline = new BasicStatusLine(ver, code, getReason(code));
|