public void setUseSunHttpsHandler(boolean useSunHttpsHandler) {
this.useSunHttpsHandler = useSunHttpsHandler;
}
public synchronized Service createService(CamelContext camelContext) {
final ServiceArgs args = new ServiceArgs();
if (host != null) {
args.setHost(host);
}
if (port > 0) {
args.setPort(port);
}
if (scheme != null) {
args.setScheme(scheme);
}
if (app != null) {
args.setApp(app);
}
if (owner != null) {
args.setOwner(owner);
}
args.setUsername(username);
args.setPassword(password);
// useful in cases where you want to bypass app. servers https handling
// (wls i'm looking at you)
if (isUseSunHttpsHandler()) {
String sunHandlerClassName = "sun.net.www.protocol.https.Handler";
Class<URLStreamHandler> clazz = camelContext.getClassResolver().resolveClass(sunHandlerClassName, URLStreamHandler.class);
if (clazz != null) {
URLStreamHandler handler = camelContext.getInjector().newInstance(clazz);
args.setHTTPSHandler(handler);
LOG.debug("using the URLStreamHandler {} for {}", handler, args);
} else {
LOG.warn("could not resolve and use the URLStreamHandler class '{}'", sunHandlerClassName);
}
}