Lines Matching refs:Response
79 private static class Response {
86 Response(byte[] responseData, List<Pair<String, String>> responseHeaders,
100 private final Map<String, Response> mResponseMap = new HashMap<String, Response>();
184 mResponseMap.put(requestPath, new Response(
195 * This only gets the URL, you still need to set the response if you intend to access it.
205 * Sets a 404 (not found) response to be returned when a particular request path is passed in.
209 * response.
218 * Sets a response to be returned when a particular request path is passed
222 * @param responseString The response body that will be returned.
224 * response (null is acceptable).
226 * response.
236 * Sets a response to be returned when a particular request path is passed
241 * @param responseString The response body that will be returned.
243 * response (null is acceptable).
244 * @param responseAction The action to be performed when fetching the response. This action
248 * response.
264 * response.
276 * Sets a base64 encoded response to be returned when a particular request path is passed
280 * @param base64EncodedResponse The response body that is base64 encoded. The actual server
281 * response will the decoded binary form.
283 * response (null is acceptable).
285 * response.
387 * Generate a response to the given request.
391 * <p>If there is an action associated with the response, it will be executed inside of
407 Response response = null;
409 response = mResponseMap.get(path);
413 } else if (response == null) {
415 } else if (response.mIsNotFound) {
418 } else if (response.mIsRedirect) {
420 for (Pair<String, String> header : response.mResponseHeaders) {
425 response.mResponseAction != null) response.mResponseAction.run();
428 ByteArrayEntity entity = createEntity(response.mResponseData);
431 for (Pair<String, String> header : response.mResponseHeaders) {
442 private void setDateHeaders(HttpResponse response) {
443 response.addHeader("Date", DateUtils.formatDate(new Date(), DateUtils.PATTERN_RFC1123));
447 * Create an empty response with the given status.
450 HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_0, status, null);
474 response.setEntity(entity);
475 response.setHeader("Content-Length", "" + entity.getContentLength());
477 return response;
585 // parsing the response since conn.close() will crash
592 HttpResponse response = mServer.getResponse(request);
593 conn.sendResponseHeader(response);
594 conn.sendResponseEntity(response);