----------------------------------------- hi -----------------------------------------
@GET
@Path("/hi")
public String hi(@QueryParam("name") String name, @QueryParam("surname") String surname) {
return "Hello " + name + " " + surname;
}
http://localhost:8080/RestFulLesson5/resources/hello/hi?name=Abdulkadir&surname=Selcukoglu
Domain Name : localhost
Port : 8080
Application Name : RestFulLesson5
ApplicationPath : resources
Path (Class) : hello
Path (Method) : hi
QueryParam : Abdulkadir
QueryParam : Selcukoglu
Result : Hello Abdulkadir Selcukoglu
----------------------------------------- getPLS -----------------------------------------
@GET
@Path("/getPLS")
public String getPLS(@QueryParam("name") String name, @QueryParam("language") List
language) {
return "Languages which knows " + name + " " + language;
}
http://localhost:8080/RestFulLesson5/resources/hello/getPLS?name=Abdulkadir&language=JAVA&language=C++
Domain Name : localhost
Port : 8080
Application Name : RestFulLesson5
ApplicationPath : resources
Path (Class) : hello
Path (Method) : getPLS
QueryParam : Abdulkadir
QueryParam : [JAVA, C ]
Result : Languages which knows Abdulkadir [JAVA, C ]
----------------------------------------- getPLS2 -----------------------------------------
public String getPLS2(@Context UriInfo ui) {
String name = ui.getQueryParameters().getFirst("name");
List
language = ui.getQueryParameters().get("language");
return "Languages which knows " + name + " " + language;
}
http://localhost:8080/RestFulLesson5/resources/hello/getPLS2?name=Abdulkadir&language=JAVA&language=C++
Domain Name : localhost
Port : 8080
Application Name : RestFulLesson5
ApplicationPath : resources
Path (Class) : hello
Path (Method) : getPLS2
Context : Abdulkadir , [JAVA, C ]
Result : Languages which knows Abdulkadir [JAVA, C ]