From 9d3717abd59e1672f5d8d7888ce613afdc7fb3c5 Mon Sep 17 00:00:00 2001 From: ulrich Date: Wed, 24 Jan 2024 13:00:11 +0000 Subject: [PATCH] HttpResponder.finish aufgeteilt --- src/de/uhilger/httpserver/base/HttpHelper.java | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/src/de/uhilger/httpserver/base/HttpHelper.java b/src/de/uhilger/httpserver/base/HttpHelper.java index d9985a6..fed74ea 100644 --- a/src/de/uhilger/httpserver/base/HttpHelper.java +++ b/src/de/uhilger/httpserver/base/HttpHelper.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.util.HashMap; import java.util.Map; /** @@ -40,6 +41,8 @@ public static final String HTTP_PUT = "PUT"; public static final String HTTP_DELETE = "DELETE"; + public static final String STR_AMP = "&"; + public static final String STR_EQUAL = "="; public static final String CONTENT_TYPE = "Content-Type"; @@ -80,6 +83,17 @@ } } + public Map<String, String> getQueryMap(String query) { + String[] params = query.split(STR_AMP); + Map<String, String> map = new HashMap<String, String>(); + for (String param : params) { + String name = param.split(STR_EQUAL)[0]; + String value = param.split(STR_EQUAL)[1]; + map.put(name, value); + } + return map; + } + public File tryWelcomeFiles(HttpExchange e, String fName) { boolean notFound = true; File file = null; -- Gitblit v1.9.3