Skip to content

Commit be03566

Browse files
committed
content type
1 parent b46f39e commit be03566

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

AndroidAsync/src/com/koushikdutta/async/http/server/AsyncHttpServerRouter.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@
99
import com.koushikdutta.async.callback.CompletedCallback;
1010
import com.koushikdutta.async.future.Future;
1111
import com.koushikdutta.async.future.SimpleFuture;
12-
import com.koushikdutta.async.future.ThenCallback;
1312
import com.koushikdutta.async.http.AsyncHttpGet;
1413
import com.koushikdutta.async.http.AsyncHttpHead;
1514
import com.koushikdutta.async.http.AsyncHttpPost;
16-
import com.koushikdutta.async.http.Headers;
1715
import com.koushikdutta.async.http.WebSocket;
1816
import com.koushikdutta.async.http.WebSocketImpl;
19-
import com.koushikdutta.async.http.body.AsyncHttpRequestBody;
2017
import com.koushikdutta.async.util.StreamUtility;
2118

2219
import java.io.File;
@@ -74,7 +71,7 @@ public void websocket(String regex, final AsyncHttpServer.WebSocketRequestCallba
7471
websocket(regex, null, callback);
7572
}
7673

77-
protected WebSocket checkWebSocketUpgrade(final String protocol, AsyncHttpServerRequest request, final AsyncHttpServerResponse response) {
74+
static public WebSocket checkWebSocketUpgrade(final String protocol, AsyncHttpServerRequest request, final AsyncHttpServerResponse response) {
7875
boolean hasUpgrade = false;
7976
String connection = request.getHeaders().get("Connection");
8077
if (connection != null) {
@@ -158,18 +155,17 @@ public static Asset getAssetStream(AssetManager am, String asset) {
158155
mContentTypes.put("json", "application/json");
159156
mContentTypes.put("png", "image/png");
160157
mContentTypes.put("jpg", "image/jpeg");
158+
mContentTypes.put("jpeg", "image/jpeg");
161159
mContentTypes.put("html", "text/html");
162160
mContentTypes.put("css", "text/css");
163161
mContentTypes.put("mp4", "video/mp4");
164162
mContentTypes.put("mov", "video/quicktime");
165163
mContentTypes.put("wmv", "video/x-ms-wmv");
164+
mContentTypes.put("txt", "text/plain");
166165
}
167166

168167
public static String getContentType(String path) {
169-
String type = tryGetContentType(path);
170-
if (type != null)
171-
return type;
172-
return "text/plain";
168+
return tryGetContentType(path);
173169
}
174170

175171
public static String tryGetContentType(String path) {

0 commit comments

Comments
 (0)