So, I have a RestController and a PostMapping that's responsible for an upload:
@RestController
@RequestMapping("/api/v1/upload")
public class UploadResource {
@PostMapping
public void upload(
HttpServletRequest request,
HttpServletResponse response) throws Exception {
}
}
What I want to achieve is: reset the connection after a specific amount of time (some kind of timeout). I tried to close the response and request stream:
response.getOutputStream().close();
request.getInputStream().close();
I also tried to throw an exception inside the method.
But my client is still sending data (also wireshark tells me the packets are still arriving at the target)
Is it somehow possible to close the underlying socket? The desirable result would be a SocketException: connection reset
(or something similar) on the client side