
zed.org.apache.camel.rest.annotations.TargetRestOperation Maven / Gradle / Ivy
package zed.org.apache.camel.rest.annotations;
import org.apache.camel.Exchange;
import static org.apache.camel.Exchange.HTTP_URI;
class TargetRestOperation {
private static final String PATH_SEPARATOR = "/";
private final String service;
private final String operation;
TargetRestOperation(String service, String operation) {
this.service = service;
this.operation = operation;
}
static TargetRestOperation fromExchange(Exchange exchange) {
String path = exchange.getIn().getHeader(HTTP_URI, String.class);
String[] pathSegments = path.split(PATH_SEPARATOR);
String service = pathSegments[1];
String operation = pathSegments[2];
return new TargetRestOperation(service, operation);
}
String service() {
return service;
}
String operation() {
return operation;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy