blob: 52d28de689085e7e7571cc77fbb2f98ac6114f5e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/*******************************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.wst.ws.internal.explorer.platform.wsil.datamodel;
import org.eclipse.wst.ws.internal.datamodel.BasicElement;
import org.eclipse.wst.ws.internal.datamodel.Model;
public class WsilCommonElement extends BasicElement
{
private String baseWsilURL;
private String relativeURIBase;
public WsilCommonElement(String name, Model model)
{
super(name, model);
}
public String getBaseWsilURL()
{
return baseWsilURL;
}
public void setBaseWsilURL(String baseWsilURL)
{
this.baseWsilURL = baseWsilURL;
}
private final char FWD_SLASH = '/';
private final char BWD_SLASH = '\\';
private final char PROTOCOL_INDICATOR = ':';
public String makeAbsolute(String uri)
{
if (baseWsilURL != null && uri != null && uri.indexOf(PROTOCOL_INDICATOR) == -1)
{
if (relativeURIBase == null)
{
relativeURIBase = baseWsilURL.replace(BWD_SLASH, FWD_SLASH);
int index = relativeURIBase.lastIndexOf(FWD_SLASH);
relativeURIBase = baseWsilURL.substring(0, index + 1);
}
StringBuffer sb = new StringBuffer(relativeURIBase);
sb.append(uri);
return sb.toString();
}
return uri;
}
}
|