View Javadoc
1   /*
2    * Copyright 2002-2008 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
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.annotation;
18  
19  import java.io.IOException;
20  import javax.servlet.http.HttpServletResponse;
21  
22  import org.springframework.stereotype.Controller;
23  import org.springframework.web.bind.annotation.RequestMapping;
24  import org.springframework.web.bind.annotation.RequestMethod;
25  
26  /**
27   * @author Juergen Hoeller
28   */
29  @Controller
30  @RequestMapping("/*.do")
31  public class MethodNameDispatchingController {
32  
33  	@RequestMapping
34  	public void myHandle(HttpServletResponse response) throws IOException {
35  		response.getWriter().write("myView");
36  	}
37  
38  	@RequestMapping
39  	public void myOtherHandle(HttpServletResponse response) throws IOException {
40  		response.getWriter().write("myOtherView");
41  	}
42  
43  	@RequestMapping(method = RequestMethod.POST)
44  	public void myLangHandle(HttpServletResponse response) throws IOException {
45  		response.getWriter().write("myLangView");
46  	}
47  
48  	@RequestMapping(method = RequestMethod.POST)
49  	public void mySurpriseHandle(HttpServletResponse response) throws IOException {
50  		response.getWriter().write("mySurpriseView");
51  	}
52  
53  }