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
978 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( RESTToUpperCaseService.webContextPath )
public class RESTToUpperCaseService
{
static final String webContextPath = "/tolowercase";
@GET @Produces( MediaType.TEXT_PLAIN )
public String toLowerCasePlain( @QueryParam("input") String input )
{
return "Plain-Text: " + input.toLowerCase();
}
@GET @Produces( MediaType.TEXT_HTML )
public String toLowerCaseHtml( @QueryParam("input") String input )
{
return "<html><title>RESTService</title><body><h2>HTML: " + input.toLowerCase() + "</h2></body></html>";
}
@GET @Produces( MediaType.APPLICATION_JSON )
public String toLowerCaseJson( @QueryParam("input") String input )
{
return "{\n \"type\": \"JSON\",\n \"output\": \"" + input.toLowerCase() + "\"\n}";
}
}