FileDocCategorySizeDatePackage
WSTCPURI.javaAPI DocExample5813Tue May 29 16:57:14 BST 2007com.sun.xml.ws.transport.tcp.util

WSTCPURI

public final class WSTCPURI extends Object implements com.sun.xml.ws.transport.tcp.connectioncache.spi.transport.ContactInfo
author
Alexey Stashok

Fields Summary
public String
host
public int
port
public String
path
private String
uri2string
private Map
params
Constructors Summary
public WSTCPURI()
This constructor should be used just by JAXB runtime

private WSTCPURI(String host, int port, String path, Map params, String uri2string)

        this.host = host;
        this.port = port;
        this.path = path;
        this.params = params;
        this.uri2string = uri2string;
    
Methods Summary
public ConnectionSessioncreateConnection()

        try {
            return WSConnectionManager.getInstance().createConnectionSession(this);
        } catch (VersionMismatchException e) {
            throw new IOException(e.getMessage());
        } catch (ServiceChannelException e) {
            throw new IOException(MessagesMessages.WSTCP_0024_SERVICE_CHANNEL_EXCEPTION(e.getFaultInfo().getErrorCode(), e.getMessage()));
        }
    
public booleanequals(java.lang.Object o)

        if (o instanceof WSTCPURI) {
            WSTCPURI toCmp = (WSTCPURI) o;
            return port == toCmp.port && host.equals(toCmp.host);
        }
        
        return false;
    
public java.lang.StringgetParameter(java.lang.String name)

        if (params != null) {
            return params.get(name);
        }
        
        return null;
    
public inthashCode()

        return host.hashCode() + port;
    
public static com.sun.xml.ws.transport.tcp.util.WSTCPURIparse(java.lang.String uri)

        try {
            return parse(new URI(uri));
        } catch (URISyntaxException ex) {
            return null;
        }
    
public static com.sun.xml.ws.transport.tcp.util.WSTCPURIparse(java.net.URI uri)

        final String path = uri.getPath();
        final String query = uri.getQuery();
        Map<String, String> params = null;
        
        if (query != null && query.length() > 0) {
            final String[] paramsStr = query.split(";");
            params = new HashMap<String, String>(paramsStr.length);
            for(String paramStr : paramsStr) {
                if (paramStr.length() > 0) {
                    final String[] paramAsgn = paramStr.split("=");
                    if (paramAsgn != null && paramAsgn.length == 2 && paramAsgn[0].length() > 0 && paramAsgn[1].length() > 0) {
                        params.put(paramAsgn[0], paramAsgn[1]);
                    }
                }
            }
        }
        
        return new WSTCPURI(uri.getHost(), uri.getPort(), path, params, uri.toASCIIString());
    
public java.lang.StringtoString()

        return uri2string;