Spring MVC ShowCase 学习Spring MVC

@GetMapping(path="/simple/revisited", headers="Accept=text/plain")

Content-Type: used to define the user's browser how to display the data or the associated equipment to be loaded, or how data to be loaded.
text / html means that the content-type settings file in the form of text / html, the browser will automatically call html parser in obtaining this file to the file accordingly.
text / plain mean the file as plain text form, the browser in getting to this file does not process it.

 

@GetMapping(path="/mapping/parameter", params="foo")
params: restriction request parameters can 
param1: indicates a request must contain the request parameter named param1 
param1:! request indicates a request can not include the parameter called param1 
param1 = value1:! indicates a request containing request parameter named param1, but its value can not be is value1 
{ "param1 = value1", "param2"}: request must include two named param1 and param2 request parameter, and the value of the parameter must be param1 value1

@RequestBody annotation corresponding class in the input stream HTTP (including the request body) is fitted into the target class (i.e.: @RequestBody behind
class), the entity class will be the corresponding attribute match according json string key, if a match json consistent and the key corresponding to the value
when match (or be converted to) the corresponding attribute type requires entity class, the entity class will invoke the setter method to assign values to the attribute.

 

Guess you like

Origin www.cnblogs.com/kadrn/p/11599255.html