Skip to content

Commit

Permalink
[#1754] add a way to tell user why the request was bad (clients of ou…
Browse files Browse the repository at this point in the history
…r webservice wanted messages of why the request was bad)
  • Loading branch information
Dean Hiller authored and Notalifeform committed Nov 27, 2013
1 parent 119e106 commit a6bc589
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions framework/src/play/mvc/Controller.java
Expand Up @@ -354,6 +354,13 @@ protected static void notModified() {
throw new NotModified();
}

/**
* Send a 400 Bad request
*/
protected static void badRequest(String msg) {
throw new BadRequest(msg);
}

/**
* Send a 400 Bad request
*/
Expand Down
7 changes: 7 additions & 0 deletions framework/src/play/mvc/results/BadRequest.java
Expand Up @@ -9,6 +9,13 @@
*/
public class BadRequest extends Result {

public BadRequest(String msg) {
super(msg);
}

public BadRequest() {
}

@Override
public void apply(Request request, Response response) {
response.status = Http.StatusCode.BAD_REQUEST;
Expand Down

0 comments on commit a6bc589

Please sign in to comment.