for (int i = 0; i < noOfItems; i++) {
this.allowedPorts[i] = Integer.parseInt(tokens.nextToken());
}
}
ConfigTree configTree = toConfigTree(config);
try {
messageComposer = MessageComposer.Factory.getInstance(configTree.getAttribute(ListenerTagNames.GATEWAY_COMPOSER_CLASS_TAG, HttpMessageComposer.class.getName()), configTree);
} catch (ConfigurationException e) {
throw new ServletException("Failed to create message composer.", e);
} catch (MessageDeliverException e) {
throw new ServletException("Failed to create message composer.", e);
}
asyncInvoke = configTree.getBooleanAttribute(ASYNC_SERVICE_INVOKE, false);
if(asyncInvoke) {
String asyncSCConfig = configTree.getAttribute(ASYNC_STATUS_CODE);
try {
asyncStatusCode = Integer.parseInt(asyncSCConfig);
} catch (NumberFormatException e) {
throw new ServletException("Invalid static asynchronous response code configuration '" + asyncSCConfig + "'.", e);
}
String payloadPath = configTree.getAttribute(ASYNC_PAYLOAD);
if(payloadPath != null) {
try {
asyncPayload = readStaticAsyncResponse(payloadPath);
} catch (ConfigurationException e) {
throw new ServletException("Invalid Exception to HTTP Status mapping configuration.", e);
}
asyncContentType = configTree.getAttribute(ASYNC_PAYLOAD_CONTENT_TYPE);
asyncCharacterEncoding = configTree.getAttribute(ASYNC_PAYLOAD_CHARACTER_ENCODING);
}
} else {
blockingTimeout = configTree.getLongAttribute("synchronousTimeout", 30000L);
}
String exceptionMappingsCSV = configTree.getAttribute(EXCEPTION_MAPPINGS);
if(exceptionMappingsCSV != null) {
try {
exceptionMappings = HttpGatewayMapper.decodeExceptionMappingsCSV(exceptionMappingsCSV);
} catch (ConfigurationException e) {
throw new ServletException("Invalid Exception to HTTP Status mapping configuration.", e);