diff --git a/src/main/java/io/sinistral/proteus/server/ServerResponse.java b/src/main/java/io/sinistral/proteus/server/ServerResponse.java index 70fadf7..a549049 100644 --- a/src/main/java/io/sinistral/proteus/server/ServerResponse.java +++ b/src/main/java/io/sinistral/proteus/server/ServerResponse.java @@ -372,6 +372,13 @@ public ServerResponse redirect(String location) return this; } + public ServerResponse redirect(String location, int status) + { + this.location = location; + this.status = status; + return this; + } + public ServerResponse redirectPermanently(String location) { this.location = location; @@ -581,7 +588,7 @@ public void send(final HttpHandler handler, final HttpServerExchange exchange) t exchange.getResponseHeaders().put(Headers.LOCATION, this.location); } - if(this.status == StatusCodes.FOUND || this.status == StatusCodes.MOVED_PERMANENTLY || this.status == StatusCodes.TEMPORARY_REDIRECT || this.status == StatusCodes.PERMANENT_REDIRECT ) + if(this.status == StatusCodes.FOUND || this.status == StatusCodes.MOVED_PERMANENTLY || this.status == StatusCodes.TEMPORARY_REDIRECT || this.status == StatusCodes.SEE_OTHER || this.status == StatusCodes.PERMANENT_REDIRECT ) { if( (this.status == StatusCodes.FOUND || this.status == StatusCodes.MOVED_PERMANENTLY) && (this.method != null) ) {