Created
June 8, 2017 13:05
-
-
Save vyo/096813730fc597fa3692007306ad4f24 to your computer and use it in GitHub Desktop.
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
@Path("echo") | |
public class EchoController { | |
private EchoService echoService; | |
/** | |
* explicit default constructor; | |
* required by Jersey | |
*/ | |
public EchoController() { | |
echoService = new EchoService(); | |
} | |
/** | |
* test constructor; | |
* required for full control during unit testing | |
*/ | |
@TestConstructor | |
public EchoController(EchoService echoService) { | |
this.echoService = echoService; | |
} | |
@GET | |
@Path("{echo}") | |
@Produces(MediaType.TEXT_PLAIN) | |
public Echo echo(@PathParam("echo") String echo) { | |
return new Echo(echoService.reverse(echo)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment