Posts

Showing posts with the label Java REST Api

Common Java Practice Problems

java.net.URISyntaxException: Illegal character in path at index 49  with Illegal Character in Path when i am going to call Rest API using Java 11 HttpClient.   Mostly the reason of this error is url contains empty space (" "). in my case  url="http://localhost:8080/api/customers/byname"+name;  Some reason when i get to call Get Api from my java class which is as follows  public static HttpResponse callRestApiGet(String url) {        t ry {                   request =HttpRequest.newBuilder(URI.create(url)) .                               header("Content-Type", "application/json") .                               GET().build();            response = null;   ...