This project has retired. For details please refer to its
Attic page.
URLLocalizerDefaultImpl xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.juddi.v3.client.mapping;
18
19 import java.net.MalformedURLException;
20 import java.net.URL;
21
22 import org.apache.commons.logging.Log;
23 import org.apache.commons.logging.LogFactory;
24
25 public class URLLocalizerDefaultImpl implements URLLocalizer {
26
27 URL baseUrl;
28
29 public URLLocalizerDefaultImpl() {
30 super();
31 }
32 public URLLocalizerDefaultImpl(URL baseUrl) {
33 super();
34 this.baseUrl = baseUrl;
35 }
36
37 private Log log = LogFactory.getLog(this.getClass());
38
39 public String rewrite (URL urlIn) {
40 return rewriteURL(urlIn).toExternalForm();
41 }
42
43 public String rewriteToWSDLURL (URL urlIn) {
44 URL url = rewriteURL(urlIn);
45 return url.toExternalForm() + "?wsdl";
46 }
47
48 public URL rewriteURL(URL urlIn) {
49 URL url = null;
50 if (baseUrl!=null && url == null) {
51 try {
52 url = new URL(baseUrl.getProtocol(),
53 baseUrl.getHost(),
54 baseUrl.getPort(),
55 urlIn.getPath());
56 } catch (MalformedURLException e) {
57 log.error(e.getMessage(),e);
58 }
59 } else {
60 url = urlIn;
61 }
62 return url;
63 }
64
65 public void setBaseUrl(URL baseUrl) {
66 this.baseUrl = baseUrl;
67 }
68
69
70 }