From: Juergen H. <jho...@us...> - 2006-04-21 00:13:54
|
Update of /cvsroot/springframework/spring/src/org/springframework/web/servlet/mvc/multiaction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/web/servlet/mvc/multiaction Modified Files: Tag: mbranch-1-2 MultiActionController.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: MultiActionController.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/web/servlet/mvc/multiaction/MultiActionController.java,v retrieving revision 1.24.2.1 retrieving revision 1.24.2.2 diff -C2 -d -r1.24.2.1 -r1.24.2.2 *** MultiActionController.java 23 Dec 2005 13:52:04 -0000 1.24.2.1 --- MultiActionController.java 21 Apr 2006 00:13:50 -0000 1.24.2.2 *************** *** 1,11 **** /* ! * Copyright 2002-2005 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 1,11 ---- /* ! * Copyright 2002-2006 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 289,293 **** * @see org.springframework.web.servlet.mvc.LastModified#getLastModified(HttpServletRequest) */ ! public final long getLastModified(HttpServletRequest request) { try { String handlerMethodName = this.methodNameResolver.getHandlerMethodName(request); --- 289,293 ---- * @see org.springframework.web.servlet.mvc.LastModified#getLastModified(HttpServletRequest) */ ! public long getLastModified(HttpServletRequest request) { try { String handlerMethodName = this.methodNameResolver.getHandlerMethodName(request); *************** *** 302,306 **** // We encountered an error invoking the last-modified method. // We can't do anything useful except log this, as we can't throw an exception. ! logger.error("Failed to invoke lastModified method", ex); } } // if we had a lastModified method for this request --- 302,306 ---- // We encountered an error invoking the last-modified method. // We can't do anything useful except log this, as we can't throw an exception. ! logger.error("Failed to invoke last-modified method", ex); } } // if we had a lastModified method for this request *************** *** 311,315 **** // has generated content. Do nothing, that's OK: We'll return default. } - // the default if we didn't find a method return -1L; } --- 311,314 ---- *************** *** 317,323 **** //--------------------------------------------------------------------- ! // Implementation of Controller //--------------------------------------------------------------------- protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { --- 316,328 ---- //--------------------------------------------------------------------- ! // Implementation of AbstractController //--------------------------------------------------------------------- + /** + * Determine a handler method and invoke it. + * @see MethodNameResolver#getHandlerMethodName + * @see #invokeNamedMethod + * @see #handleNoSuchRequestHandlingMethod + */ protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { *************** *** 327,336 **** } catch (NoSuchRequestHandlingMethodException ex) { ! pageNotFoundLogger.warn(ex.getMessage()); ! response.sendError(HttpServletResponse.SC_NOT_FOUND); ! return null; } } ! /** * Invokes the named method. --- 332,359 ---- } catch (NoSuchRequestHandlingMethodException ex) { ! return handleNoSuchRequestHandlingMethod(ex, request, response); } } ! ! /** ! * Handle the case where no request handler method was found. ! * <p>The default implementation logs a warning and sends an HTTP 404 error. ! * Alternatively, a fallback view could be chosen, or the ! * NoSuchRequestHandlingMethodException could be rethrown as-is. ! * @param ex the NoSuchRequestHandlingMethodException to be handled ! * @param request current HTTP request ! * @param response current HTTP response ! * @return a ModelAndView to render, or <code>null</code> if handled directly ! * @throws Exception an Exception that should be thrown as result of the servlet request ! */ ! protected ModelAndView handleNoSuchRequestHandlingMethod( ! NoSuchRequestHandlingMethodException ex, HttpServletRequest request, HttpServletResponse response) ! throws Exception { ! ! pageNotFoundLogger.warn(ex.getMessage()); ! response.sendError(HttpServletResponse.SC_NOT_FOUND); ! return null; ! } ! /** * Invokes the named method. |