1
2
3
4
5
6
7 package org.mule.endpoint;
8
9 import org.mule.api.endpoint.MalformedEndpointException;
10
11 import java.net.URI;
12 import java.util.Properties;
13
14
15
16
17
18 public class SocketEndpointURIBuilder extends AbstractEndpointURIBuilder
19 {
20 protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException
21 {
22
23 if (uri.getPort() == -1)
24 {
25
26 try
27 {
28 int port = Integer.parseInt(uri.getHost());
29 this.address = uri.getScheme() + "://localhost:" + port;
30 }
31 catch (NumberFormatException e)
32 {
33
34 }
35 }
36
37 if (address == null)
38 {
39 this.address = uri.getScheme() + "://" + uri.getHost();
40 if (uri.getPort() != -1)
41 {
42 this.address += ":" + uri.getPort();
43 }
44 }
45 }
46 }