Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
javab_20230928
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_20230928
Commits
e93b1a52
Commit
e93b1a52
authored
Nov 08, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RTime - wydzielenie obiektu z datą na poziom klasy
parent
1104af1d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
RTime.java
PC35-RestSerwer/src/main/java/rest/RTime.java
+8
-6
No files found.
PC35-RestSerwer/src/main/java/rest/RTime.java
View file @
e93b1a52
package
rest
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
jakarta.ws.rs.GET
;
import
jakarta.ws.rs.Path
;
@Path
(
"/dt"
)
public
class
RTime
{
// Obiekt tej klasy jest tworzony za każdym razem do obsługi każdego pojedynczego zapytania.
private
LocalDateTime
dt
=
LocalDateTime
.
now
();
{
System
.
out
.
println
(
"Jest tworzony obiekt RTime , dt = "
+
dt
);
}
// działa pod adresem: /dt
@GET
public
String
getDateTime
()
{
return
LocalDateTime
.
now
()
.
toString
();
return
dt
.
toString
();
}
// działa pod adresem: /dt/date
@GET
@Path
(
"/date"
)
public
String
getDate
()
{
return
LocalDate
.
now
().
toString
();
return
dt
.
toLocalDate
().
toString
();
}
@GET
@Path
(
"/time"
)
public
String
getTime
()
{
return
LocalTime
.
now
().
toString
();
return
dt
.
toLocalTime
().
toString
();
}
@GET
@Path
(
"/time/second"
)
public
int
getSecond
()
{
return
LocalTime
.
now
()
.
getSecond
();
return
dt
.
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