Tabnine Logo
HttpClientResponse.statusMessage
Code IndexAdd Tabnine to your IDE (free)

How to use
statusMessage
method
in
io.vertx.core.http.HttpClientResponse

Best Java code snippets using io.vertx.core.http.HttpClientResponse.statusMessage (Showing top 20 results out of 351)

origin: eclipse-vertx/vert.x

private void testStatusCode(int code, String statusMessage) {
 server.requestHandler(req -> {
  if (code != -1) {
   req.response().setStatusCode(code);
  }
  if (statusMessage != null) {
   req.response().setStatusMessage(statusMessage);
  }
  req.response().end();
 });
 server.listen(onSuccess(s -> {
  client.request(HttpMethod.GET, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, DEFAULT_TEST_URI, onSuccess(resp -> {
   int theCode;
   if (code == -1) {
    // Default code - 200
    assertEquals(200, resp.statusCode());
    theCode = 200;
   } else {
    theCode = code;
   }
   if (statusMessage != null && resp.version() != HttpVersion.HTTP_2) {
    assertEquals(statusMessage, resp.statusMessage());
   } else {
    assertEquals(HttpResponseStatus.valueOf(theCode).reasonPhrase(), resp.statusMessage());
   }
   testComplete();
  })).end();
 }));
 await();
}
origin: vert-x3/vertx-examples

});
req.handler(resp -> {
 process.write(resp.statusCode() + " " + resp.statusMessage() + "\n");
 String contentType = resp.getHeader("Content-Type");
 String contentLength = resp.getHeader("Content-Length");
origin: eclipse-vertx/vert.x

assertEquals(HttpVersion.HTTP_2, resp.version());
assertEquals(200, resp.statusCode());
assertEquals("OK", resp.statusMessage());
assertEquals("text/plain", resp.getHeader("content-type"));
assertEquals("200", resp.getHeader(":status"));
origin: apache/servicecomb-java-chassis

@Override
public StatusType getStatusType() {
 if (statusType == null) {
  statusType = new HttpStatus(clientResponse.statusCode(), clientResponse.statusMessage());
 }
 return statusType;
}
origin: apache/servicecomb-java-chassis

@Override
public boolean unregisterMicroserviceInstance(String microserviceId, String microserviceInstanceId) {
 Holder<HttpClientResponse> holder = new Holder<>();
 IpPort ipPort = ipPortManager.getAvailableAddress();
 CountDownLatch countDownLatch = new CountDownLatch(1);
 RestUtils.delete(ipPort,
   String.format(Const.REGISTRY_API.MICROSERVICE_INSTANCE_OPERATION_ONE, microserviceId, microserviceInstanceId),
   new RequestParam(),
   syncHandler(countDownLatch, HttpClientResponse.class, holder));
 try {
  countDownLatch.await();
  if (holder.value != null) {
   if (holder.value.statusCode() == Status.OK.getStatusCode()) {
    return true;
   }
   LOGGER.warn(holder.value.statusMessage());
  }
 } catch (Exception e) {
  LOGGER.error("unregister microservice instance {}/{} failed",
    microserviceId,
    microserviceInstanceId,
    e);
 }
 return false;
}
origin: apache/servicecomb-java-chassis

@Override
public boolean updateMicroserviceProperties(String microserviceId, Map<String, String> serviceProperties) {
 Holder<HttpClientResponse> holder = new Holder<>();
 IpPort ipPort = ipPortManager.getAvailableAddress();
 try {
  UpdatePropertiesRequest request = new UpdatePropertiesRequest();
  request.setProperties(serviceProperties);
  byte[] body = JsonUtils.writeValueAsBytes(request);
  if (LOGGER.isDebugEnabled()) {
   LOGGER.debug("update properties of microservice: {}", new String(body, Charset.defaultCharset()));
  }
  CountDownLatch countDownLatch = new CountDownLatch(1);
  RestUtils.put(ipPort,
    String.format(Const.REGISTRY_API.MICROSERVICE_PROPERTIES, microserviceId),
    new RequestParam().setBody(body),
    syncHandler(countDownLatch, HttpClientResponse.class, holder));
  countDownLatch.await();
  if (holder.value != null) {
   if (holder.value.statusCode() == Status.OK.getStatusCode()) {
    return true;
   }
   LOGGER.warn(holder.value.statusMessage());
  }
 } catch (Exception e) {
  LOGGER.error("update properties of microservice {} failed",
    microserviceId,
    e);
 }
 return false;
}
origin: apache/servicecomb-java-chassis

 return true;
LOGGER.warn(holder.value.statusMessage());
origin: apache/servicecomb-java-chassis

@Override
public HeartbeatResponse heartbeat(String microserviceId, String microserviceInstanceId) {
 Holder<HttpClientResponse> holder = new Holder<>();
 IpPort ipPort = ipPortManager.getAvailableAddress();
 CountDownLatch countDownLatch = new CountDownLatch(1);
 RestUtils.put(ipPort,
   String.format(Const.REGISTRY_API.MICROSERVICE_HEARTBEAT, microserviceId, microserviceInstanceId),
   new RequestParam().setTimeout(ServiceRegistryConfig.INSTANCE.getHeartBeatRequestTimeout()),
   syncHandler(countDownLatch, HttpClientResponse.class, holder));
 try {
  countDownLatch.await();
  if (holder.value != null) {
   HeartbeatResponse response = new HeartbeatResponse();
   response.setMessage(holder.value.statusMessage());
   if (holder.value.statusCode() == Status.OK.getStatusCode()) {
    response.setOk(true);
    return response;
   }
   LOGGER.warn(holder.value.statusMessage());
   return response;
  }
 } catch (Exception e) {
  LOGGER.error("update microservice instance {}/{} heartbeat failed",
    microserviceId,
    microserviceInstanceId,
    e);
 }
 return null;
}
origin: apache/servicecomb-java-chassis

  cls.getName(),
  response.statusCode(),
  response.statusMessage(),
  bodyBuffer.toString());
countDownLatch.countDown();
origin: apache/servicecomb-java-chassis

  schemaId,
  holder.value.response.statusCode(),
  holder.value.response.statusMessage(),
  holder.value.bodyBuffer.toString());
return false;
origin: io.vertx/vertx-core

private void expectProxyException(int error, String username, String url) throws Exception {
 proxyTest(error, username, url, resp -> {
  log.info("request is supposed to fail but response is " + resp.statusCode() + " " + resp.statusMessage());
  fail("request is supposed to fail");
 }, true);
}
origin: io.helixservice/helix-rest

/**
 * Get the HTTP status code message
 *
 * @return HTTP status code, in a displayable message
 */
public String getStatusText() {
  return response.statusMessage();
}
origin: io.vertx/vertx-rx-java

/**
 * @return the status message of the response
 */
public String statusMessage() { 
 String ret = delegate.statusMessage();
 return ret;
}
origin: vert-x3/vertx-web

protected void testRequestBuffer(HttpClient client, HttpMethod method, int port, String path, Consumer<HttpClientRequest> requestAction, Consumer<HttpClientResponse> responseAction,
                 int statusCode, String statusMessage,
                 Buffer responseBodyBuffer, boolean normalizeLineEndings) throws Exception {
 CountDownLatch latch = new CountDownLatch(1);
 HttpClientRequest req = client.request(method, port, "localhost", path, onSuccess(resp -> {
  assertEquals(statusCode, resp.statusCode());
  assertEquals(statusMessage, resp.statusMessage());
  if (responseAction != null) {
   responseAction.accept(resp);
  }
  if (responseBodyBuffer == null) {
   latch.countDown();
  } else {
   resp.bodyHandler(buff -> {
    if (normalizeLineEndings) {
     buff = normalizeLineEndingsFor(buff);
    }
    assertEquals(responseBodyBuffer, buff);
    latch.countDown();
   });
  }
 }));
 if (requestAction != null) {
  requestAction.accept(req);
 }
 req.end();
 awaitLatch(latch);
}
origin: vert-x3/vertx-web

@Test
public void testExecuteBlockingParallel() throws Exception {
 long start = System.currentTimeMillis();
 int numExecBlocking = 5;
 long pause = 1000;
 router.route().blockingHandler(rc -> {
  try {
   Thread.sleep(pause);
  } catch (Exception ignore) {
  }
  rc.response().end();
 }, false);
 CountDownLatch latch = new CountDownLatch(numExecBlocking);
 for (int i = 0; i < numExecBlocking; i++) {
  client.getNow("/", onSuccess(resp -> {
   assertEquals(200, resp.statusCode());
   assertEquals("OK", resp.statusMessage());
   latch.countDown();
  }));
 }
 awaitLatch(latch);
 long now = System.currentTimeMillis();
 // we sleep for 5 seconds and we expect to be done within 2 + 1 seconds
 // this proves we run in parallel
 long leeway = 2000;
 assertTrue(now - start < pause + leeway);
}
origin: io.vertx/vertx-core

private void testStatusCode(int code, String statusMessage) {
 server.requestHandler(req -> {
  if (code != -1) {
   req.response().setStatusCode(code);
  }
  if (statusMessage != null) {
   req.response().setStatusMessage(statusMessage);
  }
  req.response().end();
 });
 server.listen(onSuccess(s -> {
  client.request(HttpMethod.GET, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, DEFAULT_TEST_URI, resp -> {
   int theCode;
   if (code == -1) {
    // Default code - 200
    assertEquals(200, resp.statusCode());
    theCode = 200;
   } else {
    theCode = code;
   }
   if (statusMessage != null && resp.version() != HttpVersion.HTTP_2) {
    assertEquals(statusMessage, resp.statusMessage());
   } else {
    assertEquals(HttpResponseStatus.valueOf(theCode).reasonPhrase(), resp.statusMessage());
   }
   testComplete();
  }).end();
 }));
 await();
}
origin: io.servicecomb/foundation-vertx

@Override
public StatusType getStatusType() {
 if (statusType == null) {
  statusType = new HttpStatus(clientResponse.statusCode(), clientResponse.statusMessage());
 }
 return statusType;
}
origin: io.vertx/vertx-core

assertEquals(HttpVersion.HTTP_2, resp.version());
assertEquals(200, resp.statusCode());
assertEquals("OK", resp.statusMessage());
assertEquals("text/plain", resp.getHeader("content-type"));
assertEquals("200", resp.getHeader(":status"));
origin: Treeptik/cloudunit

 @Override
 public void handle(HttpClientResponse response) {
  response.handler(json -> {
   if (response.statusCode() == 200) {
    final Channel channel = Json.decodeValue(json.toString(), Channel.class);
    future.complete(channel);
   } else {
    future.fail(response.statusMessage());
   }
  });
 }
});
origin: apiman/apiman

public static ApiResponse buildResponse(HttpClientResponse response, Set<String> suppressHeaders) {
  ApiResponse apimanResponse = new ApiResponse();
  apimanResponse.setCode(response.statusCode());
  apimanResponse.setMessage(response.statusMessage() == null ? "" : response.statusMessage());
  multimapToMap(apimanResponse.getHeaders(), response.headers(), suppressHeaders);
  return apimanResponse;
}
io.vertx.core.httpHttpClientResponsestatusMessage

Popular methods of HttpClientResponse

  • statusCode
  • bodyHandler
    Convenience method for receiving the entire request body in one piece. This saves you having to manu
  • headers
  • exceptionHandler
  • endHandler
  • getHeader
    Return the first header value with the specified name
  • handler
  • pause
  • resume
  • request
  • cookies
  • netSocket
    Get a net socket for the underlying connection of this request. USE THIS WITH CAUTION! Writing to th
  • cookies,
  • netSocket,
  • version,
  • customFrameHandler,
  • getTrailer,
  • streamPriorityHandler,
  • trailers,
  • fetch

Popular in Java

  • Finding current android device location
  • getContentResolver (Context)
  • getSharedPreferences (Context)
  • addToBackStack (FragmentTransaction)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now