Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
alx_java2b_20250412
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
alx_java2b_20250412
Commits
f14126fa
Commit
f14126fa
authored
May 11, 2025
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TimeResource - więcej metod
parent
0235a23a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
6 deletions
+33
-6
TimeResource.java
PC26-RestSerwer/src/main/java/rest/TimeResource.java
+33
-6
No files found.
PC26-RestSerwer/src/main/java/rest/TimeResource.java
View file @
f14126fa
package
rest
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
jakarta.ws.rs.GET
;
import
jakarta.ws.rs.Path
;
import
jakarta.ws.rs.Produces
;
@Path
(
"/time"
)
@Path
(
"/dt"
)
@Produces
(
"text/plain;charset=UTF-8"
)
public
class
TimeResource
{
// ta metoda obsługuje adres .../dt
@GET
public
String
getDateTime
()
{
return
LocalDateTime
.
now
()
.
toString
()
;
public
LocalDateTime
odczytajDataICzas
()
{
return
LocalDateTime
.
now
();
}
// ta metoda obsługuje adres .../dt/date
@GET
@Path
(
"/second"
)
public
int
getSecond
()
{
return
LocalDateTime
.
now
().
getSecond
();
@Path
(
"/date"
)
public
LocalDate
odczytajDate
()
{
return
LocalDate
.
now
();
}
// ta metoda obsługuje adres .../dt/date/year
@GET
@Path
(
"/date/year"
)
public
int
odczytajRok
()
{
return
LocalDate
.
now
().
getYear
();
}
// ta metoda obsługuje adres .../dt/time
@GET
@Path
(
"/time"
)
public
LocalTime
odczytajCzas
()
{
return
LocalTime
.
now
();
}
// ta metoda obsługuje adres .../dt/time/second
@GET
@Path
(
"/time/second"
)
public
int
odczytajSekunde
()
{
return
LocalTime
.
now
().
getSecond
();
}
}
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