Skip to content

Commit 21286e6

Browse files
committed
test getRemotePort/getLocalPort
1 parent ff566d6 commit 21286e6

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

help/http-requests.http

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,8 @@ Content-Type: application/json
5353
### /resourceloader/staticpaths
5454
GET http://localhost:9100/resourceloader/staticpaths
5555

56-
### /resourceloader/staticpaths/physicalpath
57-
GET http://localhost:9100/resourceloader/staticpaths/physicalpath
56+
### /param/getRemotePort
57+
GET http://localhost:9100/param/getRemotePort
58+
59+
### /param/getLocalPort
60+
GET http://localhost:9100/param/getLocalPort

src/main/java/cn/netbuffer/springboot/demo/controller/ParamController.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,14 @@ public ResponseEntity mediatype(String value, String type) {
181181
return ResponseEntity.status(HttpStatus.OK).contentType(mediaType).body(value);
182182
}
183183

184+
@GetMapping("getRemotePort")
185+
public int getRemotePort(HttpServletRequest httpServletRequest) {
186+
return httpServletRequest.getRemotePort();
187+
}
188+
189+
@GetMapping("getLocalPort")
190+
public int getLocalPort(HttpServletRequest httpServletRequest) {
191+
return httpServletRequest.getLocalPort();
192+
}
193+
184194
}

0 commit comments

Comments
 (0)