Package com.sun.xml.ws.api
Class EndpointAddress
- java.lang.Object
-
- com.sun.xml.ws.api.EndpointAddress
-
public final class EndpointAddress extends Object
Represents the endpoint address URI.Conceptually this can be really thought of as an
URI, but it hides some of the details that improve the performance.Being an
URIallows this class to represent custom made-up URIs (like "jms" for example.) Whenever possible, this object also creates anURL(this is only possible when the address has a registeredURLStreamHandler), so that if the clients of this code wants to use it, it can do so.How it improves the performance
-
Endpoint address is often eventually turned into an
URLConnection, and given that generally this value is read more often than being set, it makes sense to eagerly turn it into anURL, thereby avoiding a repeated conversion. -
JDK spends a lot of time choosing a list of
Proxyto connect to anURL. Since the default proxy selector implementation always return the same proxy for the same URL, we can determine the proxy by ourselves to let JDK skip its proxy-discovery step. (That said, user-defined proxy selector can do a lot of interesting things --- like doing a round-robin, or pick one from a proxy farm randomly, and so it's dangerous to stick to one proxy. For this case, we still let JDK decide the proxy. This shouldn't be that much of an disappointment, since most people only mess with system properties, and never withProxySelector. Also, avoiding optimization with non-standard proxy selector allows people to effectively disable this optimization, which may come in handy for a trouble-shooting.)
- Author:
- Kohsuke Kawaguchi
-
Endpoint address is often eventually turned into an
-
-
Constructor Summary
Constructors Constructor Description EndpointAddress(String url)EndpointAddress(URI uri)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EndpointAddresscreate(String url)Creates a newEndpointAddresswith a reasonably generic error handling.URIgetURI()Returns an URI of the endpoint address.URLgetURL()Returns an URL of this endpoint adress.URLConnectionopenConnection()Tries to openURLConnectionfor this endpoint.StringtoString()
-
-
-
Constructor Detail
-
EndpointAddress
public EndpointAddress(URI uri)
-
EndpointAddress
public EndpointAddress(String url) throws URISyntaxException
- Throws:
URISyntaxException- See Also:
create(String)
-
-
Method Detail
-
create
public static EndpointAddress create(String url)
Creates a newEndpointAddresswith a reasonably generic error handling.
-
getURL
public URL getURL()
Returns an URL of this endpoint adress.- Returns:
- null if this endpoint address doesn't have a registered
URLStreamHandler.
-
getURI
public URI getURI()
Returns an URI of the endpoint address.- Returns:
- always non-null.
-
openConnection
public URLConnection openConnection() throws IOException
Tries to openURLConnectionfor this endpoint.This is possible only when an endpoint address has the corresponding
URLStreamHandler.- Throws:
IOException- ifURL.openConnection()reports an error.AssertionError- if this endpoint doesn't have an associated URL. if the code is written correctly this shall never happen.
-
-