package com.clouway.friendlyserve;

import java.net.HttpURLConnection;

/**
 * @author Miroslav Genov (miroslav.genov@clouway.com)
 */
public class RsRedirect extends RsWrap {

  private final String redirectUrl;

  public RsRedirect(String redirectUrl) {
    super(new RsEmpty());
    this.redirectUrl = redirectUrl;
  }

  @Override
  public Status status() {
    return new Status(HttpURLConnection.HTTP_MOVED_TEMP, redirectUrl);
  }

}

@@ -170,16 +170,299 @@
 Wrap %7B%0A%0A
+  public static RsRedirect permanently(String redirectUrl) %7B%0A    return new RsRedirect(redirectUrl, HttpURLConnection.HTTP_MOVED_PERM);%0A  %7D%0A  %0A  public static RsRedirect temporary(String redirectUrl) %7B%0A    return new RsRedirect(redirectUrl, HttpURLConnection.HTTP_MOVED_TEMP);%0A  %7D%0A%0A%0A
   privat
@@ -488,16 +488,48 @@
 rectUrl;
+%0A  private final int statusCode;
 %0A%0A  publ
@@ -560,24 +560,146 @@
 irectUrl) %7B%0A
+    this(redirectUrl, HttpURLConnection.HTTP_MOVED_TEMP);%0A  %7D%0A%0A  private RsRedirect(String redirectUrl, int statusCode) %7B%0A
     super(ne
@@ -748,16 +748,50 @@
 ectUrl;%0A
+    this.statusCode = statusCode;%0A
   %7D%0A%0A  @
@@ -852,41 +852,18 @@
 tus(
-HttpURLConnection.HTTP_MOVED_TEMP
+statusCode
 , re

add support for temporary and permanent redirects