1 // 2 // ======================================================================== 3 // Copyright (c) 1995-2012 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 private boolean _default; 30 31 32 /* ------------------------------------------------------------ */ 33 public ServletMapping() 34 { 35 } 36 37 /* ------------------------------------------------------------ */ 38 /** 39 * @return Returns the pathSpecs. 40 */ 41 public String[] getPathSpecs() 42 { 43 return _pathSpecs; 44 } 45 46 /* ------------------------------------------------------------ */ 47 /** 48 * @return Returns the servletName. 49 */ 50 public String getServletName() 51 { 52 return _servletName; 53 } 54 55 /* ------------------------------------------------------------ */ 56 /** 57 * @param pathSpecs The pathSpecs to set. 58 */ 59 public void setPathSpecs(String[] pathSpecs) 60 { 61 _pathSpecs = pathSpecs; 62 } 63 64 /* ------------------------------------------------------------ */ 65 /** 66 * @param pathSpec The pathSpec to set. 67 */ 68 public void setPathSpec(String pathSpec) 69 { 70 _pathSpecs = new String[]{pathSpec}; 71 } 72 73 /* ------------------------------------------------------------ */ 74 /** 75 * @param servletName The servletName to set. 76 */ 77 public void setServletName(String servletName) 78 { 79 _servletName = servletName; 80 } 81 82 83 /* ------------------------------------------------------------ */ 84 /** 85 * @return 86 */ 87 public boolean isDefault() 88 { 89 return _default; 90 } 91 92 93 /* ------------------------------------------------------------ */ 94 /** 95 * @param default1 96 */ 97 public void setDefault(boolean fromDefault) 98 { 99 _default = fromDefault; 100 } 101 102 /* ------------------------------------------------------------ */ 103 public String toString() 104 { 105 return (_pathSpecs==null?"[]":Arrays.asList(_pathSpecs).toString())+"=>"+_servletName; 106 } 107 108 /* ------------------------------------------------------------ */ 109 public void dump(Appendable out, String indent) throws IOException 110 { 111 out.append(String.valueOf(this)).append("\n"); 112 } 113 }