Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
WsdlUrlEndpointURIBuilder |
|
| 6.0;6 |
1 | /* | |
2 | * $Id: WsdlUrlEndpointURIBuilder.java 10489 2008-01-23 17:53:38Z dfeist $ | |
3 | * -------------------------------------------------------------------------------------- | |
4 | * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com | |
5 | * | |
6 | * The software in this package is published under the terms of the CPAL v1.0 | |
7 | * license, a copy of which has been included with this distribution in the | |
8 | * LICENSE.txt file. | |
9 | */ | |
10 | ||
11 | package org.mule.transport.soap; | |
12 | ||
13 | import org.mule.api.endpoint.MalformedEndpointException; | |
14 | import org.mule.endpoint.AbstractEndpointURIBuilder; | |
15 | ||
16 | import java.net.URI; | |
17 | import java.util.Properties; | |
18 | ||
19 | /** | |
20 | * The same as the UrlEndpointbuilder except that all parameters except the first are | |
21 | * set as properties on the endpoint and stripped from the endpoint Uri | |
22 | */ | |
23 | 0 | public class WsdlUrlEndpointURIBuilder extends AbstractEndpointURIBuilder |
24 | { | |
25 | ||
26 | protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException | |
27 | { | |
28 | 0 | address = ""; |
29 | 0 | if (uri.getHost() != null) |
30 | { | |
31 | // set the endpointUri to be a proper url if host and port are set | |
32 | 0 | this.address = uri.getScheme() + "://" + uri.getHost(); |
33 | 0 | if (uri.getPort() != -1) |
34 | { | |
35 | 0 | address += ":" + uri.getPort(); |
36 | } | |
37 | } | |
38 | 0 | if (uri.getPath() != null) |
39 | { | |
40 | 0 | address += uri.getPath(); |
41 | } | |
42 | 0 | String query = uri.getQuery(); |
43 | 0 | if (query != null) |
44 | { | |
45 | 0 | int i = query.indexOf("&"); |
46 | 0 | if (i > -1) |
47 | { | |
48 | 0 | address += "?" + query.substring(0, i); |
49 | ||
50 | } | |
51 | else | |
52 | { | |
53 | 0 | address += "?" + query; |
54 | } | |
55 | } | |
56 | 0 | } |
57 | } |