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.servlet.mvc.multiaction;
18:
19: import javax.servlet.ServletException;
20: import javax.servlet.http.HttpServletRequest;
21:
22: /**
23: * Exception thrown when there's no request handling method for a request.
24: *
25: * @author Rod Johnson
26: * @author Juergen Hoeller
27: */
28: public class NoSuchRequestHandlingMethodException extends
29: ServletException {
30:
31: private String methodName;
32:
33: /**
34: * Create a new NoSuchRequestHandlingMethodException for the given request.
35: * @param request the offending HTTP request
36: */
37: public NoSuchRequestHandlingMethodException(
38: HttpServletRequest request) {
39: super ("No handling method can be found for request [" + request
40: + "]");
41: }
42:
43: /**
44: * Create a new NoSuchRequestHandlingMethodException for the given request.
45: * @param methodName the name of the handler method that wasn't found
46: * @param controllerClass the class the handler method was expected to be in
47: */
48: public NoSuchRequestHandlingMethodException(String methodName,
49: Class controllerClass) {
50: super ("No request handling method with name '" + methodName
51: + "' in class [" + controllerClass.getName() + "]");
52: this .methodName = methodName;
53: }
54:
55: /**
56: * Return the name of the offending method, if known.
57: */
58: public String getMethodName() {
59: return methodName;
60: }
61:
62: }
|