Notes name should have atleast 2 characte private

Info icon This preview shows pages 314–329. Sign up to view the full content.

(notes= "Name should have atleast 2 characte private String name; @Past @ApiModelProperty (notes= "Birth date should be in the past" ) private Date birthDate;
Image of page 314

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

@PostMapping ( "/users" ) public ResponseEntity<Object> createUser (@Valid @RequestBody User user) {
Image of page 315
@Override protected ResponseEntity<Object> handleMethodArgumentNotValid ( MethodArgumentNotValidException ex, HttpHeaders headers, HttpStatus status, WebRequest req ExceptionResponse exceptionResponse = new ExceptionResponse( new Date(), "Validation Failed" ,ex.getBindingResult(). return new ResponseEntity(exceptionResponse, HttpStatus.BAD_ }
Image of page 316

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Questions Why do we need Versioning for RESTful Web Services? What are the versioning options that are available? How do you implement Versioning for RESTful Web Services?
Image of page 317
public class PersonV1 { private String name; public class PersonV2 { private Name name; public class Name { private String firstName; private String lastName;
Image of page 318

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Versioning Options URI Versioning Request Param Versioning
Image of page 319
Versioning Options Header Versioning headers=[X-API-VERSION=1] headers=[X-API-VERSION=2]
Image of page 320

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Versioning Options MIME Time or Accept Header Versioning produces=[application/vnd.company.app- v1+json] produces=[application/vnd.company.app- v2+json]
Image of page 321
@GetMapping ( "v1/person" ) public PersonV1 personV1 () { return new PersonV1( "Bob Charlie" ); } @GetMapping ( "v2/person" ) public PersonV2 personV2 () { return new PersonV2( new Name( "Bob" , "Charlie" )); }
Image of page 322

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

@GetMapping (value = "/person/param" , params = "version=1" ) public PersonV1 paramV1 () { return new PersonV1( "Bob Charlie" ); } @GetMapping (value = "/person/param" , params = "version=2" ) public PersonV2 paramV2 () { return new PersonV2( new Name( "Bob" , "Charlie" )); }
Image of page 323
@GetMapping (value = "/person/header" , headers = "X-API-VERSION=1" ) public PersonV1 headerV1 () { return new PersonV1( "Bob Charlie" ); } @GetMapping (value = "/person/header" , headers = "X-API-VERSION=2" ) public PersonV2 headerV2 () { return new PersonV2( new Name( "Bob" , "Charlie" )); }
Image of page 324

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

@GetMapping (value = "/person/produces" , produces = "application/vnd.company.app-v1+json" ) public PersonV1 producesV1 () { return new PersonV1( "Bob Charlie" ); } @GetMapping (value = "/person/produces" , produces = "application/vnd.company.app-v2+json" ) public PersonV2 producesV2 () { return new PersonV2( new Name( "Bob" , "Charlie" )); }
Image of page 325
Versioning Media type versioning (a.k.a “content negotiation” or “accept header”) GitHub (Custom) headers versioning Microso± URI Versioning Twitter Request Parameter versioning Amazon
Image of page 326

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Versioning Factors URI Pollution Misuse of HTTP Headers Caching Can we execute the request on the browser? API Documentation No Perfect Solution
Image of page 327
Questions Which is the client you use to test RESTful Web Services?
Image of page 328

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 329
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '18
  • LN Rao
  • public class, Spring Framework, Spring Boot, Spring Security

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern