Browse Source

Fixed the infamous "upperCase" "lowerCase" confusion ;)

master
Sebastian Rieger 6 years ago
parent
commit
7ca8ada33d
  1. 8
      VerteilteSysteme-Examples/src/verteiltesysteme/rest/RESTToLowerCaseService.java
  2. 8
      VerteilteSysteme-Examples/src/verteiltesysteme/rest/RESTToUpperCaseService.java

8
VerteilteSysteme-Examples/src/verteiltesysteme/rest/RESTToLowerCaseService.java

@ -7,27 +7,27 @@ import javax.ws.rs.core.MediaType;
@Path( RESTToLowerCaseService.webContextPath ) @Path( RESTToLowerCaseService.webContextPath )
public class RESTToLowerCaseService public class RESTToLowerCaseService
{ {
static final String webContextPath = "/touppercase";
static final String webContextPath = "/tolowercase";
@GET @GET
@Produces( MediaType.TEXT_PLAIN ) @Produces( MediaType.TEXT_PLAIN )
public String toUpperCasePlain( @QueryParam("input") String input ) public String toUpperCasePlain( @QueryParam("input") String input )
{ {
return "Plain-Text: " + input.toUpperCase();
return "Plain-Text: " + input.toLowerCase();
} }
@GET @GET
@Produces( MediaType.TEXT_HTML ) @Produces( MediaType.TEXT_HTML )
public String toUpperCaseHtml( @QueryParam("input") String input ) public String toUpperCaseHtml( @QueryParam("input") String input )
{ {
return "<html><title>RESTService</title><body><h2>HTML: " + input.toUpperCase() + "</h2></body></html>";
return "<html><title>RESTService</title><body><h2>HTML: " + input.toLowerCase() + "</h2></body></html>";
} }
@GET @GET
@Produces( MediaType.APPLICATION_JSON ) @Produces( MediaType.APPLICATION_JSON )
public String toUpperCaseJson( @QueryParam("input") String input ) public String toUpperCaseJson( @QueryParam("input") String input )
{ {
return "{\n \"type\": \"JSON\",\n \"output\": \"" + input.toUpperCase() + "\"\n}";
return "{\n \"type\": \"JSON\",\n \"output\": \"" + input.toLowerCase() + "\"\n}";
} }
} }

8
VerteilteSysteme-Examples/src/verteiltesysteme/rest/RESTToUpperCaseService.java

@ -7,27 +7,27 @@ import javax.ws.rs.core.MediaType;
@Path( RESTToUpperCaseService.webContextPath ) @Path( RESTToUpperCaseService.webContextPath )
public class RESTToUpperCaseService public class RESTToUpperCaseService
{ {
static final String webContextPath = "/tolowercase";
static final String webContextPath = "/touppercase";
@GET @GET
@Produces( MediaType.TEXT_PLAIN ) @Produces( MediaType.TEXT_PLAIN )
public String toLowerCasePlain( @QueryParam("input") String input ) public String toLowerCasePlain( @QueryParam("input") String input )
{ {
return "Plain-Text: " + input.toLowerCase();
return "Plain-Text: " + input.toUpperCase();
} }
@GET @GET
@Produces( MediaType.TEXT_HTML ) @Produces( MediaType.TEXT_HTML )
public String toLowerCaseHtml( @QueryParam("input") String input ) public String toLowerCaseHtml( @QueryParam("input") String input )
{ {
return "<html><title>RESTService</title><body><h2>HTML: " + input.toLowerCase() + "</h2></body></html>";
return "<html><title>RESTService</title><body><h2>HTML: " + input.toUpperCase() + "</h2></body></html>";
} }
@GET @GET
@Produces( MediaType.APPLICATION_JSON ) @Produces( MediaType.APPLICATION_JSON )
public String toLowerCaseJson( @QueryParam("input") String input ) public String toLowerCaseJson( @QueryParam("input") String input )
{ {
return "{\n \"type\": \"JSON\",\n \"output\": \"" + input.toLowerCase() + "\"\n}";
return "{\n \"type\": \"JSON\",\n \"output\": \"" + input.toUpperCase() + "\"\n}";
} }
} }
Loading…
Cancel
Save