Skip to content

Commit

Permalink
Update time service to have a textual version of date/time
Browse files Browse the repository at this point in the history
  • Loading branch information
kenfinnigan committed Aug 31, 2016
1 parent d82c4d6 commit 299ec34
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
5 changes: 0 additions & 5 deletions chapter4/time/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,5 @@
<groupId>org.wildfly.swarm</groupId>
<artifactId>jaxrs</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.2</version>
</dependency>
</dependencies>
</project>
20 changes: 20 additions & 0 deletions chapter4/time/src/main/java/ejm.chapter4.time/TimeResource.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package ejm.chapter4.time;

import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

import javax.ws.rs.GET;
import javax.ws.rs.Path;

/**
* @author Ken Finnigan
*/
@Path("/")
public class TimeResource {
private DateTimeFormatter formatter = DateTimeFormatter.RFC_1123_DATE_TIME;

@GET
public String getTime() {
return formatter.format(ZonedDateTime.now());
}
}

0 comments on commit 299ec34

Please sign in to comment.