fi.evolver.basics.spring.tcp.TcpTestController Maven / Gradle / Ivy
package fi.evolver.basics.spring.tcp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import fi.evolver.basics.spring.http.MessageType;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
@RestController
public class TcpTestController {
private final TcpConnector tcpConnector;
@Autowired
public TcpTestController(TcpConnector tcpConnector) {
this.tcpConnector = tcpConnector;
}
@Operation(summary = "Test TCP connection to given host and port")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "TCP connection test status"),
@ApiResponse(responseCode = "400", description = "Invalid request parameters", content = @Content)
})
@GetMapping(value = "/tcp")
@MessageType("TcpTest")
public TcpConnectionStatus tcpTest(@RequestParam String host, @RequestParam int port) {
return this.tcpConnector.getTcpConnectionStatus(host, port);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy