Skip to content

Commit

Permalink
queryParam -> queryParams
Browse files Browse the repository at this point in the history
  • Loading branch information
perwendel committed May 18, 2011
1 parent 27a5404 commit e7fd3a6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ public class Books {
Random random = new Random();
@Override
public Object handle(Request request, Response response) {
String author = request.queryParam("author");
String title = request.queryParam("title");
String author = request.queryParams("author");
String title = request.queryParams("title");
Book book = new Book(author, title);

int id = random.nextInt(Integer.MAX_VALUE);
Expand Down Expand Up @@ -183,8 +183,8 @@ public class Books {
String id = request.params(":id");
Book book = books.get(id);
if (book != null) {
String newAuthor = request.queryParam("author");
String newTitle = request.queryParam("title");
String newAuthor = request.queryParams("author");
String newTitle = request.queryParams("title");
if (newAuthor != null) {
book.setAuthor(newAuthor);
}
Expand Down Expand Up @@ -270,8 +270,8 @@ public class FilterExample {
before(new Filter("/") {
@Override
public void handle(Request request, Response response) {
String user = request.queryParam("user");
String password = request.queryParam("password");
String user = request.queryParams("user");
String password = request.queryParams("password");

String dbPassword = usernamePasswords.get(user);
if (!(password != null && password.equals(dbPassword))) {
Expand All @@ -286,7 +286,7 @@ public class FilterExample {
response.header("spark", "added by after-filter");
}
});

get(new Route("/hello") {
@Override
public Object handle(Request request, Response response) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/spark/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public int contentLength() {
* Returns the value of the provided queryParam
* Example: query parameter 'id' from the following request URI: /hello?id=foo
*/
public String queryParam(String queryParam) {
public String queryParams(String queryParam) {
return servletRequest.getParameter(queryParam);
}

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/spark/examples/books/Books.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public static void main(String[] args) {
Random random = new Random();
@Override
public Object handle(Request request, Response response) {
String author = request.queryParam("author");
String title = request.queryParam("title");
String author = request.queryParams("author");
String title = request.queryParams("title");
Book book = new Book(author, title);

int id = random.nextInt(Integer.MAX_VALUE);
Expand Down Expand Up @@ -80,8 +80,8 @@ public Object handle(Request request, Response response) {
String id = request.params(":id");
Book book = books.get(id);
if (book != null) {
String newAuthor = request.queryParam("author");
String newTitle = request.queryParam("title");
String newAuthor = request.queryParams("author");
String newTitle = request.queryParams("title");
if (newAuthor != null) {
book.setAuthor(newAuthor);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/spark/examples/filter/FilterExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public static void main(String[] args) {
before(new Filter("/") {
@Override
public void handle(Request request, Response response) {
String user = request.queryParam("user");
String password = request.queryParam("password");
String user = request.queryParams("user");
String password = request.queryParams("password");

String dbPassword = usernamePasswords.get(user);
if (!(password != null && password.equals(dbPassword))) {
Expand Down

0 comments on commit e7fd3a6

Please sign in to comment.