2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
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.
17 package org
.argeo
.slc
.support
.deploy
;
20 import java
.net
.MalformedURLException
;
23 import org
.argeo
.slc
.SlcException
;
24 import org
.argeo
.slc
.deploy
.TargetData
;
26 public class HttpdApplicationTargetData
implements TargetData
{
27 private HttpdServer webServer
;
28 private String relativePath
;
29 private String targetRootPath
;
31 public HttpdServer
getWebServer() {
35 public void setWebServer(HttpdServer webServer
) {
36 this.webServer
= webServer
;
39 public String
getRelativePath() {
44 * If targetRootLocation not set, used to build the targetRootLocation,
45 * relative to the webserver base.
47 public void setRelativePath(String relativePath
) {
48 this.relativePath
= relativePath
;
51 public String
getTargetRootPath() {
52 return targetRootPath
;
55 public void setTargetRootPath(String targetRootPath
) {
56 this.targetRootPath
= targetRootPath
;
59 public URL
getTargetBaseUrl() {
61 URL wsUrl
= getWebServer().getBaseUrl();
63 return new URL(wsUrl
, wsUrl
.getFile() + '/' + relativePath
);
64 } catch (MalformedURLException e
) {
65 throw new SlcException("Cannot get base url for " + relativePath
, e
);
69 public File
getTargetRootLocation() {
70 if (targetRootPath
!= null && !targetRootPath
.equals("")) {
71 return new File(targetRootPath
);
73 HttpdServerTargetData targetData
= (HttpdServerTargetData
) getWebServer()
75 String path
= targetData
.getServerRoot() + File
.separator
77 return new File(path
);