File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
common/src/main/java/org/openshift/ping/common/server Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change 3030 * @author <a href="mailto:[email protected] ">Ales Justin</a> 3131 */
3232public class JBossServer extends AbstractServer {
33+ private static final byte [] RESPONSE_BYTES = "OK" .getBytes ();
34+
3335 private HttpServer server ;
3436
3537 public JBossServer (int port ) {
@@ -77,15 +79,20 @@ private Handler(Server server) {
7779 }
7880
7981 public void handle (HttpExchange exchange ) throws IOException {
80- exchange .sendResponseHeaders (200 , 0 );
8182 try {
82- String clusterName = exchange .getRequestHeaders ().getFirst (CLUSTER_NAME );
83- Channel channel = server .getChannel (clusterName );
84- try (InputStream stream = exchange .getRequestBody ()) {
85- handlePingRequest (channel , stream );
83+ try {
84+ String clusterName = exchange .getRequestHeaders ().getFirst (CLUSTER_NAME );
85+ Channel channel = server .getChannel (clusterName );
86+ try (InputStream stream = exchange .getRequestBody ()) {
87+ handlePingRequest (channel , stream );
88+ }
89+ exchange .sendResponseHeaders (200 , RESPONSE_BYTES .length );
90+ exchange .getResponseBody ().write (RESPONSE_BYTES );
91+ } catch (Exception e ) {
92+ throw new IOException (e );
8693 }
87- } catch ( Exception e ) {
88- throw new IOException ( e );
94+ } finally {
95+ exchange . close ( );
8996 }
9097 }
9198 }
You can’t perform that action at this time.
0 commit comments