diff --git a/net-http-template-groovy/src/main/java/org/xbib/net/http/template/groovy/DefaultMarkupTemplate.java b/net-http-template-groovy/src/main/java/org/xbib/net/http/template/groovy/DefaultMarkupTemplate.java index df2fbd6..6e1c337 100644 --- a/net-http-template-groovy/src/main/java/org/xbib/net/http/template/groovy/DefaultMarkupTemplate.java +++ b/net-http-template-groovy/src/main/java/org/xbib/net/http/template/groovy/DefaultMarkupTemplate.java @@ -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); }