add 410 GONE method
This commit is contained in:
parent
1ea725cbc2
commit
65279dbed3
1 changed files with 12 additions and 4 deletions
|
@ -52,10 +52,6 @@ public abstract class DefaultMarkupTemplate extends BaseTemplate {
|
|||
// session can be null in error templates
|
||||
}
|
||||
|
||||
public void setResponseStatus(HttpResponseStatus responseStatus) {
|
||||
responseBuilder.setResponseStatus(responseStatus);
|
||||
}
|
||||
|
||||
public void setContentType(String contentType) {
|
||||
responseBuilder.setHeader(HttpHeaderNames.CONTENT_TYPE, contentType);
|
||||
}
|
||||
|
@ -76,6 +72,10 @@ public abstract class DefaultMarkupTemplate extends BaseTemplate {
|
|||
responseBuilder.setHeader(HttpHeaderNames.CONTENT_LENGTH, Integer.toString(contentLength));
|
||||
}
|
||||
|
||||
public void setResponseStatus(HttpResponseStatus responseStatus) {
|
||||
responseBuilder.setResponseStatus(responseStatus);
|
||||
}
|
||||
|
||||
public void movedPermanently(String url) {
|
||||
responseBuilder.setResponseStatus(HttpResponseStatus.MOVED_PERMANENTLY); // 301
|
||||
responseBuilder.setHeader(HttpHeaderNames.LOCATION, url);
|
||||
|
@ -96,6 +96,14 @@ public abstract class DefaultMarkupTemplate extends BaseTemplate {
|
|||
responseBuilder.setHeader(HttpHeaderNames.LOCATION, url);
|
||||
}
|
||||
|
||||
public void notFound() {
|
||||
responseBuilder.setResponseStatus(HttpResponseStatus.NOT_FOUND); // 404
|
||||
}
|
||||
|
||||
public void gone() {
|
||||
responseBuilder.setResponseStatus(HttpResponseStatus.GONE); // 410
|
||||
}
|
||||
|
||||
public String contextPath(String rel) {
|
||||
return urlProto(rel, false);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue