Basisklassen zum Modul jdk.httpserver
Ulrich
2021-09-29 582410bbaf48d253e2c4825502cef0e414d669d0
neuester Stand
1 files modified
14 ■■■■■ changed files
src/de/uhilger/httpserver/base/HttpHelper.java 14 ●●●●● patch | view | raw | blame | history
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;