Brooklyn

brooklyn.event.adapter
[Groovy] Class HttpResponseContext

java.lang.Object
  brooklyn.event.adapter.AbstractSensorEvaluationContext
      brooklyn.event.adapter.HttpResponseContext

class HttpResponseContext
extends AbstractSensorEvaluationContext

context object for evaluating sensor closures with http data handy


Field Summary
static Logger log

 
Fields inherited from class AbstractSensorEvaluationContext
UNSET, log
 
Property Summary
java.net.HttpURLConnection connection

may be null during testing

java.lang.String content

may be null if no content available

java.util.Map headerLists

http return headers, where all values are lists (as per HttpConnection) see "headers" for direct access to non-list headers

int responseCode

http result code, or -1 if error is set

 
Constructor Summary
HttpResponseContext(java.net.HttpURLConnection conn)

usual constructor

HttpResponseContext(java.net.HttpURLConnection conn, java.lang.Exception error)

constructor for when there is an error; note that many of the methods on connection will throw errors

HttpResponseContext(java.net.HttpURLConnection conn, int responseCode, java.util.Map headers, java.lang.String content, java.lang.Exception error)

constructor for testing of non-connection usage

 
Method Summary
protected java.lang.Object getDefaultValue()

java.util.Map getHeaders()

http return headers; values are strings in most cases, lists of strings if the original was a list with zero or 2+ values

java.lang.Object getJson()

 
Methods inherited from class AbstractSensorEvaluationContext
evaluate, evaluate, getDefaultValue, propertyMissing
 

Field Detail

log

public static final Logger log


 
Property Detail

connection

@Nullable
final java.net.HttpURLConnection connection
may be null during testing


content

@Nullable
final java.lang.String content
may be null if no content available


headerLists

final java.util.Map headerLists
http return headers, where all values are lists (as per HttpConnection) see "headers" for direct access to non-list headers


responseCode

final int responseCode
http result code, or -1 if error is set


 
Constructor Detail

HttpResponseContext

HttpResponseContext(java.net.HttpURLConnection conn)
usual constructor


HttpResponseContext

HttpResponseContext(java.net.HttpURLConnection conn, java.lang.Exception error)
constructor for when there is an error; note that many of the methods on connection will throw errors


HttpResponseContext

HttpResponseContext(java.net.HttpURLConnection conn, int responseCode, java.util.Map headers, java.lang.String content, java.lang.Exception error)
constructor for testing of non-connection usage


 
Method Detail

getDefaultValue

protected java.lang.Object getDefaultValue()


getHeaders

java.util.Map getHeaders()
http return headers; values are strings in most cases, lists of strings if the original was a list with zero or 2+ values


getJson

java.lang.Object getJson()


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.