Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
javab_20230617
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
javab_20230617
Commits
324c19ff
Commit
324c19ff
authored
Aug 20, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ustawienia
parent
9a941116
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
3 deletions
+8
-3
Klient01_URL.java
PC33-RestKlient/src/main/java/sklep/klient/Klient01_URL.java
+1
-1
Klient03_HttpClient.java
...lient/src/main/java/sklep/klient/Klient03_HttpClient.java
+1
-1
Klient04_HttpClient_String.java
...rc/main/java/sklep/klient/Klient04_HttpClient_String.java
+1
-1
Ustawienia.java
PC33-RestKlient/src/main/java/sklep/klient/Ustawienia.java
+5
-0
No files found.
PC33-RestKlient/src/main/java/sklep/klient/Klient01_URL.java
View file @
324c19ff
...
...
@@ -13,7 +13,7 @@ public class Klient01_URL {
public
static
void
main
(
String
[]
args
)
{
try
{
URL
url
=
new
URL
(
"http://localhost:8080/PC32-RestSerwer
/products.json"
);
URL
url
=
new
URL
(
Ustawienia
.
ADRES_USLUGI
+
"
/products.json"
);
try
(
InputStream
inputStream
=
url
.
openStream
())
{
Files
.
copy
(
inputStream
,
Paths
.
get
(
"wynik01.json"
),
StandardCopyOption
.
REPLACE_EXISTING
);
System
.
out
.
println
(
"OK"
);
...
...
PC33-RestKlient/src/main/java/sklep/klient/Klient03_HttpClient.java
View file @
324c19ff
...
...
@@ -21,7 +21,7 @@ public class Klient03_HttpClient {
public
static
void
main
(
String
[]
args
)
{
HttpClient
httpClient
=
HttpClient
.
newHttpClient
();
try
{
URI
uri
=
new
URI
(
"http://localhost:8080/PC32-RestSerwer
/products.json"
);
URI
uri
=
new
URI
(
Ustawienia
.
ADRES_USLUGI
+
"
/products.json"
);
HttpRequest
request
=
HttpRequest
.
newBuilder
(
uri
).
build
();
HttpResponse
<
Path
>
response
=
httpClient
.
send
(
request
,
BodyHandlers
.
ofFile
(
Paths
.
get
(
"wynik03.json"
)));
System
.
out
.
println
(
"response "
+
response
);
...
...
PC33-RestKlient/src/main/java/sklep/klient/Klient04_HttpClient_String.java
View file @
324c19ff
...
...
@@ -19,7 +19,7 @@ public class Klient04_HttpClient_String {
public
static
void
main
(
String
[]
args
)
{
HttpClient
httpClient
=
HttpClient
.
newHttpClient
();
try
{
URI
uri
=
new
URI
(
"http://localhost:8080/PC32-RestSerwer
/products.json"
);
URI
uri
=
new
URI
(
Ustawienia
.
ADRES_USLUGI
+
"
/products.json"
);
HttpRequest
request
=
HttpRequest
.
newBuilder
(
uri
).
build
();
HttpResponse
<
String
>
response
=
httpClient
.
send
(
request
,
BodyHandlers
.
ofString
());
System
.
out
.
println
(
"response "
+
response
);
...
...
PC33-RestKlient/src/main/java/sklep/klient/Ustawienia.java
0 → 100644
View file @
324c19ff
package
sklep
.
klient
;
public
class
Ustawienia
{
public
static
final
String
ADRES_USLUGI
=
"http://localhost:8080/PC32-RestSerwer"
;
}
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