Re-add MoviesCommon to MoviesClient for MovieResourceClient
This commit is contained in:
parent
b8fb919bf4
commit
7108e73c65
@ -21,6 +21,7 @@
|
|||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="module" module-name="MoviesCommon" />
|
||||||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.4" level="project" />
|
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.4" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.sun.xml.ws:jaxws-rt:2.3.2" level="project" />
|
<orderEntry type="library" name="Maven: com.sun.xml.ws:jaxws-rt:2.3.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.sun.xml.ws:policy:2.7.6" level="project" />
|
<orderEntry type="library" name="Maven: com.sun.xml.ws:policy:2.7.6" level="project" />
|
||||||
|
@ -19,6 +19,11 @@
|
|||||||
<url>http://www.example.com</url>
|
<url>http://www.example.com</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>at.technikumwien</groupId>
|
||||||
|
<artifactId>MoviesCommon</artifactId>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.xml.ws</groupId>
|
<groupId>com.sun.xml.ws</groupId>
|
||||||
<artifactId>jaxws-ri</artifactId>
|
<artifactId>jaxws-ri</artifactId>
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package at.technikumwien.movies;
|
package at.technikumwien.movies;
|
||||||
|
|
||||||
import at.technikumwien.movies.generated.Movie;
|
|
||||||
|
|
||||||
import javax.ws.rs.client.ClientBuilder;
|
import javax.ws.rs.client.ClientBuilder;
|
||||||
import javax.ws.rs.client.Entity;
|
|
||||||
import javax.ws.rs.core.GenericType;
|
import javax.ws.rs.core.GenericType;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -12,13 +9,11 @@ public class MovieResourceClient {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
var target = ClientBuilder.newClient().target("http://localhost:8080/movieservice/resources/movie");
|
var target = ClientBuilder.newClient().target("http://localhost:8080/movieservice/resources/movie");
|
||||||
|
|
||||||
//var response = target.request().post(Entity.json(new Movie()));
|
|
||||||
//System.out.println(response.getLocation());
|
|
||||||
|
|
||||||
List<Movie> allMovies = target
|
List<Movie> allMovies = target
|
||||||
.request(MediaType.APPLICATION_XML)
|
.request(MediaType.APPLICATION_XML)
|
||||||
.get(new GenericType<List<Movie>>() {}); // Solution for List<Movie>.class
|
.get(new GenericType<List<Movie>>() {}); // Solution for List<Movie>.class
|
||||||
|
|
||||||
|
System.out.println("All movies by XML:");
|
||||||
allMovies.forEach(System.out::println);
|
allMovies.forEach(System.out::println);
|
||||||
|
|
||||||
var movie = target.path("/{id}")
|
var movie = target.path("/{id}")
|
||||||
@ -26,6 +21,7 @@ public class MovieResourceClient {
|
|||||||
.request(MediaType.APPLICATION_JSON)
|
.request(MediaType.APPLICATION_JSON)
|
||||||
.get(Movie.class);
|
.get(Movie.class);
|
||||||
|
|
||||||
|
System.out.println("First movie by ID by JSON:");
|
||||||
System.out.println(movie);
|
System.out.println(movie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user