Commit d9ae4373 by Patryk Czarnik

Wielomodulowy-Ear

parent 7074bd7e
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>pl.alx.kjava.wielomodulowy</groupId>
<artifactId>PC38-Wielomodulowy</artifactId>
<version>1.0</version>
</parent>
<artifactId>PC38-Wielomodulowy-Ear</artifactId>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>PC38-Wielomodulowy-Web</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>PC38-Wielomodulowy-RestSerwer</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>
</project>
package sklep.klient;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.core.Response;
public class PrzykladoweZapytanie {
public static void main(String[] args) {
System.out.println("Buduję klienta");
Client client = ClientBuilder.newClient();
System.out.println("Wysyłam zapytanie...");
Response response = client.target("http://localhost:8080/PC35-RestSerwer-1.0/products.json/1")
.request().buildGet().invoke();
System.out.println("Mam odpowiedź: " + response);
System.out.println("Kod: " + response.getStatus());
System.out.println("Content-type: " + response.getMediaType());
String trescOdpowiedzi = response.readEntity(String.class);
System.out.println("Treść odpowiedzi:");
System.out.println(trescOdpowiedzi);
}
}
...@@ -4,7 +4,7 @@ import javax.ws.rs.core.MediaType; ...@@ -4,7 +4,7 @@ import javax.ws.rs.core.MediaType;
public class Ustawienia { public class Ustawienia {
public static final String URL_SERWERA = "http://localhost:8080/PC38-Wielomodulowy-RestSerwer-1.0/"; public static final String URL_SERWERA = "http://localhost:8080/PC38-Wielomodulowy-RestSerwer/";
public static String rozszerzenieDlaTypu(MediaType mediaType) { public static String rozszerzenieDlaTypu(MediaType mediaType) {
switch(mediaType.getSubtype()) { switch(mediaType.getSubtype()) {
......
...@@ -16,5 +16,6 @@ ...@@ -16,5 +16,6 @@
<module>PC38-Wielomodulowy-RestSerwer</module> <module>PC38-Wielomodulowy-RestSerwer</module>
<module>PC38-Wielomodulowy-RestKlient</module> <module>PC38-Wielomodulowy-RestKlient</module>
<module>PC38-Wielomodulowy-Web</module> <module>PC38-Wielomodulowy-Web</module>
<module>PC38-Wielomodulowy-Ear</module>
</modules> </modules>
</project> </project>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment