1 10 11 package org.mule.impl.endpoint; 12 13 import org.mule.umo.endpoint.MalformedEndpointException; 14 15 import java.net.URI ; 16 import java.util.Properties ; 17 18 26 public class UserInfoEndpointBuilder extends AbstractEndpointBuilder 27 { 28 protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException 31 { 32 if(uri.getHost()==null) 34 { 35 if(props.getProperty("address")==null) 36 { 37 throw new MalformedEndpointException(uri.toString()); 38 } 39 else 40 { 41 return; 42 } 43 } 44 45 address = uri.getHost(); 47 int a = address.indexOf("."); 48 int b = (a == -1 ? -1 : address.indexOf(".", a + 1)); 49 if (b > -1) 50 { 51 address = address.substring(a + 1); 52 } 53 54 if (uri.getPort() != -1) 55 { 56 this.address += ":" + uri.getPort(); 58 } 59 60 if (userInfo != null) 61 { 62 int x = userInfo.indexOf(":"); 63 if (x > -1) 64 { 65 String user = userInfo.substring(0, x); 66 if (user.indexOf("@") > -1) 67 { 68 address = user; 69 } 70 else 71 { 72 address = user + "@" + address; 73 } 74 } 75 else 76 { 77 if (userInfo.indexOf("@") > -1) 78 { 79 address = userInfo; 80 } 81 else 82 { 83 address = userInfo + "@" + address; 84 } 85 } 86 } 87 } 88 } 89 | Popular Tags |