GUACAMOLE-504: Add method for WebSocket status, and reconfigure REST API to use new HTTP method.

This commit is contained in:
Nick Couchman
2018-02-08 09:44:19 -05:00
parent 5239a83acc
commit 0c5b3012ac
2 changed files with 13 additions and 1 deletions

View File

@@ -81,4 +81,16 @@ public class GuacamoleException extends Exception {
return getStatus().getHttpStatusCode();
}
/**
* Returns the most applicable WebSocket status code that can be
* associated with this exception.
*
* @return
* An integer representing the most applicable WebSocket status
* code associated with this exception.
*/
public int getWebSocketCode() {
return getStatus().getWebSocketCode();
}
}

View File

@@ -173,7 +173,7 @@ public class RESTExceptionWrapper implements MethodInterceptor {
// Translate GuacamoleException subclasses to HTTP error codes
catch (GuacamoleException e) {
throw new APIException(
Response.Status.fromStatusCode(e.getStatus().getHttpStatusCode()),
Response.Status.fromStatusCode(e.getHttpStatusCode()),
e
);
}