Created
February 6, 2014 17:19
-
-
Save mjpitz/8848611 to your computer and use it in GitHub Desktop.
Fully stubbed out REST controller for Spring MVC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.controllers; | |
import com.example.models.Resource; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.web.bind.annotation.PathVariable; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RequestMethod; | |
import org.springframework.web.bind.annotation.RequestParam; | |
import org.springframework.web.bind.annotation.RestController; | |
import java.util.List; | |
/** | |
* @author [email protected] | |
*/ | |
@RestController | |
@RequestMapping(value="/resource") | |
public class ResourceController { | |
/** | |
* @return | |
*/ | |
@RequestMapping(method= RequestMethod.GET) | |
public List<Resource> index() { | |
throw new UnsupportedOperationException(); | |
} | |
/** | |
* @return | |
*/ | |
@RequestMapping(value="/create", method=RequestMethod.GET) | |
public Resource create() { | |
throw new UnsupportedOperationException(); | |
} | |
/** | |
* @return | |
*/ | |
@RequestMapping(method=RequestMethod.POST) | |
public Resource store() { | |
throw new UnsupportedOperationException(); | |
} | |
/** | |
* | |
* @param id The id for the resource | |
* @return | |
*/ | |
@RequestMapping(value="/{id}", method=RequestMethod.GET) | |
public Resource show(@PathVariable final String id) { | |
throw new UnsupportedOperationException(); | |
} | |
/** | |
* | |
* @param id The id for the resource | |
* @return | |
*/ | |
@RequestMapping(value="/{id}/edit", method=RequestMethod.GET) | |
public Resource edit(@PathVariable final String id) { | |
throw new UnsupportedOperationException(); | |
} | |
/** | |
* | |
* @param id The id for the resource | |
* @return | |
*/ | |
@RequestMapping(value="/{id}", method={RequestMethod.PUT, RequestMethod.PATCH}) | |
public Resource update(@PathVariable final String id) { | |
throw new UnsupportedOperationException(); | |
} | |
/** | |
* Delete a request from the database | |
* | |
* @param id The id for the resource | |
* @return The request that was deleted from the database | |
*/ | |
@RequestMapping(value="/{id}", method=RequestMethod.DELETE) | |
public Resource delete(@PathVariable final String id) { | |
throw new UnsupportedOperationException(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment