EMMA Coverage Report (generated Fri Sep 15 10:32:43 EDT 2006)
[all classes][org.apache.pluto.driver.core]

COVERAGE SUMMARY FOR SOURCE FILE [ResourceURLProviderImpl.java]

nameclass, %method, %block, %line, %
ResourceURLProviderImpl.java0%   (0/1)0%   (0/5)0%   (0/76)0%   (0/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ResourceURLProviderImpl0%   (0/1)0%   (0/5)0%   (0/76)0%   (0/19)
<static initializer> 0%   (0/1)0%   (0/4)0%   (0/1)
ResourceURLProviderImpl (HttpServletRequest, PortletWindow): void 0%   (0/1)0%   (0/29)0%   (0/7)
setAbsoluteURL (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
setFullPath (String): void 0%   (0/1)0%   (0/12)0%   (0/2)
toString (): String 0%   (0/1)0%   (0/27)0%   (0/7)

1/*
2 * Copyright 2003,2004 The Apache Software Foundation.
3 * 
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
7 * 
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 * 
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.
15 */
16package org.apache.pluto.driver.core;
17 
18import java.net.MalformedURLException;
19import java.net.URL;
20 
21import javax.servlet.http.HttpServletRequest;
22 
23import org.apache.commons.logging.Log;
24import org.apache.commons.logging.LogFactory;
25import org.apache.pluto.PortletWindow;
26import org.apache.pluto.driver.url.PortalURLFactory;
27import org.apache.pluto.spi.ResourceURLProvider;
28 
29public class ResourceURLProviderImpl implements ResourceURLProvider {
30 
31    private static final Log LOG =
32        LogFactory.getLog(ResourceURLProviderImpl.class);
33 
34    private String stringUrl = "";
35    private String base = "";
36 
37    public ResourceURLProviderImpl(HttpServletRequest req,
38                                   PortletWindow internalPortletWindow) {
39        this.base =
40        PortalURLFactory.getFactory().createPortalURL(req).getServerURI();
41        if (LOG.isDebugEnabled()) {
42            LOG.debug("Resource URL Created with base: " + base);
43        }
44    }
45 
46    public void setAbsoluteURL(String path) {
47        stringUrl = path;
48    }
49 
50    public void setFullPath(String path) {
51        stringUrl = base + path;
52    }
53 
54    public String toString() {
55        URL url = null;
56 
57        if (!"".equals(stringUrl)) {
58            try {
59                url = new URL(stringUrl);
60            } catch (MalformedURLException e) {
61                throw new java.lang.IllegalArgumentException(
62                    "A malformed URL has occured");
63            }
64        }
65 
66        return ((url == null) ? "" : url.toString());
67 
68    }
69}

[all classes][org.apache.pluto.driver.core]
EMMA 2.0.5312 (C) Vladimir Roubtsov