use of com.predic8.membrane.core.ws.relocator.Relocator in project service-proxy by membrane.
the class WADLInterceptor method rewrite.
@Override
protected void rewrite(Exchange exc) throws Exception, IOException {
log.debug("Changing endpoint address in WADL");
ByteArrayOutputStream stream = new ByteArrayOutputStream();
Relocator relocator = new Relocator(new OutputStreamWriter(stream, exc.getResponse().getCharset()), getLocationProtocol(), getLocationHost(exc), getLocationPort(exc), pathRewriter);
relocator.getRelocatingAttributes().put(new QName(WADL_NS, "resources"), "base");
relocator.getRelocatingAttributes().put(new QName(WADL_NS, "include"), "href");
relocator.relocate(new InputStreamReader(exc.getResponse().getBodyAsStreamDecoded(), exc.getResponse().getCharset()));
exc.getResponse().setBodyContent(stream.toByteArray());
}
use of com.predic8.membrane.core.ws.relocator.Relocator in project service-proxy by membrane.
the class WSDLInterceptor method rewrite.
@Override
protected void rewrite(Exchange exc) throws Exception, IOException {
log.debug("Changing endpoint address in WSDL");
ByteArrayOutputStream stream = new ByteArrayOutputStream();
Relocator relocator = new Relocator(new OutputStreamWriter(stream, exc.getResponse().getCharset()), getLocationProtocol(), getLocationHost(exc), getLocationPort(exc), pathRewriter);
if (rewriteEndpoint) {
relocator.getRelocatingAttributes().put(new QName(WSDL_SOAP11_NS, "address"), "location");
relocator.getRelocatingAttributes().put(new QName(WSDL_SOAP12_NS, "address"), "location");
relocator.getRelocatingAttributes().put(new QName(WSDL_HTTP_NS, "address"), "location");
}
relocator.getRelocatingAttributes().put(new QName(XSD_NS, "import"), "schemaLocation");
relocator.getRelocatingAttributes().put(new QName(XSD_NS, "include"), "schemaLocation");
relocator.relocate(new InputStreamReader(exc.getResponse().getBodyAsStreamDecoded(), exc.getResponse().getCharset()));
if (relocator.isWsdlFound()) {
registerWSDL(exc);
}
exc.getResponse().setBodyContent(stream.toByteArray());
}
Aggregations