Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
java_weekendowa_20221008
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
java_weekendowa_20221008
Commits
300f2911
Commit
300f2911
authored
Dec 11, 2022
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Projekt RestKlient i pierwsze zapytanie
parent
bb251f10
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
0 deletions
+66
-0
.gitignore
PC36-RestKlient/.gitignore
+8
-0
pom.xml
PC36-RestKlient/pom.xml
+31
-0
PrzykladoweZapytanie.java
...ient/src/main/java/sklep/klient/PrzykladoweZapytanie.java
+27
-0
No files found.
PC36-RestKlient/.gitignore
0 → 100644
View file @
300f2911
/.classpath
/.project
/.settings/
/target/
/produkt1.txt
/wynik?.*
/*.pdf
PC36-RestKlient/pom.xml
0 → 100644
View file @
300f2911
<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>
<groupId>
pl.alx.kjava
</groupId>
<artifactId>
PC36-RestKlient
</artifactId>
<version>
1.0
</version>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
17
</maven.compiler.source>
<maven.compiler.target>
17
</maven.compiler.target>
<resteasy.version>
5.0.4.Final
</resteasy.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.jboss.resteasy
</groupId>
<artifactId>
resteasy-client
</artifactId>
<version>
${resteasy.version}
</version>
</dependency>
<dependency>
<groupId>
org.jboss.resteasy
</groupId>
<artifactId>
resteasy-jaxb-provider
</artifactId>
<version>
${resteasy.version}
</version>
</dependency>
<dependency>
<groupId>
org.jboss.resteasy
</groupId>
<artifactId>
resteasy-jackson2-provider
</artifactId>
<version>
${resteasy.version}
</version>
</dependency>
</dependencies>
</project>
PC36-RestKlient/src/main/java/sklep/klient/PrzykladoweZapytanie.java
0 → 100644
View file @
300f2911
package
sklep
.
klient
;
import
javax.ws.rs.client.Client
;
import
javax.ws.rs.client.ClientBuilder
;
import
javax.ws.rs.core.Response
;
public
class
PrzykladoweZapytanie
{
// To pisaliśmy na żywo w tracie zajęć.
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
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment