Package org.jboss.resteasy.utils
Class PortProviderUtil
java.lang.Object
org.jboss.resteasy.utils.PortProviderUtil
Utility class that provides a port number for the Resteasy embedded container.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
createProxy
(Class<T> clazz, String testName) Create a Resteasy client proxy with an empty base request path.static <T> T
createProxy
(Class<T> clazz, String path, String testName) Create a Resteasy client proxy.static URI
Create a URI for the provided path, using the configured portstatic URL
Create a URL for the provided path, using the configured portstatic int
Looks for an available open port from 1024 to 65535.static int
findOpenPort
(int minPort) Looks for an available open port from minimum port passed to 65535.static String
generateBaseUrl
(String testName) Generate a base URL incorporating the configured port.static String
generateURL
(String path, String testName) Generate a URL incorporating the configured port.static String
generateURL
(String path, String testName, String hostName, int port) Generate a URL with port, hostnamestatic String
getHost()
Get host IP.static int
getPort()
Get port.static boolean
isIpv6()
Get information about IPv6 connectivity.
-
Field Details
-
ASYNC_JOB_SERVICE_CONTEXT_KEY
- See Also:
-
-
Constructor Details
-
PortProviderUtil
public PortProviderUtil()
-
-
Method Details
-
createProxy
Create a Resteasy client proxy with an empty base request path.- Parameters:
clazz
- the client interface class- Returns:
- the proxy object
-
createProxy
Create a Resteasy client proxy.- Parameters:
clazz
- the client interface classpath
- the base request path- Returns:
- the proxy object
-
createURI
Create a URI for the provided path, using the configured port- Parameters:
path
- the request path- Returns:
- a full URI
-
createURL
Create a URL for the provided path, using the configured port- Parameters:
path
- the request path- Returns:
- a full URL
- Throws:
MalformedURLException
-
generateBaseUrl
Generate a base URL incorporating the configured port.- Returns:
- a full URL
-
generateURL
Generate a URL incorporating the configured port.- Parameters:
path
- the pathtestName
- the test name- Returns:
- a full URL
-
generateURL
Generate a URL with port, hostname- Parameters:
path
- the path- Returns:
- a full URL
-
getPort
public static int getPort()Get port.- Returns:
- The port number
-
getHost
Get host IP.- Returns:
- The host IP
-
isIpv6
public static boolean isIpv6()Get information about IPv6 connectivity.- Returns:
- IPv6 connectivity.
-
findOpenPort
public static int findOpenPort()Looks for an available open port from 1024 to 65535.- Returns:
- the available port
- Throws:
RuntimeException
- if no port is available
-
findOpenPort
public static int findOpenPort(int minPort) Looks for an available open port from minimum port passed to 65535.- Parameters:
minPort
- the minimum port number to attempt- Returns:
- the available port
- Throws:
RuntimeException
- if no port is available
-