| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
package net.sf.mindoro.web; |
| 7 |
|
|
| 8 |
|
import java.util.Date; |
| 9 |
|
import java.util.Hashtable; |
| 10 |
|
import java.util.Map; |
| 11 |
|
|
| 12 |
|
import javax.servlet.http.HttpServletRequest; |
| 13 |
|
import javax.servlet.http.HttpServletResponse; |
| 14 |
|
|
| 15 |
|
import org.apache.commons.lang.builder.ToStringBuilder; |
| 16 |
|
import org.apache.commons.logging.Log; |
| 17 |
|
import org.apache.commons.logging.LogFactory; |
| 18 |
|
import org.springframework.web.servlet.ModelAndView; |
| 19 |
|
import org.springframework.web.servlet.mvc.AbstractController; |
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
0 |
public final class DefaultController extends AbstractController { |
| 27 |
|
|
| 28 |
0 |
private static final Log log = LogFactory.getLog(DefaultController.class); |
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
|
protected ModelAndView handleRequestInternal(final HttpServletRequest request, |
| 38 |
|
final HttpServletResponse response) throws Exception { |
| 39 |
0 |
log.debug(this.getClass().getName() + ".handleRequestInternal() called..."); |
| 40 |
0 |
log.debug(new ToStringBuilder(request).append("cookies", request.getCookies()).append("method", |
| 41 |
|
request.getMethod()).toString()); |
| 42 |
0 |
final Map map = new Hashtable(); |
| 43 |
0 |
map.put("now", new Date()); |
| 44 |
|
final String modelName; |
| 45 |
0 |
if ("/users.html".equals(request.getServletPath())) { |
| 46 |
0 |
final String[] users = new String[] { "system", "aisrael" }; |
| 47 |
0 |
map.put("users", users); |
| 48 |
0 |
modelName = "users"; |
| 49 |
|
} else { |
| 50 |
0 |
final Map properties = WebUtil.getRequestProperties(request); |
| 51 |
0 |
map.put("properties", properties); |
| 52 |
0 |
modelName = "welcome"; |
| 53 |
|
} |
| 54 |
0 |
return new ModelAndView(modelName, map); |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
} |