mirror of
https://github.com/devsnaith/lumiere-server.git
synced 2024-11-23 17:13:14 +03:00
Fix sorting problems
This commit is contained in:
parent
24a07e1fa5
commit
596e2d9a23
Binary file not shown.
@ -2,7 +2,7 @@ package org.eu.lumiere.net.http;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.HashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eu.lumiere.loggers.GlobalLogger;
|
import org.eu.lumiere.loggers.GlobalLogger;
|
||||||
@ -13,22 +13,21 @@ public class HttpResponse {
|
|||||||
private GlobalLogger l = GlobalLogger.getLogger();
|
private GlobalLogger l = GlobalLogger.getLogger();
|
||||||
private String status_line = "HTTP/1.0 200 OK";
|
private String status_line = "HTTP/1.0 200 OK";
|
||||||
private String content_type = "text/html";
|
private String content_type = "text/html";
|
||||||
|
private LinkedHashMap<String, String> httph;
|
||||||
private HashMap<String, String> httph;
|
|
||||||
private Socket client;
|
private Socket client;
|
||||||
|
|
||||||
public HttpResponse(Socket client, String status_line, String content_type) {
|
public HttpResponse(Socket client, String status_line, String content_type) {
|
||||||
this.content_type = content_type == null ? this.content_type : content_type;
|
this.content_type = content_type == null ? this.content_type : content_type;
|
||||||
if(status_line != null && !status_line.isEmpty())
|
if(status_line != null && !status_line.isEmpty())
|
||||||
this.status_line = status_line;
|
this.status_line = status_line;
|
||||||
httph = httph == null ? new HashMap<>() : httph;
|
httph = httph == null ? new LinkedHashMap<>() : httph;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void push(String body) {
|
public void push(String body) {
|
||||||
try {
|
try {
|
||||||
StringBuilder build = new StringBuilder(status_line+"\r\n");
|
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)));
|
build.append(String.format("%s: %s\r\n", key, getProperty(key)));
|
||||||
}
|
}
|
||||||
client.getOutputStream().write(build.append("\r\n").append(body).toString().getBytes());
|
client.getOutputStream().write(build.append("\r\n").append(body).toString().getBytes());
|
||||||
|
Loading…
Reference in New Issue
Block a user