KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > appclient > jws > Content


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.appclient.jws;
25
26 /**
27  *Abstract superclass of all types of content.
28  *
29  * @author tjquinn
30  */

31     
32 public abstract class Content {
33
34     protected final String JavaDoc lineSep = System.getProperty("line.separator");
35
36     /**
37      *The path to the content as specified in URLs. This is the "virtual"
38      *path.
39      */

40     private String JavaDoc path;
41
42     /**
43      *The key by which this content can be looked up in the content map.
44      */

45     protected String JavaDoc contentKey;
46     
47     /** The origin that owns this content. */
48     private ContentOrigin origin;
49
50     /** Creates a new instance of Content */
51     public Content(ContentOrigin origin, String JavaDoc contentKey, String JavaDoc path) {
52         this.origin = origin;
53         this.contentKey = contentKey;
54         this.path = path;
55     }
56
57     /**
58      *Returns the virtual path within the content's subcategory to the content.
59      *
60      */

61     public String JavaDoc getPath() {
62         return path;
63     }
64
65     /**
66      *Returns the content key for this content.
67      *<p>
68      *Prefixing a slash makes it easier to compare this to the pathInfo from
69      *an incoming HTTP request that is seeking content.
70      */

71     public String JavaDoc getContentKey() {
72         return contentKey;
73     }
74
75     /**
76      *Returns the content origin which owns this content.
77      *@return ContentOrigin for the owning origin
78      */

79     public ContentOrigin getOrigin() {
80         return origin;
81     }
82     
83     /**
84      *Returns a string representation of the content.
85      * <p>
86      * Even though Content is abstract, subclasses use super.toString().
87      */

88     public String JavaDoc toString() {
89         return getClass().getName() + ": content key=" + getContentKey() + ", path=" + getPath();
90     }
91 }
92
Popular Tags