I'm starting with REST, and I want to write simple app where you write movie title, and it takes from web server (in my example The Movie DB) information about all movies that matches that title (e.g. if I write "Harry Potter" I should get "Harry Potter and the Philosopher's Stone", "Harry Potter and the Chamber of Secrets" ...).
I'm completly new to the topic, but I wrote some code to write the title, but I have the problem with the part where I ask server. So I wrote simplest code, where I have ready to use URI in getURI_1 method:
(...)
@POST
@Produces(MediaType.TEXT_HTML)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public void newForm(@FormParam("movie title") String movie_title,
@Context HttpServletResponse servletResponse) throws IOException {
Client client = ClientBuilder.newClient();
WebTarget target = client.target(getURI_1());
Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, MY_KEY_HERE);
Response response = invocationBuilder.get();
String output = response.getEntity().toString();
System.out.println(output);
}
(...)
and:
private static URI getURI_1() {
return UriBuilder.fromUri("https://api.themoviedb.org/3/search/movie?api_key=MY_KEY_HERE&query=Harry+Potter").build();
}
My problem is as a result I ges something like this:
org.glassfish.jersey.client.HttpUrlConnector$2@4c4d97af
Can somebody tell me what is this?