org.springframework.samples.petclinic.web
Class ClinicController

java.lang.Object
  extended by org.springframework.samples.petclinic.web.ClinicController

@Controller
public class ClinicController
extends java.lang.Object

Annotation-driven MultiActionController that handles all non-form URL's.

Author:
Juergen Hoeller, Mark Fisher, Ken Krebs, Arjen Poutsma

Constructor Summary
ClinicController(Clinic clinic)
           
 
Method Summary
 org.springframework.web.servlet.ModelAndView ownerHandler(int ownerId)
          Displays the specified owner.
 org.springframework.ui.ModelMap vetsHandler()
          Displays all vets.
 org.springframework.web.servlet.ModelAndView visitsHandler(int petId)
          Displays a list of all visits for a specified pet.
 java.lang.String welcomeHandler()
          Displays the the welcome view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClinicController

public ClinicController(Clinic clinic)
Method Detail

welcomeHandler

@RequestMapping(value="/")
public java.lang.String welcomeHandler()
Displays the the welcome view.

Note that this handler relies on the RequestToViewNameTranslator to determine the logical view name based on the request URL: "/welcome.do" -> "welcome".


vetsHandler

@RequestMapping(value="/vets")
public org.springframework.ui.ModelMap vetsHandler()
Displays all vets.

Note that this handler returns a plain ModelMap object instead of a ModelAndView, thus leveraging convention-based model attribute names. It relies on the RequestToViewNameTranslator to determine the logical view name based on the request URL: "/vets.do" -> "vets".

Returns:
a ModelMap with the model attributes for the view

ownerHandler

@RequestMapping(value="/owners/{ownerId}")
public org.springframework.web.servlet.ModelAndView ownerHandler(@PathVariable(value="ownerId")
                                                                                int ownerId)
Displays the specified owner.

Parameters:
ownerId - the ID of the owner to display
Returns:
a ModelMap with the model attributes for the view

visitsHandler

@RequestMapping(value="/owners/*/pets/{petId}/visits",
                method=GET)
public org.springframework.web.servlet.ModelAndView visitsHandler(@PathVariable
                                                                                 int petId)
Displays a list of all visits for a specified pet.

Parameters:
petId - the ID of the pet whose visits to display
Returns:
a ModelMap with the model attributes for the view


Copyright © 2010. All Rights Reserved.