1 //
2 // ========================================================================
3 // Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
4 // ------------------------------------------------------------------------
5 // All rights reserved. This program and the accompanying materials
6 // are made available under the terms of the Eclipse Public License v1.0
7 // and Apache License v2.0 which accompanies this distribution.
8 //
9 // The Eclipse Public License is available at
10 // http://www.eclipse.org/legal/epl-v10.html
11 //
12 // The Apache License v2.0 is available at
13 // http://www.opensource.org/licenses/apache2.0.php
14 //
15 // You may elect to redistribute this code under either of these licenses.
16 // ========================================================================
17 //
18
19 package org.eclipse.jetty.servlet;
20
21 import java.io.IOException;
22 import java.util.Arrays;
23
24
25 public class ServletMapping
26 {
27 private String[] _pathSpecs;
28 private String _servletName;
29
30 /* ------------------------------------------------------------ */
31 public ServletMapping()
32 {
33 }
34
35 /* ------------------------------------------------------------ */
36 /**
37 * @return Returns the pathSpecs.
38 */
39 public String[] getPathSpecs()
40 {
41 return _pathSpecs;
42 }
43
44 /* ------------------------------------------------------------ */
45 /**
46 * @return Returns the servletName.
47 */
48 public String getServletName()
49 {
50 return _servletName;
51 }
52
53 /* ------------------------------------------------------------ */
54 /**
55 * @param pathSpecs The pathSpecs to set.
56 */
57 public void setPathSpecs(String[] pathSpecs)
58 {
59 _pathSpecs = pathSpecs;
60 }
61
62 /* ------------------------------------------------------------ */
63 /**
64 * @param pathSpec The pathSpec to set.
65 */
66 public void setPathSpec(String pathSpec)
67 {
68 _pathSpecs = new String[]{pathSpec};
69 }
70
71 /* ------------------------------------------------------------ */
72 /**
73 * @param servletName The servletName to set.
74 */
75 public void setServletName(String servletName)
76 {
77 _servletName = servletName;
78 }
79
80
81 /* ------------------------------------------------------------ */
82 public String toString()
83 {
84 return (_pathSpecs==null?"[]":Arrays.asList(_pathSpecs).toString())+"=>"+_servletName;
85 }
86
87 /* ------------------------------------------------------------ */
88 public void dump(Appendable out, String indent) throws IOException
89 {
90 out.append(String.valueOf(this)).append("\n");
91 }
92 }