in taverna-rest-activity/src/main/java/org/apache/taverna/activities/rest/RESTActivityConfigurationBean.java [105:159]
public RESTActivityConfigurationBean(JsonNode json) {
JsonNode requestNode = json.get("request");
HTTPRequest request = new HTTPRequest();
if (requestNode.has("httpMethod")) {
request.setMethod(HTTP_METHOD.valueOf(requestNode.get("httpMethod")
.textValue()));
} else {
request.setMethod(HTTP_METHOD.GET);
}
request.setAbsoluteURITemplate(requestNode.get("absoluteURITemplate")
.textValue());
setRequest(request);
setAcceptsHeaderValue("application/xml");
setContentTypeForUpdates("application/xml");
setSendHTTPExpectRequestHeader(false);
if (requestNode.has("headers")) {
for (JsonNode headerNode : requestNode.get("headers")) {
String headerName = headerNode.get("header").textValue();
String headerValue = headerNode.get("value").textValue();
if ("Expect".equals(headerName)) {
request.setHeader(headerName, true);
} else {
request.setHeader(headerName, headerValue);
}
}
}
if (json.has("outgoingDataFormat")) {
setOutgoingDataFormat(DATA_FORMAT.valueOf(json.get(
"outgoingDataFormat").textValue()));
} else {
setOutgoingDataFormat(DATA_FORMAT.String);
}
if (json.has("showRedirectionOutputPort")) {
setShowRedirectionOutputPort(json.get("showRedirectionOutputPort")
.booleanValue());
} else {
setShowRedirectionOutputPort(false);
}
if (json.has("showActualURLPort")) {
setShowActualUrlPort(json.get("showActualURLPort").booleanValue());
} else {
setShowActualUrlPort(false);
}
if (json.has("showResponseHeadersPort")) {
setShowResponseHeadersPort(json.get("showResponseHeadersPort")
.booleanValue());
} else {
setShowResponseHeadersPort(false);
}
if (json.has("escapeParameters")) {
setEscapeParameters(json.get("escapeParameters").booleanValue());
} else {
setEscapeParameters(true);
}
}