1 | package edu.ucsb.cs156.spring.backenddemo.controllers; | |
2 | ||
3 | import org.springframework.web.bind.annotation.RestController; | |
4 | import com.fasterxml.jackson.core.JsonProcessingException; | |
5 | import org.springframework.boot.web.client.RestTemplateBuilder; | |
6 | import org.springframework.stereotype.Service; | |
7 | import org.springframework.web.client.HttpClientErrorException; | |
8 | import org.springframework.web.client.RestTemplate; | |
9 | import com.fasterxml.jackson.core.JsonProcessingException; | |
10 | import java.util.*; | |
11 | import org.springframework.boot.web.client.RestTemplateBuilder; | |
12 | import org.springframework.http.HttpEntity; | |
13 | import org.springframework.http.HttpHeaders; | |
14 | import org.springframework.http.HttpMethod; | |
15 | import org.springframework.http.MediaType; | |
16 | import org.springframework.http.ResponseEntity; | |
17 | import org.springframework.stereotype.Service; | |
18 | import org.springframework.web.client.HttpClientErrorException; | |
19 | import io.swagger.v3.oas.annotations.*; | |
20 | import io.swagger.v3.oas.annotations.Operation; | |
21 | import io.swagger.v3.oas.annotations.tags.Tag; | |
22 | import org.springframework.web.bind.annotation.*; | |
23 | import com.fasterxml.jackson.databind.ObjectMapper; | |
24 | import org.springframework.beans.factory.annotation.Autowired; | |
25 | import edu.ucsb.cs156.spring.backenddemo.services.LocationQueryService; | |
26 | ||
27 | ||
28 | @Tag(name="Location Information") | |
29 | @RestController | |
30 | @RequestMapping("/api/locations") | |
31 | public class LocationController { | |
32 | ||
33 | ObjectMapper mapper = new ObjectMapper(); | |
34 | ||
35 | @Autowired | |
36 | LocationQueryService locationQueryService; | |
37 | ||
38 | @Operation(summary = "Get location data from a location", description = "Get location data from a location") | |
39 | @GetMapping("/get") | |
40 | public ResponseEntity<String> getLocationDetails( | |
41 | @Parameter(name="location", description="location", example="Isla Vista") @RequestParam String location | |
42 | ) throws JsonProcessingException { | |
43 | String result = locationQueryService.getJSON(location); | |
44 |
1
1. getLocationDetails : replaced return value with null for edu/ucsb/cs156/spring/backenddemo/controllers/LocationController::getLocationDetails → KILLED |
return ResponseEntity.ok().body(result); |
45 | } | |
46 | } | |
Mutations | ||
44 |
1.1 |