| 1 |
/** |
|---|
| 2 |
* The contents of this file are subject to the OpenMRS Public License |
|---|
| 3 |
* Version 1.0 (the "License"); you may not use this file except in |
|---|
| 4 |
* compliance with the License. You may obtain a copy of the License at |
|---|
| 5 |
* http://license.openmrs.org |
|---|
| 6 |
* |
|---|
| 7 |
* Software distributed under the License is distributed on an "AS IS" |
|---|
| 8 |
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|---|
| 9 |
* License for the specific language governing rights and limitations |
|---|
| 10 |
* under the License. |
|---|
| 11 |
* |
|---|
| 12 |
* Copyright (C) OpenMRS, LLC. All Rights Reserved. |
|---|
| 13 |
*/ |
|---|
| 14 |
package org.openmrs.web.controller; |
|---|
| 15 |
|
|---|
| 16 |
import java.io.IOException; |
|---|
| 17 |
|
|---|
| 18 |
import javax.servlet.ServletException; |
|---|
| 19 |
import javax.servlet.http.HttpServletRequest; |
|---|
| 20 |
import javax.servlet.http.HttpServletResponse; |
|---|
| 21 |
|
|---|
| 22 |
import org.springframework.web.servlet.ModelAndView; |
|---|
| 23 |
import org.springframework.web.servlet.mvc.Controller; |
|---|
| 24 |
|
|---|
| 25 |
public class SpringController implements Controller { |
|---|
| 26 |
|
|---|
| 27 |
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) |
|---|
| 28 |
throws ServletException, IOException { |
|---|
| 29 |
|
|---|
| 30 |
String path = request.getServletPath(); |
|---|
| 31 |
if (path.endsWith("htm")) |
|---|
| 32 |
path = path.replace(".htm", ""); |
|---|
| 33 |
else if (path.endsWith("jsp")) |
|---|
| 34 |
path = path.replace(".jsp", ""); |
|---|
| 35 |
//int qmark = path.indexOf("?"); |
|---|
| 36 |
return new ModelAndView(path); |
|---|
| 37 |
|
|---|
| 38 |
} |
|---|
| 39 |
} |
|---|