KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_web > deployment > xml > ServletMapping


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or 1any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * Initial developer: Florent BENOIT
22  * --------------------------------------------------------------------------
23  * $Id: ServletMapping.java,v 1.2 2004/05/25 14:26:34 sauthieg Exp $
24  * --------------------------------------------------------------------------
25  */

26
27 package org.objectweb.jonas_web.deployment.xml;
28
29 import org.objectweb.jonas_lib.deployment.xml.AbsElement;
30
31 /**
32  * This class defines the implementation of the element servlet-mapping
33  * @author Florent Benoit
34  */

35 public class ServletMapping extends AbsElement {
36
37     /**
38      * Name of the servlet
39      */

40     private String JavaDoc servletName = null;
41
42     /**
43      * URL pattern of the servlet
44      */

45     private String JavaDoc urlPattern = null;
46
47
48     // Setters
49

50
51     /**
52      * Sets the name of the servlet
53      * @param servletName name of the servlet
54      */

55     public void setServletName(String JavaDoc servletName) {
56         this.servletName = servletName;
57     }
58
59
60     /**
61      * Sets the url-pattern of the servlet
62      * @param urlPattern url-pattern of the servlet
63      */

64     public void setUrlPattern(String JavaDoc urlPattern) {
65         this.urlPattern = urlPattern;
66     }
67
68
69
70     // Getters
71

72     /**
73      * @return the name of the servlet of the servlet-mapping
74      */

75     public String JavaDoc getServletName() {
76         return servletName;
77     }
78
79     /**
80      * @return the url of the servlet of the servlet-mapping
81      */

82     public String JavaDoc getUrlPattern() {
83         return urlPattern;
84     }
85
86
87     /**
88      * Represents this element by it's XML description.
89      * @param indent use this indent for prexifing XML representation.
90      * @return the XML description of this object.
91      */

92     public String JavaDoc toXML(int indent) {
93         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
94         sb.append(indent(indent));
95         sb.append("<servlet-mapping>\n");
96
97         indent += 2;
98
99         // servlet-name
100
sb.append(xmlElement(servletName, "servlet-name", indent));
101
102         // url-pattern
103
sb.append(xmlElement(urlPattern, "url-pattern", indent));
104
105
106         indent -= 2;
107         sb.append(indent(indent));
108         sb.append("</servlet-mapping>\n");
109
110         return sb.toString();
111     }
112
113 }
114
Popular Tags