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