Our Best Selling Spring Boot Courses
More Courses and Videos From in28Minutes
<project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
<modelVersion >4.0.0</modelVersion >
<groupId >com.in28minutes.springboot</groupId >
<artifactId >spring-boot-rest-services-all-examples-for-springboottutorial.com</artifactId >
<version >0.0.1-SNAPSHOT</version >
<properties >
<java .version>1.8</java .version>
</properties >
<parent >
<groupId >org.springframework.boot</groupId >
<artifactId >spring-boot-starter-parent</artifactId >
<version >2.0.0.RELEASE</version >
</parent >
<dependencies >
<dependency >
<groupId >org.springframework.boot</groupId >
<artifactId >spring-boot-starter-web</artifactId >
</dependency >
<dependency >
<groupId >org.springframework.boot</groupId >
<artifactId >spring-boot-starter-security</artifactId >
</dependency >
<dependency >
<groupId >org.springframework.boot</groupId >
<artifactId >spring-boot-starter-data-jpa</artifactId >
</dependency >
<dependency >
<groupId >org.springframework.boot</groupId >
<artifactId >spring-boot-starter-data-rest</artifactId >
</dependency >
<dependency >
<groupId >com.h2database</groupId >
<artifactId >h2</artifactId >
</dependency >
<dependency >
<groupId >com.fasterxml.jackson.dataformat</groupId >
<artifactId >jackson-dataformat-xml</artifactId >
</dependency >
<dependency >
<groupId >org.springframework.boot</groupId >
<artifactId >spring-boot-devtools</artifactId >
<optional >true</optional >
</dependency >
<dependency >
<groupId >org.springframework.boot</groupId >
<artifactId >spring-boot-starter-actuator</artifactId >
</dependency >
<dependency >
<groupId >org.springframework.data</groupId >
<artifactId >spring-data-rest-hal-browser</artifactId >
</dependency >
<dependency >
<groupId >org.springframework.boot</groupId >
<artifactId >spring-boot-starter-test</artifactId >
<scope >test</scope >
</dependency >
</dependencies >
<build >
<plugins >
<plugin >
<groupId >org.springframework.boot</groupId >
<artifactId >spring-boot-maven-plugin</artifactId >
</plugin >
</plugins >
</build >
<repositories >
<repository >
<id >spring-snapshots</id >
<name >Spring Snapshots</name >
<url >https://repo.spring.io/snapshot</url >
<snapshots >
<enabled >true</enabled >
</snapshots >
</repository >
<repository >
<id >spring-milestones</id >
<name >Spring Milestones</name >
<url >https://repo.spring.io/milestone</url >
<snapshots >
<enabled >false</enabled >
</snapshots >
</repository >
</repositories >
<pluginRepositories >
<pluginRepository >
<id >spring-snapshots</id >
<name >Spring Snapshots</name >
<url >https://repo.spring.io/snapshot</url >
<snapshots >
<enabled >true</enabled >
</snapshots >
</pluginRepository >
<pluginRepository >
<id >spring-milestones</id >
<name >Spring Milestones</name >
<url >https://repo.spring.io/milestone</url >
<snapshots >
<enabled >false</enabled >
</snapshots >
</pluginRepository >
</pluginRepositories >
</project >
/src/main/java/com/in28minutes/springboot/configuration/BasicConfiguration.java
package com .in28minutes .springboot .configuration ;
import org .springframework .boot .context .properties .ConfigurationProperties ;
import org .springframework .stereotype .Component ;
@ Component
@ ConfigurationProperties ("basic" )
public class BasicConfiguration {
private boolean value ;
private String message ;
private int number ;
public boolean isValue () {
return value ;
}
public void setValue (boolean value ) {
this .value = value ;
}
public String getMessage () {
return message ;
}
public void setMessage (String message ) {
this .message = message ;
}
public int getNumber () {
return number ;
}
public void setNumber (int number ) {
this .number = number ;
}
}
/src/main/java/com/in28minutes/springboot/configuration/DevelopmentOnlyConfiguration.java
package com .in28minutes .springboot .configuration ;
import org .springframework .context .annotation .Bean ;
import org .springframework .context .annotation .Profile ;
@ Profile ("dev" )
public class DevelopmentOnlyConfiguration {
@ Bean
public String dummy () {
return "something" ;
}
}
/src/main/java/com/in28minutes/springboot/configuration/ProductionOnlyConfiguration.java
package com .in28minutes .springboot .configuration ;
import org .springframework .context .annotation .Bean ;
import org .springframework .context .annotation .Profile ;
@ Profile ("prod" )
public class ProductionOnlyConfiguration {
@ Bean
public String dummy () {
return "something" ;
}
}
/src/main/java/com/in28minutes/springboot/controller/StudentController.java
package com .in28minutes .springboot .controller ;
import java .net .URI ;
import java .util .List ;
import org .springframework .beans .factory .annotation .Autowired ;
import org .springframework .http .ResponseEntity ;
import org .springframework .web .bind .annotation .GetMapping ;
import org .springframework .web .bind .annotation .PathVariable ;
import org .springframework .web .bind .annotation .PostMapping ;
import org .springframework .web .bind .annotation .RequestBody ;
import org .springframework .web .bind .annotation .RestController ;
import org .springframework .web .servlet .support .ServletUriComponentsBuilder ;
import com .in28minutes .springboot .model .Course ;
import com .in28minutes .springboot .service .StudentService ;
@ RestController
public class StudentController {
@ Autowired
private StudentService studentService ;
@ GetMapping ("/students/{studentId}/courses" )
public List <Course > retrieveCoursesForStudent (@ PathVariable String studentId ) {
return studentService .retrieveCourses (studentId );
}
@ PostMapping ("/students/{studentId}/courses" )
public ResponseEntity <Void > registerStudentForCourse (
@ PathVariable String studentId , @ RequestBody Course newCourse ) {
Course course = studentService .addCourse (studentId , newCourse );
if (course == null )
return ResponseEntity .noContent ().build ();
URI location = ServletUriComponentsBuilder .fromCurrentRequest ().path (
"/{id}" ).buildAndExpand (course .getId ()).toUri ();
return ResponseEntity .created (location ).build ();
}
@ GetMapping ("/students/{studentId}/courses/{courseId}" )
public Course retrieveDetailsForCourse (@ PathVariable String studentId ,
@ PathVariable String courseId ) {
return studentService .retrieveCourse (studentId , courseId );
}
}
/src/main/java/com/in28minutes/springboot/jpa/User.java
package com .in28minutes .springboot .jpa ;
import javax .persistence .Entity ;
import javax .persistence .GeneratedValue ;
import javax .persistence .GenerationType ;
import javax .persistence .Id ;
@ Entity
public class User {
@ Id
@ GeneratedValue (strategy = GenerationType .AUTO )
private Long id ;
private String name ;
private String role ;
protected User () {
}
public User (String name , String role ) {
super ();
this .name = name ;
this .role = role ;
}
public Long getId () {
return id ;
}
public String getName () {
return name ;
}
public String getRole () {
return role ;
}
@ Override
public String toString () {
return "User [id=" + id + ", name=" + name + ", role=" + role + "]" ;
}
}
/src/main/java/com/in28minutes/springboot/jpa/UserCommandLineRunner.java
package com .in28minutes .springboot .jpa ;
import org .slf4j .Logger ;
import org .slf4j .LoggerFactory ;
import org .springframework .beans .factory .annotation .Autowired ;
import org .springframework .boot .CommandLineRunner ;
import org .springframework .stereotype .Component ;
@ Component
public class UserCommandLineRunner implements CommandLineRunner {
private static final Logger log = LoggerFactory
.getLogger (UserCommandLineRunner .class );
@ Autowired
private UserRepository repository ;
@ Override
public void run (String ... args ) throws Exception {
repository .save (new User ("Ranga" , "Admin" ));
repository .save (new User ("Ravi" , "User" ));
repository .save (new User ("Satish" , "Admin" ));
repository .save (new User ("Raghu" , "User" ));
for (User user : repository .findAll ()) {
log .info (user .toString ());
}
log .info ("Admin users are....." );
log .info ("____________________" );
for (User user : repository .findByRole ("Admin" )) {
log .info (user .toString ());
}
}
}
/src/main/java/com/in28minutes/springboot/jpa/UserRepository.java
package com .in28minutes .springboot .jpa ;
import java .util .List ;
import org .springframework .data .repository .CrudRepository ;
public interface UserRepository extends CrudRepository <User , Long > {
List <User > findByRole (String role );
}
/src/main/java/com/in28minutes/springboot/jpa/UserRestRepository.java
package com .in28minutes .springboot .jpa ;
import java .util .List ;
import org .springframework .data .repository .PagingAndSortingRepository ;
import org .springframework .data .repository .query .Param ;
import org .springframework .data .rest .core .annotation .RepositoryRestResource ;
@ RepositoryRestResource (path = "users" , collectionResourceRel = "users" )
public interface UserRestRepository extends
PagingAndSortingRepository <User , Long > {
List <User > findByRole (@ Param ("role" ) String role );
}
/src/main/java/com/in28minutes/springboot/model/Course.java
package com .in28minutes .springboot .model ;
import java .util .List ;
public class Course {
private String id ;
private String name ;
private String description ;
private List <String > steps ;
// Needed by Caused by: com.fasterxml.jackson.databind.JsonMappingException:
// Can not construct instance of com.in28minutes.springboot.model.Course:
// no suitable constructor found, can not deserialize from Object value
// (missing default constructor or creator, or perhaps need to add/enable
// type information?)
public Course () {
}
public Course (String id , String name , String description , List <String > steps ) {
super ();
this .id = id ;
this .name = name ;
this .description = description ;
this .steps = steps ;
}
public String getId () {
return id ;
}
public void setId (String id ) {
this .id = id ;
}
public String getDescription () {
return description ;
}
public String getName () {
return name ;
}
public List <String > getSteps () {
return steps ;
}
@ Override
public String toString () {
return String .format (
"Course [id=%s, name=%s, description=%s, steps=%s]" , id , name ,
description , steps );
}
@ Override
public int hashCode () {
final int prime = 31 ;
int result = 1 ;
result = prime * result + ((id == null ) ? 0 : id .hashCode ());
return result ;
}
@ Override
public boolean equals (Object obj ) {
if (this == obj )
return true ;
if (obj == null )
return false ;
if (getClass () != obj .getClass ())
return false ;
Course other = (Course ) obj ;
if (id == null ) {
if (other .id != null )
return false ;
} else if (!id .equals (other .id ))
return false ;
return true ;
}
}
/src/main/java/com/in28minutes/springboot/model/Student.java
package com .in28minutes .springboot .model ;
import java .util .List ;
public class Student {
private String id ;
private String name ;
private String description ;
private List <Course > courses ;
public Student (String id , String name , String description ,
List <Course > courses ) {
super ();
this .id = id ;
this .name = name ;
this .description = description ;
this .courses = courses ;
}
public String getId () {
return id ;
}
public void setId (String id ) {
this .id = id ;
}
public String getName () {
return name ;
}
public void setName (String name ) {
this .name = name ;
}
public String getDescription () {
return description ;
}
public void setDescription (String description ) {
this .description = description ;
}
public List <Course > getCourses () {
return courses ;
}
public void setCourses (List <Course > courses ) {
this .courses = courses ;
}
@ Override
public String toString () {
return String .format (
"Student [id=%s, name=%s, description=%s, courses=%s]" , id ,
name , description , courses );
}
}
/src/main/java/com/in28minutes/springboot/security/SecurityConfig.java
package com .in28minutes .springboot .security ;
import org .springframework .context .annotation .Configuration ;
import org .springframework .security .config .annotation .authentication .builders .AuthenticationManagerBuilder ;
import org .springframework .security .config .annotation .web .builders .HttpSecurity ;
import org .springframework .security .config .annotation .web .configuration .WebSecurityConfigurerAdapter ;
//@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
// Authentication : User --> Roles
protected void configure (AuthenticationManagerBuilder auth )
throws Exception {
auth .inMemoryAuthentication ().passwordEncoder (org .springframework .security .crypto .password .NoOpPasswordEncoder .getInstance ()).withUser ("user1" ).password ("secret1" )
.roles ("USER" ).and ().withUser ("admin1" ).password ("secret1" )
.roles ("USER" , "ADMIN" );
}
// Authorization : Role -> Access
protected void configure (HttpSecurity http ) throws Exception {
http .httpBasic ().and ().authorizeRequests ().antMatchers ("/students/**" )
.hasRole ("USER" ).antMatchers ("/users/**" ).hasRole ("USER" )
.antMatchers ("/**" ).hasRole ("ADMIN" ).and ().csrf ().disable ()
.headers ().frameOptions ().disable ();
}
}
/src/main/java/com/in28minutes/springboot/service/StudentService.java
package com .in28minutes .springboot .service ;
import java .math .BigInteger ;
import java .security .SecureRandom ;
import java .util .ArrayList ;
import java .util .Arrays ;
import java .util .List ;
import org .springframework .stereotype .Component ;
import com .in28minutes .springboot .model .Course ;
import com .in28minutes .springboot .model .Student ;
@ Component
public class StudentService {
private static List <Student > students = new ArrayList <>();
static {
//Initialize Data
Course course1 = new Course ("Course1" , "Spring" , "10 Steps" , Arrays
.asList ("Learn Maven" , "Import Project" , "First Example" ,
"Second Example" ));
Course course2 = new Course ("Course2" , "Spring MVC" , "10 Examples" ,
Arrays .asList ("Learn Maven" , "Import Project" , "First Example" ,
"Second Example" ));
Course course3 = new Course ("Course3" , "Spring Boot" , "6K Students" ,
Arrays .asList ("Learn Maven" , "Learn Spring" ,
"Learn Spring MVC" , "First Example" , "Second Example" ));
Course course4 = new Course ("Course4" , "Maven" ,
"Most popular maven course on internet!" , Arrays .asList (
"Pom.xml" , "Build Life Cycle" , "Parent POM" ,
"Importing into Eclipse" ));
Student ranga = new Student ("Student1" , "Ranga Karanam" ,
"Hiker, Programmer and Architect" , new ArrayList <>(Arrays
.asList (course1 , course2 , course3 , course4 )));
Student satish = new Student ("Student2" , "Satish T" ,
"Hiker, Programmer and Architect" , new ArrayList <>(Arrays
.asList (course1 , course2 , course3 , course4 )));
students .add (ranga );
students .add (satish );
}
public List <Student > retrieveAllStudents () {
return students ;
}
public Student retrieveStudent (String studentId ) {
for (Student student : students ) {
if (student .getId ().equals (studentId )) {
return student ;
}
}
return null ;
}
public List <Course > retrieveCourses (String studentId ) {
Student student = retrieveStudent (studentId );
if (studentId .equalsIgnoreCase ("Student1" )){
throw new RuntimeException ("Something went wrong" );
}
if (student == null ) {
return null ;
}
return student .getCourses ();
}
public Course retrieveCourse (String studentId , String courseId ) {
Student student = retrieveStudent (studentId );
if (student == null ) {
return null ;
}
for (Course course : student .getCourses ()) {
if (course .getId ().equals (courseId )) {
return course ;
}
}
return null ;
}
private SecureRandom random = new SecureRandom ();
public Course addCourse (String studentId , Course course ) {
Student student = retrieveStudent (studentId );
if (student == null ) {
return null ;
}
String randomId = new BigInteger (130 , random ).toString (32 );
course .setId (randomId );
student .getCourses ().add (course );
return course ;
}
}
/src/main/java/com/in28minutes/springboot/StudentApplication.java
package com .in28minutes .springboot ;
import org .springframework .boot .SpringApplication ;
import org .springframework .boot .autoconfigure .EnableAutoConfiguration ;
import org .springframework .boot .autoconfigure .SpringBootApplication ;
import org .springframework .context .ApplicationContext ;
@ EnableAutoConfiguration (exclude = {
org .springframework .boot .autoconfigure .security .SecurityAutoConfiguration .class ,
org .springframework .boot .actuate .autoconfigure .ManagementWebSecurityAutoConfiguration .class })
@ SpringBootApplication
public class StudentApplication {
public static void main (String [] args ) {
ApplicationContext ctx = SpringApplication .run (
StudentApplication .class , args );
//System.out.println(ctx);
}
}
/src/main/java/com/in28minutes/springboot/WelcomeController.java
package com .in28minutes .springboot ;
import java .util .HashMap ;
import java .util .Map ;
import org .springframework .beans .factory .annotation .Autowired ;
import org .springframework .web .bind .annotation .RequestMapping ;
import org .springframework .web .bind .annotation .RestController ;
import com .in28minutes .springboot .configuration .BasicConfiguration ;
@ RestController
public class WelcomeController {
@ Autowired
private WelcomeService service ;
@ Autowired
private BasicConfiguration configuration ;
@ RequestMapping ("/welcome" )
public String welcome () {
return service .retrieveWelcomeMessage ();
}
@ RequestMapping ("/dynamic-configuration" )
public Map <String , Object > dynamicConfiguration () {
Map <String , Object > map = new HashMap <String , Object >();
map .put ("message" , configuration .getMessage ());
map .put ("number" , configuration .getNumber ());
map .put ("value" , configuration .isValue ());
return map ;
}
}
/src/main/java/com/in28minutes/springboot/WelcomeService.java
package com .in28minutes .springboot ;
import org .springframework .beans .factory .annotation .Value ;
import org .springframework .stereotype .Component ;
@ Component
public class WelcomeService {
@ Value ("${welcome.message}" )
private String welcomeMessage ;
public String retrieveWelcomeMessage () {
//Complex Method
return welcomeMessage ;
}
}
/src/main/resources/application-dev.properties
logging.level.org.springframework: DEBUG
basic.message =Welcome to in28minutes - Dev Profile
/src/main/resources/application-prod.properties
logging.level.org.springframework: DEBUG
/src/main/resources/application.properties
logging.level.org.springframework: INFO
app.name =in28Minutes-New
welcome.message =Welcome message from property file Changed! Welcome to ${app.name}
basic.value =true
basic.message =Welcome to in28minutes - Changed
basic.number =200
/src/test/java/com/in28minutes/springboot/controller/StudentControllerIT.java
package com .in28minutes .springboot .controller ;
import static org .junit .Assert .assertTrue ;
import java .nio .charset .Charset ;
import java .util .Arrays ;
import org .json .JSONException ;
import org .junit .Before ;
import org .junit .Test ;
import org .junit .runner .RunWith ;
import org .skyscreamer .jsonassert .JSONAssert ;
import org .springframework .boot .test .context .SpringBootTest ;
import org .springframework .boot .test .web .client .TestRestTemplate ;
import org .springframework .boot .web .server .LocalServerPort ;
import org .springframework .http .HttpEntity ;
import org .springframework .http .HttpHeaders ;
import org .springframework .http .HttpMethod ;
import org .springframework .http .MediaType ;
import org .springframework .http .ResponseEntity ;
import org .springframework .security .crypto .codec .Base64 ;
import org .springframework .test .context .junit4 .SpringRunner ;
import com .in28minutes .springboot .StudentApplication ;
import com .in28minutes .springboot .model .Course ;
@ RunWith (SpringRunner .class )
@ SpringBootTest (classes = StudentApplication .class ,
webEnvironment = SpringBootTest .WebEnvironment .RANDOM_PORT )
public class StudentControllerIT {
@ LocalServerPort
private int port ;
TestRestTemplate restTemplate = new TestRestTemplate ();
HttpHeaders headers = new HttpHeaders ();
@ Before
public void before () {
headers .add ("Authorization" , createHttpAuthenticationHeaderValue (
"user1" , "secret1" ));
headers .setAccept (Arrays .asList (MediaType .APPLICATION_JSON ));
}
@ Test
public void testRetrieveStudentCourse () throws JSONException {
HttpEntity <String > entity = new HttpEntity <String >(null , headers );
ResponseEntity <String > response = restTemplate .exchange (
createURLWithPort ("/students/Student1/courses/Course1" ),
HttpMethod .GET , entity , String .class );
String expected = "{id:Course1,name:Spring,description:10Steps}" ;
JSONAssert .assertEquals (expected , response .getBody (), false );
}
@ Test
public void addCourse () {
Course course = new Course ("Course1" , "Spring" , "10Steps" , Arrays
.asList ("Learn Maven" , "Import Project" , "First Example" ,
"Second Example" ));
HttpEntity <Course > entity = new HttpEntity <Course >(course , headers );
ResponseEntity <String > response = restTemplate .exchange (
createURLWithPort ("/students/Student1/courses" ),
HttpMethod .POST , entity , String .class );
String actual = response .getHeaders ().get (HttpHeaders .LOCATION ).get (0 );
assertTrue (actual .contains ("/students/Student1/courses/" ));
}
private String createURLWithPort (String uri ) {
return "http://localhost:" + port + uri ;
}
private String createHttpAuthenticationHeaderValue (String userId ,
String password ) {
String auth = userId + ":" + password ;
byte [] encodedAuth = Base64 .encode (auth .getBytes (Charset
.forName ("US-ASCII" )));
String headerValue = "Basic " + new String (encodedAuth );
return headerValue ;
}
}
/src/test/java/com/in28minutes/springboot/controller/StudentControllerTest.java
package com .in28minutes .springboot .controller ;
import static org .junit .Assert .assertEquals ;
import java .util .Arrays ;
import org .junit .Test ;
import org .junit .runner .RunWith ;
import org .mockito .Mockito ;
import org .skyscreamer .jsonassert .JSONAssert ;
import org .springframework .beans .factory .annotation .Autowired ;
import org .springframework .boot .test .autoconfigure .web .servlet .WebMvcTest ;
import org .springframework .boot .test .mock .mockito .MockBean ;
import org .springframework .http .HttpHeaders ;
import org .springframework .http .HttpStatus ;
import org .springframework .http .MediaType ;
import org .springframework .mock .web .MockHttpServletResponse ;
import org .springframework .test .context .junit4 .SpringRunner ;
import org .springframework .test .web .servlet .MockMvc ;
import org .springframework .test .web .servlet .MvcResult ;
import org .springframework .test .web .servlet .RequestBuilder ;
import org .springframework .test .web .servlet .request .MockMvcRequestBuilders ;
import com .in28minutes .springboot .model .Course ;
import com .in28minutes .springboot .service .StudentService ;
@ RunWith (SpringRunner .class )
@ WebMvcTest (value = StudentController .class , secure = false )
public class StudentControllerTest {
@ Autowired
private MockMvc mockMvc ;
@ MockBean
private StudentService studentService ;
Course mockCourse = new Course ("Course1" , "Spring" , "10 Steps" , Arrays
.asList ("Learn Maven" , "Import Project" , "First Example" ,
"Second Example" ));
String exampleCourseJson = "{\" name\" :\" Spring\" ,\" description\" :\" 10 Steps\" ,\" steps\" :[\" Learn Maven\" ,\" Import Project\" ,\" First Example\" ,\" Second Example\" ]}" ;
@ Test
public void retrieveDetailsForCourse () throws Exception {
Mockito .when (
studentService .retrieveCourse (Mockito .anyString (), Mockito
.anyString ())).thenReturn (mockCourse );
RequestBuilder requestBuilder = MockMvcRequestBuilders .get (
"/students/Student1/courses/Course1" ).accept (
MediaType .APPLICATION_JSON );
MvcResult result = mockMvc .perform (requestBuilder ).andReturn ();
System .out .println (result .getResponse ());
String expected = "{id:Course1,name:Spring,description:10 Steps}" ;
//{"id":"Course1","name":"Spring","description":"10 Steps, 25 Examples and 10K Students","steps":["Learn Maven","Import Project","First Example","Second Example"]}
JSONAssert .assertEquals (expected , result .getResponse ()
.getContentAsString (), false );
}
@ Test
public void createStudentCourse () throws Exception {
Course mockCourse = new Course ("1" , "Smallest Number" , "1" , Arrays
.asList ("1" , "2" , "3" , "4" ));
//studentService.addCourse to respond back with mockCourse
Mockito .when (
studentService .addCourse (Mockito .anyString (), Mockito
.any (Course .class ))).thenReturn (mockCourse );
//Send course as body to /students/Student1/courses
RequestBuilder requestBuilder = MockMvcRequestBuilders .post (
"/students/Student1/courses" )
.accept (MediaType .APPLICATION_JSON ).content (exampleCourseJson )
.contentType (MediaType .APPLICATION_JSON );
MvcResult result = mockMvc .perform (requestBuilder ).andReturn ();
MockHttpServletResponse response = result .getResponse ();
assertEquals (HttpStatus .CREATED .value (), response .getStatus ());
assertEquals ("http://localhost/students/Student1/courses/1" , response
.getHeader (HttpHeaders .LOCATION ));
}
}