aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Erat <derat@google.com>2016-01-04 12:00:55 -0700
committerDaniel Erat <derat@google.com>2016-01-04 13:13:11 -0700
commit12973d7c220d261c3748e3c8051b3ef478cf5b7a (patch)
treea2280c142a8e82ff6c3c5b11a4a118d3b4ba81ab
parent2ebd55e1bd837f6ae9e7c6c5ab003ea47991e876 (diff)
downloadnanohttpd-12973d7c220d261c3748e3c8051b3ef478cf5b7a.tar.gz
Add newFixedLengthResponse() to the NanoHTTPD class.
This method replaces Response's public constructor in v2.2.0. To avoid temporary breakage, I'm adding an implementation of it so that existing callers can be updated to call it before NanoHTTPD is rolled forward. Bug: 26289868 Change-Id: If68a314f16294e226b223cb35b6c35ca7449a03d
-rw-r--r--core/src/main/java/fi/iki/elonen/NanoHTTPD.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/src/main/java/fi/iki/elonen/NanoHTTPD.java b/core/src/main/java/fi/iki/elonen/NanoHTTPD.java
index ed59670..73fea3c 100644
--- a/core/src/main/java/fi/iki/elonen/NanoHTTPD.java
+++ b/core/src/main/java/fi/iki/elonen/NanoHTTPD.java
@@ -254,6 +254,15 @@ public abstract class NanoHTTPD {
}
/**
+ * Create a response with known length.
+ *
+ * TODO: Remove this implementation when updating to v2.2.0.
+ */
+ public static Response newFixedLengthResponse(Response.Status status, String mimeType, String txt) {
+ return new Response(status, mimeType, txt);
+ }
+
+ /**
* Override this to customize the server.
* <p/>
* <p/>