Revize f9efb921
Přidáno uživatelem stepanekp před asi 1 rok
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/controller/detecting/DetectingController.java | ||
---|---|---|
3 | 3 |
import cz.zcu.fav.kiv.antipatterndetectionapp.service.detecting.DetectingService; |
4 | 4 |
import org.springframework.beans.factory.annotation.Autowired; |
5 | 5 |
import org.springframework.beans.factory.annotation.Value; |
6 |
import org.springframework.http.*; |
|
6 |
import org.springframework.http.HttpMethod; |
|
7 |
import org.springframework.http.HttpStatus; |
|
8 |
import org.springframework.http.ResponseEntity; |
|
7 | 9 |
import org.springframework.web.bind.annotation.*; |
8 | 10 |
import org.springframework.web.client.HttpStatusCodeException; |
9 |
import org.springframework.web.client.RestClientException; |
|
10 |
import org.springframework.web.client.RestTemplate; |
|
11 | 11 |
import org.springframework.web.servlet.HandlerMapping; |
12 | 12 |
|
13 | 13 |
import javax.servlet.http.HttpServletRequest; |
... | ... | |
31 | 31 |
ResponseEntity<String> response = detectingService.exchangeWithExternalService(url, requestBody, method); |
32 | 32 |
|
33 | 33 |
return response; |
34 |
} catch (HttpStatusCodeException e) { |
|
35 |
return ResponseEntity.status(e.getStatusCode()).body(e.getResponseBodyAsString()); |
|
34 | 36 |
} catch (Exception e) { |
35 | 37 |
e.printStackTrace(); |
36 | 38 |
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Internal Server Error"); |
Také k dispozici: Unified diff
Detecting controller edited