Right, if the endpoint address is relative (=> Servlet transport) then
CXF does not know until the runtime what the container host, port or
context is
Sergey
On 23/05/17 14:02, James Carman wrote:
I tried various attempts at getting what need:
final Server server = sf.create();
if(server.getDestination() instanceof AbstractHTTPDestination) {
AbstractHTTPDestination httpDestination =
(AbstractHTTPDestination)server.getDestination();
LOGGER.info("publishedEndpointUrl: {}",
httpDestination.getEndpointInfo().getProperty("publishedEndpointUrl"));
LOGGER.info("AbstractHTTPDestination.getPath(): {}",
httpDestination.getPath());
LOGGER.info("AbstractHTTPDestination.getServer().getRedirectURL(): {}",
httpDestination.getServer().getRedirectURL());
}
LOGGER.info("server.getDestination().getAddress().getAddress().getValue():
{}", server.getDestination().getAddress().getAddress().getValue());
LOGGER.info("server.getEndpoint().getEndpointInfo().getAddress(): {}",
server.getEndpoint().getEndpointInfo().getAddress());
Which only yielded:
2017-05-23T09:00:57,340 | INFO | pool-40-thread-1 |
DefaultJaxrsServerFactory | 140 - org.microbule.core - 0.3.0.SNAPSHOT |
publishedEndpointUrl: null
2017-05-23T09:00:57,340 | INFO | pool-40-thread-1 |
DefaultJaxrsServerFactory | 140 - org.microbule.core - 0.3.0.SNAPSHOT |
AbstractHTTPDestination.getPath(): /hello
2017-05-23T09:00:57,341 | INFO | pool-40-thread-1 |
DefaultJaxrsServerFactory | 140 - org.microbule.core - 0.3.0.SNAPSHOT |
AbstractHTTPDestination.getServer().getRedirectURL(): null
2017-05-23T09:00:57,342 | INFO | pool-40-thread-1 |
DefaultJaxrsServerFactory | 140 - org.microbule.core - 0.3.0.SNAPSHOT |
server.getDestination().getAddress().getAddress().getValue(): /hello
2017-05-23T09:00:57,342 | INFO | pool-40-thread-1 |
DefaultJaxrsServerFactory | 140 - org.microbule.core - 0.3.0.SNAPSHOT |
server.getEndpoint().getEndpointInfo().getAddress(): /hello
On Tue, May 23, 2017 at 3:27 AM Dennis Kieselhorst <[email protected]> wrote:
Is there a way to ascertain the full address of a server created with
JAXRSServerFactoryBean? For example, if I only set the address to
"/foo",
is there any way to know that the full address is actually "
http://10.1.1.1/cxf/foo"?
You can get the Address from EndpointInfo or use the publishedEndpointUrl
property.
Regards
Dennis