diff --git a/bin/org/eu/lumiere/net/http/HttpResponse.class b/bin/org/eu/lumiere/net/http/HttpResponse.class index 6e2a492..6f8f1d3 100644 Binary files a/bin/org/eu/lumiere/net/http/HttpResponse.class and b/bin/org/eu/lumiere/net/http/HttpResponse.class differ diff --git a/src/org/eu/lumiere/net/http/HttpResponse.java b/src/org/eu/lumiere/net/http/HttpResponse.java index fa75de5..dcce73e 100644 --- a/src/org/eu/lumiere/net/http/HttpResponse.java +++ b/src/org/eu/lumiere/net/http/HttpResponse.java @@ -2,7 +2,7 @@ package org.eu.lumiere.net.http; import java.io.IOException; import java.net.Socket; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Set; import org.eu.lumiere.loggers.GlobalLogger; @@ -13,22 +13,21 @@ public class HttpResponse { private GlobalLogger l = GlobalLogger.getLogger(); private String status_line = "HTTP/1.0 200 OK"; private String content_type = "text/html"; - - private HashMap httph; + private LinkedHashMap httph; private Socket client; public HttpResponse(Socket client, String status_line, String content_type) { this.content_type = content_type == null ? this.content_type : content_type; if(status_line != null && !status_line.isEmpty()) this.status_line = status_line; - httph = httph == null ? new HashMap<>() : httph; + httph = httph == null ? new LinkedHashMap<>() : httph; this.client = client; } public void push(String body) { try { StringBuilder build = new StringBuilder(status_line+"\r\n"); - for(String key : getKeySet()) { + for(String key : httph.keySet()) { build.append(String.format("%s: %s\r\n", key, getProperty(key))); } client.getOutputStream().write(build.append("\r\n").append(body).toString().getBytes());