Deprecate Undertow container's constructors that have a port parameter
Closes gh-5546
This commit is contained in:
parent
df4a569ec5
commit
0db118c189
|
|
@ -87,20 +87,100 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine
|
||||||
|
|
||||||
private boolean started = false;
|
private boolean started = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new {@link UndertowEmbeddedServletContainer} instance.
|
||||||
|
* @param builder the builder
|
||||||
|
* @param manager the deployment manager
|
||||||
|
* @param contextPath root the context path
|
||||||
|
* @param port the port to listen on (not used)
|
||||||
|
* @param autoStart if the server should be started
|
||||||
|
* @param compression compression configuration
|
||||||
|
* @deprecated as of 1.4 in favor of using constructors without port argument
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public UndertowEmbeddedServletContainer(Builder builder, DeploymentManager manager,
|
public UndertowEmbeddedServletContainer(Builder builder, DeploymentManager manager,
|
||||||
String contextPath, int port, boolean autoStart, Compression compression) {
|
String contextPath, int port, boolean autoStart, Compression compression) {
|
||||||
this(builder, manager, contextPath, port, false, autoStart, compression);
|
this(builder, manager, contextPath, false, autoStart, compression);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new {@link UndertowEmbeddedServletContainer} instance.
|
||||||
|
* @param builder the builder
|
||||||
|
* @param manager the deployment manager
|
||||||
|
* @param contextPath root the context path
|
||||||
|
* @param port the port to listen on (not used)
|
||||||
|
* @param useForwardHeaders if x-forward headers should be used
|
||||||
|
* @param autoStart if the server should be started
|
||||||
|
* @param compression compression configuration
|
||||||
|
* @deprecated as of 1.4 in favor of using constructors without port argument
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public UndertowEmbeddedServletContainer(Builder builder, DeploymentManager manager,
|
public UndertowEmbeddedServletContainer(Builder builder, DeploymentManager manager,
|
||||||
String contextPath, int port, boolean useForwardHeaders, boolean autoStart,
|
String contextPath, int port, boolean useForwardHeaders, boolean autoStart,
|
||||||
Compression compression) {
|
Compression compression) {
|
||||||
this(builder, manager, contextPath, port, useForwardHeaders, autoStart,
|
this(builder, manager, contextPath, useForwardHeaders, autoStart, compression, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new {@link UndertowEmbeddedServletContainer} instance.
|
||||||
|
* @param builder the builder
|
||||||
|
* @param manager the deployment manager
|
||||||
|
* @param contextPath root the context path
|
||||||
|
* @param port the port to listen on (not used)
|
||||||
|
* @param useForwardHeaders if x-forward headers should be used
|
||||||
|
* @param autoStart if the server should be started
|
||||||
|
* @param compression compression configuration
|
||||||
|
* @param serverHeader string to be used in http header
|
||||||
|
* @deprecated as of 1.4 in favor of using constructors without port argument
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public UndertowEmbeddedServletContainer(Builder builder, DeploymentManager manager,
|
||||||
|
String contextPath, int port, boolean useForwardHeaders, boolean autoStart,
|
||||||
|
Compression compression, String serverHeader) {
|
||||||
|
this(builder, manager, contextPath, useForwardHeaders, autoStart, compression, serverHeader);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new {@link UndertowEmbeddedServletContainer} instance.
|
||||||
|
* @param builder the builder
|
||||||
|
* @param manager the deployment manager
|
||||||
|
* @param contextPath root the context path
|
||||||
|
* @param autoStart if the server should be started
|
||||||
|
* @param compression compression configuration
|
||||||
|
*/
|
||||||
|
public UndertowEmbeddedServletContainer(Builder builder, DeploymentManager manager,
|
||||||
|
String contextPath, boolean autoStart, Compression compression) {
|
||||||
|
this(builder, manager, contextPath, false, autoStart, compression);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new {@link UndertowEmbeddedServletContainer} instance.
|
||||||
|
* @param builder the builder
|
||||||
|
* @param manager the deployment manager
|
||||||
|
* @param contextPath root the context path
|
||||||
|
* @param useForwardHeaders if x-forward headers should be used
|
||||||
|
* @param autoStart if the server should be started
|
||||||
|
* @param compression compression configuration
|
||||||
|
*/
|
||||||
|
public UndertowEmbeddedServletContainer(Builder builder, DeploymentManager manager,
|
||||||
|
String contextPath, boolean useForwardHeaders, boolean autoStart,
|
||||||
|
Compression compression) {
|
||||||
|
this(builder, manager, contextPath, useForwardHeaders, autoStart,
|
||||||
compression, null);
|
compression, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new {@link UndertowEmbeddedServletContainer} instance.
|
||||||
|
* @param builder the builder
|
||||||
|
* @param manager the deployment manager
|
||||||
|
* @param contextPath root the context path
|
||||||
|
* @param useForwardHeaders if x-forward headers should be used
|
||||||
|
* @param autoStart if the server should be started
|
||||||
|
* @param compression compression configuration
|
||||||
|
* @param serverHeader string to be used in http header
|
||||||
|
*/
|
||||||
public UndertowEmbeddedServletContainer(Builder builder, DeploymentManager manager,
|
public UndertowEmbeddedServletContainer(Builder builder, DeploymentManager manager,
|
||||||
String contextPath, int port, boolean useForwardHeaders, boolean autoStart,
|
String contextPath, boolean useForwardHeaders, boolean autoStart,
|
||||||
Compression compression, String serverHeader) {
|
Compression compression, String serverHeader) {
|
||||||
this.builder = builder;
|
this.builder = builder;
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
|
|
@ -231,10 +311,10 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine
|
||||||
}
|
}
|
||||||
|
|
||||||
private Port getPortFromChannel(BoundChannel channel) {
|
private Port getPortFromChannel(BoundChannel channel) {
|
||||||
String protocol = ReflectionUtils.findField(channel.getClass(), "ssl") != null
|
|
||||||
? "https" : "http";
|
|
||||||
SocketAddress socketAddress = channel.getLocalAddress();
|
SocketAddress socketAddress = channel.getLocalAddress();
|
||||||
if (socketAddress instanceof InetSocketAddress) {
|
if (socketAddress instanceof InetSocketAddress) {
|
||||||
|
String protocol = ReflectionUtils.findField(channel.getClass(), "ssl") != null
|
||||||
|
? "https" : "http";
|
||||||
return new Port(((InetSocketAddress) socketAddress).getPort(), protocol);
|
return new Port(((InetSocketAddress) socketAddress).getPort(), protocol);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -501,8 +501,7 @@ public class UndertowEmbeddedServletContainerFactory
|
||||||
protected UndertowEmbeddedServletContainer getUndertowEmbeddedServletContainer(
|
protected UndertowEmbeddedServletContainer getUndertowEmbeddedServletContainer(
|
||||||
Builder builder, DeploymentManager manager, int port) {
|
Builder builder, DeploymentManager manager, int port) {
|
||||||
return new UndertowEmbeddedServletContainer(builder, manager, getContextPath(),
|
return new UndertowEmbeddedServletContainer(builder, manager, getContextPath(),
|
||||||
port, isUseForwardHeaders(), port >= 0, getCompression(),
|
isUseForwardHeaders(), port >= 0, getCompression(), getServerHeader());
|
||||||
getServerHeader());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue