From f428f0a1b9c9a9fa1c9e8c2346a8d6af860c603a Mon Sep 17 00:00:00 2001 From: joshua bauer Date: Tue, 16 Oct 2018 23:37:27 -0700 Subject: [PATCH] Support for 303 in response. --- .../java/io/sinistral/proteus/server/ServerResponse.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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) ) {