-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
124 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 27 additions & 24 deletions
51
Jaxrs/Basic/src/main/java/com/guicedee/examples/jaxrs/basic/HelloWorld.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,36 @@ | ||
package com.guicedee.examples.jaxrs.basic; | ||
|
||
import com.guicedee.guicedinjection.*; | ||
import com.guicedee.guicedservlets.undertow.*; | ||
import io.undertow.*; | ||
import jakarta.ws.rs.*; | ||
import com.guicedee.client.IGuiceContext; | ||
import com.guicedee.guicedservlets.undertow.GuicedUndertow; | ||
import io.undertow.Undertow; | ||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.PathParam; | ||
import jakarta.ws.rs.Produces; | ||
|
||
import java.time.*; | ||
import java.time.temporal.*; | ||
import java.time.LocalDateTime; | ||
import java.time.temporal.ChronoUnit; | ||
|
||
@Path("hello") | ||
@Produces("application/json") | ||
public class HelloWorld | ||
{ | ||
@GET | ||
@Path("{name}") | ||
public String hello(@PathParam("name") final String name) | ||
{ | ||
return "Hello! " + name; | ||
} | ||
public static void main(String[] args) throws Exception | ||
{ | ||
LocalDateTime startTime = LocalDateTime.now(); | ||
//optional for class scanning optimization | ||
GuiceContext.registerModule("com.guicedee.examples.jaxrs.basic"); | ||
Undertow boot = GuicedUndertow.boot("0.0.0.0", 6003); | ||
LocalDateTime endTime = LocalDateTime.now(); | ||
System.out.println("Started in " + ChronoUnit.MILLIS.between(startTime, endTime) + "ms"); | ||
} | ||
@GET | ||
@Path("{name}") | ||
public String hello(@PathParam("name") final String name) | ||
{ | ||
return "Hello! " + name; | ||
} | ||
|
||
public static void main(String[] args) throws Exception | ||
{ | ||
LocalDateTime startTime = LocalDateTime.now(); | ||
|
||
//optional for class scanning optimization | ||
IGuiceContext.registerModule("com.guicedee.examples.jaxrs.basic"); | ||
Undertow boot = GuicedUndertow.boot("0.0.0.0", 6003); | ||
LocalDateTime endTime = LocalDateTime.now(); | ||
|
||
System.out.println("Started in " + ChronoUnit.MILLIS.between(startTime, endTime) + "ms"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
module com.guicedee.examples.jaxrs.basic { | ||
requires com.guicedee.guicedinjection; | ||
requires com.guicedee.guicedservlets.rest; | ||
requires com.guicedee.guicedservlets.undertow; | ||
|
||
requires java.net.http; | ||
exports com.guicedee.examples.jaxrs.basic; | ||
|
||
exports com.guicedee.examples.jaxrs.basic; | ||
opens com.guicedee.examples.jaxrs.basic to com.google.guice, com.fasterxml.jackson.databind, org.apache.cxf; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
Jaxrs/Binding/src/main/java/com/guicedee/examples/jaxrs/binding/BootJaxRSBindings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
package com.guicedee.examples.jaxrs.binding; | ||
|
||
|
||
import com.guicedee.guicedinjection.GuiceContext; | ||
import com.guicedee.client.IGuiceContext; | ||
import com.guicedee.guicedservlets.undertow.GuicedUndertow; | ||
import io.undertow.Undertow; | ||
|
||
public class BootJaxRSBindings | ||
{ | ||
public static void main(String... args) throws Exception | ||
{ | ||
GuiceContext.registerModule("com.guicedee.examples.jaxrs.binding"); | ||
Undertow undertow = GuicedUndertow.boot("0.0.0.0", 6003); | ||
} | ||
public static void main(String... args) throws Exception | ||
{ | ||
IGuiceContext.registerModule("com.guicedee.examples.jaxrs.binding"); | ||
Undertow undertow = GuicedUndertow.boot("0.0.0.0", 6003); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
open module com.guicedee.examples.jaxrs.binding.test { | ||
requires com.guicedee.examples.jaxrs.binding; | ||
requires org.junit.jupiter.api; | ||
|
||
requires java.net.http; | ||
|
||
requires org.junit.jupiter; | ||
|
||
requires com.guicedee.guicedservlets.rest; | ||
requires com.guicedee.guicedservlets.undertow; | ||
|
||
requires com.guicedee.examples.jaxrs.binding; | ||
|
||
requires org.junit.jupiter.api; | ||
|
||
requires java.net.http; | ||
|
||
requires org.junit.jupiter; | ||
|
||
requires com.guicedee.guicedservlets.rest; | ||
requires com.guicedee.guicedservlets.undertow; | ||
requires com.guicedee.guicedinjection; | ||
|
||
} |