from(properties.getProperty("source")) .process(new ResponseProcessor()) .inOnly("direct:z") .end(); from("direct:z") .unmarshal() .jaxb("com.example.entities.xml").convertBodyTo(Entity.class) .multicast() .to("direct:x") .end(); from("direct:x").transacted() .process((ContentEnricherProcessor) applicationContext.getBean("contentEnricherProcessor")) .to(properties.getProperty("activemq.destination"));
public void processResponse(Response response) { //process the response body final Model schema = response.getResponseSchema(); if (response instanceof RefResponse) { RefResponse refResponse = (RefResponse) response; processReferenceResponse(refResponse); } if (schema != null) { modelProcessor.processModel(schema); } /* intentionally ignoring the response headers, even those these were modelled as a Map<String, Property> they should never have a $ref because what does it mean to have a complex object in an HTTP header? */ }
public void processOperation(Operation operation) { final List<Parameter> processedOperationParameters = parameterProcessor.processParameters(operation.getParameters()); operation.setParameters(processedOperationParameters); final Map<String, Response> responses = operation.getResponses(); if (responses != null) { for (String responseCode : responses.keySet()) { Response response = responses.get(responseCode); if(response != null) { if (response instanceof RefResponse) { RefResponse refResponse = (RefResponse) response; responseProcessor.processResponse(response); Response resolvedResponse = cache.loadRef(refResponse.get$ref(), refResponse.getRefFormat(), Response.class); if (resolvedResponse != null) { response = resolvedResponse; responses.put(responseCode, resolvedResponse); } } responseProcessor.processResponse(response); } } } } }
public OperationProcessor(ResolverCache cache, Swagger swagger) { this.cache = cache; parameterProcessor = new ParameterProcessor(cache, swagger); responseProcessor = new ResponseProcessor(cache, swagger); }