Package de.uhilger.httpserver.base
Class HttpHelper
- java.lang.Object
-
- de.uhilger.httpserver.base.HttpHelper
-
public class HttpHelper extends Object
Helfer fuer HTTP-Methoden- Version:
- 1, 01.06.2021
- Author:
- Ulrich Hilger
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONTENT_TYPE
static String
CT_JSON
static String
CT_TEXT_HTML
static String
HTTP_DELETE
static String
HTTP_GET
static String
HTTP_POST
static String
HTTP_PUT
-
Constructor Summary
Constructors Constructor Description HttpHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
bodyLesen(com.sun.net.httpserver.HttpExchange exchange)
String
getAttrStr(Map attributes, String key, String defaultValue)
String
getFileName(com.sun.net.httpserver.HttpExchange e)
Den Namen der gewünschten Datei aus der HTTP-Anfrage ermittelnFile
tryWelcomeFiles(com.sun.net.httpserver.HttpExchange e, String fName)
-
-
-
Field Detail
-
HTTP_GET
public static final String HTTP_GET
- See Also:
- Constant Field Values
-
HTTP_POST
public static final String HTTP_POST
- See Also:
- Constant Field Values
-
HTTP_PUT
public static final String HTTP_PUT
- See Also:
- Constant Field Values
-
HTTP_DELETE
public static final String HTTP_DELETE
- See Also:
- Constant Field Values
-
CONTENT_TYPE
public static final String CONTENT_TYPE
- See Also:
- Constant Field Values
-
CT_JSON
public static final String CT_JSON
- See Also:
- Constant Field Values
-
CT_TEXT_HTML
public static final String CT_TEXT_HTML
- See Also:
- Constant Field Values
-
-
Method Detail
-
getFileName
public String getFileName(com.sun.net.httpserver.HttpExchange e)
Den Namen der gewünschten Datei aus der HTTP-Anfrage ermitteln- Parameters:
e
- das Objekt mit Methoden zur Untersuchung der Anfrage sowie zum Anfertigen und Senden der Antwort- Returns:
- Name der gewünschten Datei
-
bodyLesen
public String bodyLesen(com.sun.net.httpserver.HttpExchange exchange) throws IOException
- Throws:
IOException
-
-