use of org.apache.cxf.configuration.jsse.TLSServerParameters in project cxf by apache.
the class JettyHTTPDestination method retrieveEngine.
/**
* Post-configure retreival of server engine.
*/
protected void retrieveEngine() throws GeneralSecurityException, IOException {
if (serverEngineFactory == null) {
return;
}
engine = serverEngineFactory.retrieveJettyHTTPServerEngine(nurl.getPort());
if (engine == null) {
engine = serverEngineFactory.createJettyHTTPServerEngine(nurl.getHost(), nurl.getPort(), nurl.getProtocol());
}
assert engine != null;
TLSServerParameters serverParameters = engine.getTlsServerParameters();
if (serverParameters != null && serverParameters.getCertConstraints() != null) {
CertificateConstraintsType constraints = serverParameters.getCertConstraints();
if (constraints != null) {
certConstraints = CertConstraintsJaxBUtils.createCertConstraints(constraints);
}
}
// Spring configuration has configured the port for https.
if (!nurl.getProtocol().equals(engine.getProtocol())) {
throw new IllegalStateException("Port " + engine.getPort() + " is configured with wrong protocol \"" + engine.getProtocol() + "\" for \"" + nurl + "\"");
}
}
use of org.apache.cxf.configuration.jsse.TLSServerParameters in project cxf by apache.
the class JettyHTTPServerEngineFactory method createJettyHTTPServerEngine.
/**
* This call creates a new JettyHTTPServerEngine initialized for "http"
* or "https" on the given port. The determination of "http" or "https"
* will depend on configuration of the engine's bean name.
*
* If an JettyHTTPEngine already exists, or the port
* is already in use, a BindIOException will be thrown. If the
* engine is being Spring configured for TLS a GeneralSecurityException
* may be thrown.
*
* @param host if not null, server will listen on this host/address, otherwise
* server will listen on all local addresses.
* @param port listen port for server
* @param protocol "http" or "https"
* @param id The key to reference into the tlsParametersMap. Can be null.
* @return
* @throws GeneralSecurityException
* @throws IOException
*/
public synchronized JettyHTTPServerEngine createJettyHTTPServerEngine(String host, int port, String protocol, String id) throws GeneralSecurityException, IOException {
LOG.fine("Creating Jetty HTTP Server Engine for port " + port + ".");
TLSServerParameters tlsParameters = null;
if (id != null && tlsParametersMap != null && tlsParametersMap.containsKey(id)) {
tlsParameters = tlsParametersMap.get(id);
}
JettyHTTPServerEngine ref = getOrCreate(this, host, port, tlsParameters);
// checking the protocol
if (!protocol.equals(ref.getProtocol())) {
throw new IOException("Protocol mismatch for port " + port + ": " + "engine's protocol is " + ref.getProtocol() + ", the url protocol is " + protocol);
}
if (!(ref.isSetThreadingParameters() || null == fallbackThreadingParameters)) {
if (LOG.isLoggable(Level.INFO)) {
final int min = fallbackThreadingParameters.getMinThreads();
final int max = fallbackThreadingParameters.getMaxThreads();
final String threadNamePrefix = fallbackThreadingParameters.getThreadNamePrefix();
LOG.log(Level.INFO, "FALLBACK_THREADING_PARAMETERS_MSG", new Object[] { port, min, max, threadNamePrefix });
}
ref.setThreadingParameters(fallbackThreadingParameters);
}
return ref;
}
Aggregations