listenerNode.setAttribute("name", listener.getName());
try {
bus = (HttpBus) model.getOptionalBus(listener.getBusidref());
} catch (ClassCastException e) {
throw new ConfigurationException("Invalid busid reference [" + listener.getBusidref() + "] on listener [" + listener.getName() + "]. A <http-listener> must reference a <http-bus>.");
}
// Map the standard listener attributes - common across all listener types...
MapperUtil.mapDefaultAttributes(listener, listenerNode, model);
String urlPattern = listener.getUrlPattern();
PayloadAs.Enum payloadAs = listener.getPayloadAs();
if(listener.getAsyncResponseList() != null && !listener.getAsyncResponseList().isEmpty()) {
AsyncHttpResponse asyncResponse = listener.getAsyncResponseList().get(0);
listenerNode.setAttribute(HttpGatewayServlet.ASYNC_SERVICE_INVOKE, "true");
listenerNode.setAttribute(HttpGatewayServlet.ASYNC_STATUS_CODE, Integer.toString(asyncResponse.getStatusCode()));
AsyncHttpResponse.Payload payload = asyncResponse.getPayload();
if(payload != null) {
listenerNode.setAttribute(HttpGatewayServlet.ASYNC_PAYLOAD, payload.getClasspathResource());
listenerNode.setAttribute(HttpGatewayServlet.ASYNC_PAYLOAD_CONTENT_TYPE, payload.getContentType());
if(payload.getCharacterEncoding() != null) {
listenerNode.setAttribute(HttpGatewayServlet.ASYNC_PAYLOAD_CHARACTER_ENCODING, payload.getCharacterEncoding());
}
}
} else {
listenerNode.setAttribute(HttpGatewayServlet.ASYNC_SERVICE_INVOKE, "false");
}
if(bus != null) {
try {
provider = (HttpProvider) model.getProvider(bus);
} catch (ClassCastException e) {
throw new ConfigurationException("Invalid bus config [" + listener.getBusidref() + "]. Should be contained within a <http-provider> instance. Unexpected exception - this should have caused a validation error!");
}
// Map the <property> elements targeted at the listener - from the listener itself.
//MapperUtil.mapProperties(provider.getPropertyList(), listenerNode);
for(Property property : provider.getPropertyList()) {