play.mvc.results.Unauthorized Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of framework Show documentation
Show all versions of framework Show documentation
RePlay is a fork of the Play1 framework, created by Codeborne.
package play.mvc.results;
import play.mvc.Http;
import play.mvc.Http.Request;
import play.mvc.Http.Response;
import play.mvc.Scope.Flash;
import play.mvc.Scope.RenderArgs;
import play.mvc.Scope.Session;
/** 401 Unauthorized */
public class Unauthorized extends Result {
private final String realm;
public Unauthorized(String realm) {
super(realm);
this.realm = realm;
}
@Override
public void apply(
Request request, Response response, Session session, RenderArgs renderArgs, Flash flash) {
response.status = Http.StatusCode.UNAUTHORIZED;
response.setHeader("WWW-Authenticate", "Basic realm=\"" + realm + "\"");
}
public String getRealm() {
return realm;
}
}