Skip to content

Commit ad563e4

Browse files
author
Furkan Danışmaz
committed
http client is added
1 parent 402ca42 commit ad563e4

5 files changed

Lines changed: 34 additions & 10 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"local": {
3+
"protocol": "http://",
4+
"host": "localhost:8091"
5+
}
6+
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.fd.jackson.filter.controller;
22

3-
import com.fd.jackson.filter.model.GenericResponse;
3+
import com.fd.jackson.filter.model.ResponseBody;
44
import com.fd.jackson.filter.model.User;
55
import org.springframework.http.ResponseEntity;
66
import org.springframework.web.bind.annotation.*;
@@ -10,19 +10,19 @@
1010
public class UserController {
1111

1212
@GetMapping("/{id}")
13-
public ResponseEntity<GenericResponse<User>> getUser(@PathVariable int id) {
13+
public ResponseEntity<ResponseBody<User>> getUser(@PathVariable int id) {
1414
User user = User.builder()
1515
.firstName("furkan")
1616
.lastName("danismaz")
1717
.email("danismaz.furkan@gmail.com")
1818
.password("123456")
1919
.build();
20-
return ResponseEntity.ok().body(GenericResponse.success(user));
20+
return ResponseEntity.ok().body(ResponseBody.success(user));
2121
}
2222

2323
@PostMapping
24-
public ResponseEntity<GenericResponse<User>> create(@RequestBody User user) {
24+
public ResponseEntity<ResponseBody<User>> create(@RequestBody User user) {
2525
System.out.println("Password is " + user.getPassword());
26-
return ResponseEntity.ok().body(GenericResponse.success(user));
26+
return ResponseEntity.ok().body(ResponseBody.success(user));
2727
}
2828
}

jackson-filtering/src/main/java/com/fd/jackson/filter/model/GenericResponse.java renamed to jackson-filtering/src/main/java/com/fd/jackson/filter/model/ResponseBody.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55

66
@Getter
77
@Setter
8-
public class GenericResponse<T> {
8+
public class ResponseBody<T> {
99

1010
private T data;
1111
private boolean success;
1212
private String failureMessage;
1313

14-
public static <T> GenericResponse<T> success(T data) {
15-
GenericResponse<T> response = new GenericResponse<>();
14+
public static <T> ResponseBody<T> success(T data) {
15+
ResponseBody<T> response = new ResponseBody<>();
1616
response.data = data;
1717
response.success = true;
1818
return response;
1919
}
2020

21-
public static <T> GenericResponse<T> fail(String failureMessage) {
22-
GenericResponse<T> response = new GenericResponse<>();
21+
public static <T> ResponseBody<T> fail(String failureMessage) {
22+
ResponseBody<T> response = new ResponseBody<>();
2323
response.failureMessage = failureMessage;
2424
response.success = false;
2525
return response;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
server.servlet.context-path=/jackson
2+
server.port=8091

jackson-filtering/user.http

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
### GET USERS
2+
GET {{protocol}}{{host}}/jackson/user/1
3+
Accept: application/json
4+
5+
6+
### POST USER
7+
POST {{protocol}}{{host}}/jackson/user
8+
Accept: application/json
9+
Content-Type: application/json
10+
11+
{
12+
"firstName": "furkan",
13+
"lastName": "danismaz",
14+
"password": "123456",
15+
"email": "danismaz.furkan@gmail.com"
16+
}

0 commit comments

Comments
 (0)