FileDocCategorySizeDatePackage
TCPTransport.javaAPI DocApache Axis 1.43070Sat Apr 22 18:56:52 BST 2006samples.transport.tcp

TCPTransport

public class TCPTransport extends org.apache.axis.client.Transport
author
Rob Jellinghaus (robj@unrealities.com)
author
Doug Davis (dug@us.ibm.com)
author
Glen Daniels (gdaniels@allaire.com)

Fields Summary
static Log
log
private String
host
private String
port
public static String
HOST
TCP properties
public static String
PORT
Constructors Summary
public TCPTransport()

    
       
        transportName = "tcp";
    
public TCPTransport(String host, String port)

        transportName = "tcp";
        this.host = host;
        this.port = port;
    
Methods Summary
public voidsetupMessageContextImpl(org.apache.axis.MessageContext mc, org.apache.axis.client.Call call, org.apache.axis.AxisEngine engine)
Set up any transport-specific derived properties in the message context.

param
context the context to set up
param
message the client service instance
param
engine the engine containing the registries

    
                                       
       
                                         
                                         
    
        try {
          String urlString = mc.getStrProp(MessageContext.TRANS_URL);
          if (urlString != null) {
            URL url = new URL(urlString);
            host = url.getHost();
            port = new Integer(url.getPort()).toString();
          }
        } catch (java.net.MalformedURLException e) {
          // Do nothing here?
        }

        if (host != null) mc.setProperty(HOST, host);
        if (port != null) mc.setProperty(PORT, port);

        log.debug( "Port = " + mc.getStrProp(PORT));
        log.debug( "Host = " + mc.getStrProp(HOST));
        
        // kind of ugly... fake up a "http://host:port/" url to send down the chain
        // ROBJ TODO: clean this up so we use TCP transport properties all the way down
        // use serviceclient properties if any, otherwise use ours
        /*
        String url = "http://"+serv.get(HOST)+":"+serv.get(PORT);
        
        log.debug( "TCPTransport set URL to '" + url + "'");
        mc.setProperty(MessageContext.TRANS_URL, url);
        */