1 23 24 package com.sun.enterprise.admin.util; 25 import java.util.StringTokenizer ; 27 import java.io.Serializable ; 28 29 33 public class HostAndPort implements Serializable 34 { 35 36 public static final long serialVersionUID = 6708656762332072746L; 37 protected String mHost = null; 38 protected int mPort; 39 private boolean secure = false; 40 41 42 public HostAndPort(String host, int port, boolean secure){ 43 this.mHost = host; 44 this.mPort = port; 45 this.secure = secure; 46 } 47 48 public HostAndPort(HostAndPort rhs){ 49 this(rhs.mHost,rhs.mPort,rhs.secure); 50 } 51 52 public HostAndPort( String host, int port ) { 53 this(host, port, false); 54 } 55 56 public boolean isSecure(){ 57 return this.secure; 58 } 59 60 61 62 public String 63 getHost() 64 { 65 return( mHost ); 66 } 67 68 public int 69 getPort() 70 { 71 return( mPort ); 72 } 73 74 79 public HostAndPort( String str ) 80 { 81 StringTokenizer tokenizer = 82 new StringTokenizer ( str, ":", false); 83 84 mHost = tokenizer.nextToken(); 85 86 final String portString = tokenizer.nextToken(); 87 mPort = new Integer ( portString ).intValue(); 88 } 89 90 public String 91 toString() 92 { 93 return( mHost + ":" + mPort ); 94 } 95 } 96 | Popular Tags |