You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
975 B

/* Beispiel angelehnt an http://www.torsten-horn.de/techdocs/jee-rest.htm */
package verteiltesysteme.rest;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
@Path( RESTToLowerCaseService.webContextPath )
public class RESTToLowerCaseService
{
static final String webContextPath = "/touppercase";
@GET @Produces( MediaType.TEXT_PLAIN )
public String toUpperCasePlain( @QueryParam("input") String input )
{
return "Plain-Text: " + input.toUpperCase();
}
@GET @Produces( MediaType.TEXT_HTML )
public String toUpperCaseHtml( @QueryParam("input") String input )
{
return "<html><title>RESTService</title><body><h2>HTML: " + input.toUpperCase() + "</h2></body></html>";
}
@GET @Produces( MediaType.APPLICATION_JSON )
public String toUpperCaseJson( @QueryParam("input") String input )
{
return "{\n \"type\": \"JSON\",\n \"output\": \"" + input.toUpperCase() + "\"\n}";
}
}