X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpage%2FPage.java;h=297081ea394a063505b6142f87d08ac463a41888;hb=7aa50cecfed39150a02f9c4b9a64b4a33813d0a0;hp=c953ed9c3be9de6583c4c2709f5b9cb92e9a5210;hpb=3926382f08addaf45b7d4287232c6949832fde11;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/page/Page.java b/src/main/java/net/pterodactylus/sone/web/page/Page.java index c953ed9..297081e 100644 --- a/src/main/java/net/pterodactylus/sone/web/page/Page.java +++ b/src/main/java/net/pterodactylus/sone/web/page/Page.java @@ -1,5 +1,5 @@ /* - * shortener - Page.java - Copyright © 2010 David Roden + * Sone - Page.java - Copyright © 2010 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -125,7 +125,7 @@ public interface Page { * * @return The accessed URI */ - public URI getURI() { + public URI getUri() { return uri; } @@ -209,7 +209,7 @@ public interface Page { * The content of the reponse body */ public Response(int statusCode, String statusText, String contentType, byte[] content) { - this(statusCode, statusText, contentType, null, content); + this(statusCode, statusText, contentType, new HashMap(), content); } /** @@ -307,6 +307,21 @@ public interface Page { } /** + * Sets the HTTP header with the given name to the given value. Multiple + * headers with the same name are not implemented so that latest call to + * {@link #setHeader(String, String)} determines what is sent to the + * browser. + * + * @param name + * The name of the header + * @param value + * The value of the header + */ + public void setHeader(String name, String value) { + headers.put(name, value); + } + + /** * Returns the content of the response body. May be {@code null} if the * response does not have a body. *