2 * Copyright (C) 2007-2012 Argeo GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.slc
.support
.deploy
;
19 import java
.net
.MalformedURLException
;
22 import org
.argeo
.slc
.SlcException
;
23 import org
.argeo
.slc
.deploy
.TargetData
;
25 public class HttpdApplicationTargetData
implements TargetData
{
26 private HttpdServer webServer
;
27 private String relativePath
;
28 private String targetRootPath
;
30 public HttpdServer
getWebServer() {
34 public void setWebServer(HttpdServer webServer
) {
35 this.webServer
= webServer
;
38 public String
getRelativePath() {
43 * If targetRootLocation not set, used to build the targetRootLocation,
44 * relative to the webserver base.
46 public void setRelativePath(String relativePath
) {
47 this.relativePath
= relativePath
;
50 public String
getTargetRootPath() {
51 return targetRootPath
;
54 public void setTargetRootPath(String targetRootPath
) {
55 this.targetRootPath
= targetRootPath
;
58 public URL
getTargetBaseUrl() {
60 URL wsUrl
= getWebServer().getBaseUrl();
62 return new URL(wsUrl
, wsUrl
.getFile() + '/' + relativePath
);
63 } catch (MalformedURLException e
) {
64 throw new SlcException("Cannot get base url for " + relativePath
, e
);
68 public File
getTargetRootLocation() {
69 if (targetRootPath
!= null && !targetRootPath
.equals("")) {
70 return new File(targetRootPath
);
72 HttpdServerTargetData targetData
= (HttpdServerTargetData
) getWebServer()
74 String path
= targetData
.getServerRoot() + File
.separator
76 return new File(path
);