|
9 | 9 | import com.koushikdutta.async.callback.CompletedCallback;
|
10 | 10 | import com.koushikdutta.async.future.Future;
|
11 | 11 | import com.koushikdutta.async.future.SimpleFuture;
|
12 |
| -import com.koushikdutta.async.future.ThenCallback; |
13 | 12 | import com.koushikdutta.async.http.AsyncHttpGet;
|
14 | 13 | import com.koushikdutta.async.http.AsyncHttpHead;
|
15 | 14 | import com.koushikdutta.async.http.AsyncHttpPost;
|
16 |
| -import com.koushikdutta.async.http.Headers; |
17 | 15 | import com.koushikdutta.async.http.WebSocket;
|
18 | 16 | import com.koushikdutta.async.http.WebSocketImpl;
|
19 |
| -import com.koushikdutta.async.http.body.AsyncHttpRequestBody; |
20 | 17 | import com.koushikdutta.async.util.StreamUtility;
|
21 | 18 |
|
22 | 19 | import java.io.File;
|
@@ -74,7 +71,7 @@ public void websocket(String regex, final AsyncHttpServer.WebSocketRequestCallba
|
74 | 71 | websocket(regex, null, callback);
|
75 | 72 | }
|
76 | 73 |
|
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) { |
78 | 75 | boolean hasUpgrade = false;
|
79 | 76 | String connection = request.getHeaders().get("Connection");
|
80 | 77 | if (connection != null) {
|
@@ -158,18 +155,17 @@ public static Asset getAssetStream(AssetManager am, String asset) {
|
158 | 155 | mContentTypes.put("json", "application/json");
|
159 | 156 | mContentTypes.put("png", "image/png");
|
160 | 157 | mContentTypes.put("jpg", "image/jpeg");
|
| 158 | + mContentTypes.put("jpeg", "image/jpeg"); |
161 | 159 | mContentTypes.put("html", "text/html");
|
162 | 160 | mContentTypes.put("css", "text/css");
|
163 | 161 | mContentTypes.put("mp4", "video/mp4");
|
164 | 162 | mContentTypes.put("mov", "video/quicktime");
|
165 | 163 | mContentTypes.put("wmv", "video/x-ms-wmv");
|
| 164 | + mContentTypes.put("txt", "text/plain"); |
166 | 165 | }
|
167 | 166 |
|
168 | 167 | 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); |
173 | 169 | }
|
174 | 170 |
|
175 | 171 | public static String tryGetContentType(String path) {
|
|
0 commit comments