Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ServletMapping |
|
| 1.2857142857142858;1.286 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one | |
3 | * or more contributor license agreements. See the NOTICE file | |
4 | * distributed with this work for additional information | |
5 | * regarding copyright ownership. The ASF licenses this file | |
6 | * to you under the Apache License, Version 2.0 (the | |
7 | * "License"); you may not use this file except in compliance | |
8 | * with the License. You may obtain a copy of the License at | |
9 | * | |
10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
11 | * | |
12 | * Unless required by applicable law or agreed to in writing, | |
13 | * software distributed under the License is distributed on an | |
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
15 | * KIND, either express or implied. See the License for the | |
16 | * specific language governing permissions and limitations | |
17 | * under the License. | |
18 | */ | |
19 | package org.apache.myfaces.shared_impl.webapp.webxml; | |
20 | ||
21 | /** | |
22 | * @author Manfred Geiler (latest modification by $Author: matzew $) | |
23 | * @version $Revision: 557350 $ $Date: 2007-07-18 13:19:50 -0500 (Wed, 18 Jul 2007) $ | |
24 | */ | |
25 | public class ServletMapping | |
26 | { | |
27 | private final String _servletName; | |
28 | private final Class _servletClass; | |
29 | private final String _urlPattern; | |
30 | private final String _extension; | |
31 | private final String _prefix; | |
32 | ||
33 | public ServletMapping(String servletName, Class servletClass, String urlPattern) | |
34 | 0 | { |
35 | 0 | _servletName = servletName; |
36 | 0 | _servletClass = servletClass; |
37 | 0 | _urlPattern = urlPattern; |
38 | 0 | _extension = _urlPattern != null && _urlPattern.startsWith("*.") ? _urlPattern.substring(_urlPattern |
39 | .indexOf('.')) : null; | |
40 | 0 | if (_extension == null) |
41 | { | |
42 | 0 | int index = _urlPattern.indexOf("/*"); |
43 | 0 | if (index != -1) |
44 | { | |
45 | 0 | _prefix = _urlPattern.substring(0, _urlPattern.indexOf("/*")); |
46 | } | |
47 | else | |
48 | { | |
49 | 0 | _prefix = _urlPattern; |
50 | } | |
51 | 0 | } |
52 | else | |
53 | { | |
54 | 0 | _prefix = null; |
55 | } | |
56 | 0 | } |
57 | ||
58 | public boolean isExtensionMapping() | |
59 | { | |
60 | 0 | return _extension != null; |
61 | } | |
62 | ||
63 | public String getExtension() | |
64 | { | |
65 | 0 | return _extension; |
66 | } | |
67 | ||
68 | public String getPrefix() | |
69 | { | |
70 | 0 | return _prefix; |
71 | } | |
72 | ||
73 | public String getServletName() | |
74 | { | |
75 | 0 | return _servletName; |
76 | } | |
77 | ||
78 | public Class getServletClass() | |
79 | { | |
80 | 0 | return _servletClass; |
81 | } | |
82 | ||
83 | public String getUrlPattern() | |
84 | { | |
85 | 0 | return _urlPattern; |
86 | } | |
87 | } |