1. /*
  2. * Copyright 2002-2004 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. package org.springframework.web.servlet.mvc.multiaction;
  17. import javax.servlet.http.HttpServletRequest;
  18. /**
  19. * Interface that parameterizes the MultiActionController class
  20. * using the <b>Strategy</b> GoF Design pattern, allowing
  21. * the mapping from incoming request to handler method name
  22. * to be varied without affecting other application code.
  23. *
  24. * <p>Illustrates how delegation can be more flexible than subclassing.
  25. *
  26. * @author Rod Johnson
  27. * @see MultiActionController#setMethodNameResolver
  28. */
  29. public interface MethodNameResolver {
  30. /**
  31. * Return a method name that can handle this request. Such
  32. * mappings are typically, but not necessarily, based on URL.
  33. * @param request current HTTP request
  34. * @return a method name that can handle this request.
  35. * Never returns null; throws exception if not resolvable.
  36. * @throws NoSuchRequestHandlingMethodException if no method
  37. * can be found for this URL
  38. */
  39. String getHandlerMethodName(HttpServletRequest request) throws NoSuchRequestHandlingMethodException;
  40. }