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
ae8c0b00
Commit
ae8c0b00
authored
Jul 16, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new PobieranieXML()
parent
545e8239
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
PobieranieXML.java
.../src/main/java/com/example/demo/waluty/PobieranieXML.java
+1
-1
WalutyController.java
...c/main/java/com/example/demo/waluty/WalutyController.java
+2
-1
WalutyRest.java
...ing/src/main/java/com/example/demo/waluty/WalutyRest.java
+3
-2
No files found.
PC25-Spring/src/main/java/com/example/demo/waluty/PobieranieXML.java
View file @
ae8c0b00
...
...
@@ -21,7 +21,7 @@ import org.xml.sax.SAXException;
public
class
PobieranieXML
{
public
static
TabelaWalut
pobierzTabele
(
String
data
)
{
public
TabelaWalut
pobierzTabele
(
String
data
)
{
String
adres
=
"https://api.nbp.pl/api/exchangerates/tables/a"
;
if
(
data
!=
null
)
{
adres
+=
"/"
+
data
;
...
...
PC25-Spring/src/main/java/com/example/demo/waluty/WalutyController.java
View file @
ae8c0b00
...
...
@@ -6,10 +6,11 @@ import org.springframework.web.bind.annotation.GetMapping;
@Controller
public
class
WalutyController
{
private
PobieranieXML
pobieracz
=
new
PobieranieXML
();
@GetMapping
(
"/waluty"
)
public
String
wyswietlWaluty
(
String
data
,
Model
model
)
{
TabelaWalut
tabela
=
PobieranieXML
.
pobierzTabele
(
data
);
TabelaWalut
tabela
=
pobieracz
.
pobierzTabele
(
data
);
model
.
addAttribute
(
"tabela"
,
tabela
);
return
"waluty.html"
;
}
...
...
PC25-Spring/src/main/java/com/example/demo/waluty/WalutyRest.java
View file @
ae8c0b00
...
...
@@ -8,16 +8,17 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping
(
"/waluty.rest"
)
public
class
WalutyRest
{
private
PobieranieXML
pobieracz
=
new
PobieranieXML
();
@GetMapping
public
TabelaWalut
wyswietlWaluty
()
{
TabelaWalut
tabela
=
PobieranieXML
.
pobierzTabele
(
null
);
TabelaWalut
tabela
=
pobieracz
.
pobierzTabele
(
null
);
return
tabela
;
}
@GetMapping
(
"/{data}"
)
public
TabelaWalut
wyswietlWaluty
(
@PathVariable
String
data
)
{
TabelaWalut
tabela
=
PobieranieXML
.
pobierzTabele
(
data
);
TabelaWalut
tabela
=
pobieracz
.
pobierzTabele
(
data
);
return
tabela
;
}
...
...
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