01: /*
02: * Copyright 2002-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.web;
18:
19: import javax.servlet.ServletException;
20:
21: /**
22: * Exception thrown when a request handler does not support a
23: * specific request method.
24: *
25: * @author Juergen Hoeller
26: * @since 2.0
27: */
28: public class HttpRequestMethodNotSupportedException extends
29: ServletException {
30:
31: private String method;
32:
33: /**
34: * Create a new HttpRequestMethodNotSupportedException.
35: * @param method the unsupported HTTP request method
36: */
37: public HttpRequestMethodNotSupportedException(String method) {
38: this (method, "Request method '" + method + "' not supported");
39: }
40:
41: /**
42: * Create a new HttpRequestMethodNotSupportedException.
43: * @param method the unsupported HTTP request method
44: * @param msg the detail message
45: */
46: public HttpRequestMethodNotSupportedException(String method,
47: String msg) {
48: super (msg);
49: this .method = method;
50: }
51:
52: /**
53: * Return the HTTP request method that caused the failure.
54: */
55: public String getMethod() {
56: return method;
57: }
58:
59: }
|