public void OnResponse(HttpResponseHead response) { current = new ResponseInfo() { Head = response }; }
public void Render(IDataConsumer consumer, HttpResponseHead head) { var status = head.Status; var headers = head.Headers; // XXX don't reallocate every time var sb = new StringBuilder(); sb.AppendFormat("HTTP/1.1 {0}\r\n", status); if (headers == null) headers = new Dictionary<string, string>(); if (!headers.ContainsKey("Server")) headers["Server"] = "Kayak"; if (!headers.ContainsKey("Date")) headers["Date"] = DateTime.UtcNow.ToString(); foreach (var pair in headers) foreach (var line in pair.Value.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries)) sb.AppendFormat("{0}: {1}\r\n", pair.Key, line); sb.Append("\r\n"); consumer.OnData(new ArraySegment<byte>(Encoding.ASCII.GetBytes(sb.ToString())), null); }
public void OnRequest(HttpRequestHead request, IDataProducer requestBody, IHttpResponseDelegate response) { if (request.Uri.StartsWith("/feed.xml")) { var body = new FeedBuilder(Port).Generate(FeedTitle, FilePaths, ImagePath); var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", body.Length.ToString() }, } }; response.OnResponse(headers, new SimpleProducer(body)); return; } // deal with request for file content string uri = request.Uri.Replace("%20", " ").Replace("/", "\\"); string filePath = FilePaths.Where(d => d.Contains(uri)).FirstOrDefault(); if (filePath != null) { FileInfo fi = new FileInfo(filePath); string mimeType = GetMimeType(filePath); var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", mimeType }, { "Content-Length", fi.Length.ToString() }, } }; response.OnResponse(headers, new FileProducer(filePath)); return; } else { var responseBody = "The resource you requested ('" + request.Uri + "') could not be found."; var headers = new HttpResponseHead() { Status = "404 Not Found", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", responseBody.Length.ToString() } } }; var body = new SimpleProducer(responseBody); response.OnResponse(headers, body); return; } }
public void Render(ISocket socket, HttpResponseHead head) { var status = head.Status; var headers = head.Headers; // XXX don't reallocate every time var sb = new StringBuilder(); sb.AppendFormat("HTTP/1.1 {0}\r\n", status); if (headers != null) { foreach (var pair in headers) { foreach (var line in pair.Value.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries)) { sb.AppendFormat("{0}: {1}\r\n", pair.Key, line); } } } sb.Append("\r\n"); socket.Write(new ArraySegment <byte>(Encoding.ASCII.GetBytes(sb.ToString())), null); }
public static HttpResponseHead GetHttpResponseHead(string status = "200 OK") { var headers = new HttpResponseHead() { Status = status, Headers = new Dictionary<string, string>() }; return headers; }
public void OnResponse(HttpResponseHead head, bool hasBody) { if (hasBody) subject = new SimpleSubject( () => userCode.ConnectResponseBody(this), () => userCode.DisconnectResponseBody(this)); responseDelegate.OnResponse(head, subject); }
public HttpResponseHead BuildHeaders() { AddHeader(HttpHeaderNames.ContentType, _contentType); AddHeader(HttpHeaderNames.ContentLength, _contentLength.ToString()); var headers = new HttpResponseHead { Status = string.Format("{0} {1}", (int)_httpStatusCode, _httpStatusCode), Headers = _headers }; return headers; }
public void OnResponse(HttpResponseHead head, IDataProducer body) { var writeResponse = false; var hasBody = body != null; state.OnResponse(hasBody, out writeResponse); this.head = head; this.body = body; if (writeResponse) BeginResponse(); }
public void OnResponse(HttpResponseHead head, IDataProducer body) { var begin = false; var hasBody = body != null; state.OnResponse(hasBody, out begin); this.head = head; this.body = body; if (begin) Begin(); }
internal static HttpResponseHead GetOkHeaders(int contentSize) { var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { {"Content-Type", "application/json"}, {"Content-Length", contentSize.ToString()}, } }; return headers; }
public void OnResponse(HttpResponseHead head, IDataProducer body) { var writeResponse = false; var hasBody = body != null; state.OnResponse(hasBody, out writeResponse); this.head = head; this.body = body; if (writeResponse) { BeginResponse(); } }
public void WriteResponse(HttpResponseHead head, IDataProducer body) { if (gotResponse) { throw new InvalidOperationException("WriteResponse was previously called."); } gotResponse = true; this.head = head; this.body = body; if (transaction != null) { DoWriteResponse(); } }
public void OnResponse(HttpResponseHead head, IDataProducer body) { // XXX still need to better account for Connection: close. // this should cause the queue to drop pending responses // perhaps segment.Abort which disposes transation if (!shouldKeepAlive) { if (head.Headers == null) { head.Headers = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase); } head.Headers["Connection"] = "close"; } Segment.WriteResponse(head, ignoreResponseBody ? null : body); }
public void Render(ISocket socket, HttpResponseHead head) { var status = head.Status; var headers = head.Headers; // XXX don't reallocate every time var sb = new StringBuilder(); sb.AppendFormat("HTTP/1.1 {0}\r\n", status); if (headers != null) { foreach (var pair in headers) foreach (var line in pair.Value.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries)) sb.AppendFormat("{0}: {1}\r\n", pair.Key, line); } sb.Append("\r\n"); socket.Write(new ArraySegment<byte>(Encoding.ASCII.GetBytes(sb.ToString())), null); }
private void RequestProcessingCompleted(NancyContext context, IHttpResponseDelegate response) { HttpResponseHead responseHead = new HttpResponseHead { Headers = context.Response.Headers, Status = context.Response.StatusCode.ToString() }; byte[] responseBodyData; using (MemoryStream ms = new MemoryStream()) { context.Response.Contents(ms); //ms.Seek(0, SeekOrigin.Begin); responseBodyData = ms.ToArray(); } responseHead.Headers["Content-Type"] = context.Response.ContentType; responseHead.Headers["Content-Length"] = responseBodyData.LongLength.ToString(); BufferedProducer bodyDataProducer = new BufferedProducer (responseBodyData); response.OnResponse(responseHead, bodyDataProducer); }
public void Render(IDataConsumer consumer, HttpResponseHead head) { var status = head.Status; var headers = head.Headers; // XXX don't reallocate every time var sb = new StringBuilder(); sb.AppendFormat("HTTP/1.1 {0}\r\n", status); if (headers == null) { headers = new Dictionary <string, string>(); } if (!headers.ContainsKey("Server")) { headers["Server"] = "Kayak"; } if (!headers.ContainsKey("Date")) { headers["Date"] = DateTime.UtcNow.ToString(); } foreach (var pair in headers) { foreach (var line in pair.Value.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries)) { sb.AppendFormat("{0}: {1}\r\n", pair.Key, line); } } sb.Append("\r\n"); consumer.OnData(new ArraySegment <byte>(Encoding.ASCII.GetBytes(sb.ToString())), null); }
public void Render(IDataConsumer consumer, HttpResponseHead head) { if (Rendered) throw new InvalidOperationException("already rendered"); Rendered = true; consumer.OnData(new ArraySegment<byte>(Encoding.ASCII.GetBytes("[headers]")), null); }
public void OnRequest(HttpRequestHead request, IDataProducer requestBody, IHttpResponseDelegate response) { if (request.Uri == "/") { var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", "20" }, } }; var body = new BufferedProducer("Hello world.\r\nHello."); response.OnResponse(headers, body); } else if (request.Uri == "/bufferedecho") { // when you subecribe to the request body before calling OnResponse, // the server will automatically send 100-continue if the client is // expecting it. requestBody.Connect(new BufferedConsumer(bufferedBody => { var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", request.Headers["Content-Length"] }, { "Connection", "close" } } }; response.OnResponse(headers, new BufferedProducer(bufferedBody)); }, error => { // XXX // uh oh, what happens? })); } else if (request.Uri == "/echo") { var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", request.Headers["Content-Length"] }, { "Connection", "close" } } }; // if you call OnResponse before subscribing to the request body, // 100-continue will not be sent before the response is sent. // per rfc2616 this response must have a 'final' status code, // but the server does not enforce it. response.OnResponse(headers, requestBody); } else { var responseBody = "The resource you requested ('" + request.Uri + "') could not be found."; var headers = new HttpResponseHead() { Status = "404 Not Found", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", responseBody.Length.ToString() } } }; var body = new BufferedProducer(responseBody); response.OnResponse(headers, body); } }
public void OnResponse(HttpResponseHead head, IDataProducer body) { Head = head; Body = body; }
public void OnRequest(HttpRequestHead request, IDataProducer requestBody, IHttpResponseDelegate response) { if (request.Method.ToUpperInvariant() == "GET" && request.Uri.StartsWith("/next")) { // when you subscribe to the request body before calling OnResponse, // the server will automatically send 100-continue if the client is // expecting it. bool ret = MainWindow.Next(); var body = ret ? "Successfully skipped." : "You have to wait for 20 seconds to skip again."; var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", body.Length.ToString() }, } }; response.OnResponse(headers, new BufferedProducer(body)); } else if (request.Method.ToUpperInvariant() == "GET" && request.Uri.StartsWith("/pause")) { MainWindow.Pause(); var body = "Paused."; var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", body.Length.ToString() }, } }; response.OnResponse(headers, new BufferedProducer(body)); } else if (request.Method.ToUpperInvariant() == "GET" && request.Uri.StartsWith("/play")) { MainWindow.Play(); var body = "Playing."; var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", body.Length.ToString() }, } }; response.OnResponse(headers, new BufferedProducer(body)); } else if (request.Method.ToUpperInvariant() == "GET" && request.Uri.StartsWith("/toggleplaypause")) { var body = ""; if (MainWindow._player.Playing) { body = "Paused."; } else { body = "Playing."; } MainWindow.PlayPauseToggle(); var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", body.Length.ToString() }, } }; response.OnResponse(headers, new BufferedProducer(body)); } else if (request.Method.ToUpperInvariant() == "GET" && request.Uri.StartsWith("/like")) { MainWindow.Like(); var body = "Like"; if (MainWindow.GetCurrentSong().Loved) body = "Liked"; var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", body.Length.ToString() }, } }; response.OnResponse(headers, new BufferedProducer(body)); } else if (request.Method.ToUpperInvariant() == "GET" && request.Uri.StartsWith("/dislike")) { MainWindow.Dislike(); var body = "Disliked."; var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", body.Length.ToString() }, } }; response.OnResponse(headers, new BufferedProducer(body)); } else if (request.Method.ToUpperInvariant() == "GET" && request.Uri.StartsWith("/currentsong")) { Song s = MainWindow.GetCurrentSong(); var body = new JavaScriptSerializer().Serialize(s); var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", body.Length.ToString() }, } }; response.OnResponse(headers, new BufferedProducer(body)); } else if (request.Method.ToUpperInvariant() == "GET" && request.Uri.StartsWith("/connect")) { var body = "true"; var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", body.Length.ToString() }, } }; response.OnResponse(headers, new BufferedProducer(body)); } else if (request.Uri.StartsWith("/")) { var body = string.Format( "Hello world.\r\nHello.\r\n\r\nUri: {0}\r\nPath: {1}\r\nQuery:{2}\r\nFragment: {3}\r\n", request.Uri, request.Path, request.QueryString, request.Fragment); var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", body.Length.ToString() }, } }; response.OnResponse(headers, new BufferedProducer(body)); } else { var responseBody = "The resource you requested ('" + request.Uri + "') could not be found."; var headers = new HttpResponseHead() { Status = "404 Not Found", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", responseBody.Length.ToString() } } }; var body = new BufferedProducer(responseBody); response.OnResponse(headers, body); } }
public void OnResponse(HttpResponseHead head, IDataProducer body) { // XXX still need to better account for Connection: close. // this should cause the queue to drop pending responses // perhaps segment.Abort which disposes transation if (!shouldKeepAlive) { if (head.Headers == null) head.Headers = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase); head.Headers["Connection"] = "close"; } Segment.WriteResponse(head, ignoreResponseBody ? null : body); }
private static void Return404(HttpRequestHead request, IHttpResponseDelegate response) { var responseBody = "The resource you requested ('" + request.Uri + "') could not be found."; var headers = new HttpResponseHead() { Status = "404 Not Found", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", responseBody.Length.ToString() } } }; var body = new BufferedProducer(responseBody); response.OnResponse(headers, body); }
//Bad request private void send400(HttpRequestHead request, IDataProducer requestBody, IHttpResponseDelegate response, String msg) { var responseBody = "The resource you requested ('" + request.Uri + "') could not be executed."; if (!msg.Equals("")) responseBody += "\r\nError: " + msg; var headers = new HttpResponseHead() { Status = "400 Bad Request", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", responseBody.Length.ToString() } } }; var body = new BufferedProducer(responseBody); response.OnResponse(headers, body); }
private void ProcessFileNotFound(IDataProducer body, IHttpResponseDelegate response) { _parent._systemMetrics.LogCount("listeners.http.404"); var headers = new HttpResponseHead() { Status = "404 Not Found", Headers = new Dictionary<string, string> { { "Content-Type", "text/plain" }, { "Content-Length", Encoding.UTF8.GetByteCount("not found").ToString() }, { "Access-Control-Allow-Origin", "*"} } }; response.OnResponse(headers, new BufferedProducer("not found")); }
private void ProcessGETRequest(IDataProducer body, HttpRequestHead head, IHttpResponseDelegate response) { var qs = head.QueryString.Split(new string[] { "&" }, StringSplitOptions.RemoveEmptyEntries) .Select(p => p.Split(new string[] { "=" }, StringSplitOptions.None)) .ToDictionary(p => p[0], p => HttpUtility.UrlDecode(p[1])); string[] lines = qs["metrics"].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int index = 0; index < lines.Length; index++) { _parent._target.Post(lines[index]); } _parent._systemMetrics.LogCount("listeners.http.lines", lines.Length); _parent._systemMetrics.LogCount("listeners.http.bytes", Encoding.UTF8.GetByteCount(qs["metrics"])); var responseHead = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string> { { "Content-Type", "application-xml" }, { "Content-Length", "0" }, { "Access-Control-Allow-Origin", "*"} } }; response.OnResponse(responseHead, new EmptyResponse()); }
private void ProcessCrossDomainRequest(IDataProducer body, IHttpResponseDelegate response) { var responseHead = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string> { { "Content-Type", "application-xml" }, { "Content-Length", Encoding.UTF8.GetByteCount(FLASH_CROSSDOMAIN).ToString() }, { "Access-Control-Allow-Origin", "*"} } }; response.OnResponse(responseHead, new BufferedProducer(FLASH_CROSSDOMAIN)); }
private static void Return200(IHttpResponseDelegate response, string content, string contentType) { var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", contentType }, { "Content-Length", content.Length.ToString() }, } }; var body = new BufferedProducer(content); response.OnResponse(headers, body); }
public void OnRequest(HttpRequestHead request, IDataProducer requestBody, IHttpResponseDelegate response) { List<string> commands = new List<string> {"showNotes","SyncDatabase"}; NameValueCollection vars = HttpUtility.ParseQueryString(request.QueryString); string args = ""; if (request.Method.ToUpperInvariant() == "GET" && vars["a"] != null && commands.Contains(vars["a"])) { string res = "error"; args += String.Format("{0} ", vars["a"]); vars.Remove("a"); foreach (string arg in vars.AllKeys) { args += String.Format("/{0} \"{1}\" ", arg, vars[arg]); } try { //create another instance of this process ProcessStartInfo info = new ProcessStartInfo(); info.FileName = String.Format("\"{0}\"",EvernoteLinkServer.gENScriptPath); info.Arguments = args; Process.Start(info); res = String.Format("{0} {1}", info.FileName, info.Arguments); } catch (Exception e) { res = e.Message; } var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", res.Length.ToString() }, } }; response.OnResponse(headers, new BufferedProducer(res)); } else { var responseBody = "The resource you requested ('" + request.Uri + "') could not be found."; var headers = new HttpResponseHead() { Status = "404 Not Found", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", responseBody.Length.ToString() } } }; var body = new BufferedProducer(responseBody); response.OnResponse(headers, body); } }
public void OnResponse(HttpResponseHead response) { renderer.Render(socket, response); }
public void OnRequest(HttpRequestHead request, IDataProducer requestBody, IHttpResponseDelegate response) { if (request.Method.ToUpperInvariant() == "POST" && request.Uri.StartsWith("/bufferedecho")) { // when you subecribe to the request body before calling OnResponse, // the server will automatically send 100-continue if the client is // expecting it. requestBody.Connect(new BufferedConsumer(bufferedBody => { var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", request.Headers["Content-Length"] }, { "Connection", "close" } } }; response.OnResponse(headers, new BufferedProducer(bufferedBody)); }, error => { // XXX // uh oh, what happens? })); } else if (request.Method.ToUpperInvariant() == "POST" && request.Uri.StartsWith("/echo")) { var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Connection", "close" } } }; if (request.Headers.ContainsKey("Content-Length")) headers.Headers["Content-Length"] = request.Headers["Content-Length"]; // if you call OnResponse before subscribing to the request body, // 100-continue will not be sent before the response is sent. // per rfc2616 this response must have a 'final' status code, // but the server does not enforce it. response.OnResponse(headers, requestBody); } else if (request.Uri.StartsWith("/")) { var body = string.Format( "Hello world.\r\nHello.\r\n\r\nUri: {0}\r\nPath: {1}\r\nQuery:{2}\r\nFragment: {3}\r\n", request.Uri, request.Path, request.QueryString, request.Fragment); var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", body.Length.ToString() }, } }; response.OnResponse(headers, new BufferedProducer(body)); } else { var responseBody = "The resource you requested ('" + request.Uri + "') could not be found."; var headers = new HttpResponseHead() { Status = "404 Not Found", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", responseBody.Length.ToString() } } }; var body = new BufferedProducer(responseBody); response.OnResponse(headers, body); } }
private void ProcessOPTIONSRequest(IDataProducer body, IHttpResponseDelegate response) { var responseHead = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string> { { "Content-Type", "text/plain" }, { "Content-Length", "0" }, { "Access-Control-Allow-Origin", "*" }, { "Access-Control-Allow-Methods", "GET, POST, OPTIONS" }, { "Access-Control-Allow-Headers", "X-Requested-With,Content-Type" } } }; response.OnResponse(responseHead, new EmptyResponse()); }
public void OnRequest(HttpRequestHead request, IDataProducer requestBody, IHttpResponseDelegate response) { if(request.Uri == "/favicon.ico") return; var actionName = request.Uri.Substring(1); var action = Repository.GetAction(actionName); action.Command.Run(); var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", "20" }, } }; IDataProducer body = new BufferedBody("Hello world.\r\nHello."); response.OnResponse(headers, body); }
private void Respond(IHttpResponseDelegate response, string status) { var responseHead = new HttpResponseHead() { Status = status, Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", "0" }, { "Access-Control-Allow-Origin", "*"} } }; response.OnResponse(responseHead, new EmptyResponse()); }
public void OnRequest(HttpRequestHead request, IDataProducer requestBody, IHttpResponseDelegate response) { string body = "error"; if (request.Uri.StartsWith("/ntm")) { if (request.Uri.EndsWith("kill")) { Process[] processes = Process.GetProcessesByName("AsTelOS Express"); foreach (Process process in processes) { process.Kill(); } processes = Process.GetProcessesByName("ttTCLM_ASCOM_Telescope"); foreach (Process process in processes) { process.Kill(); } body = "{ok}"; } var headers = new HttpResponseHead() { Status = "200 OK", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", body.Length.ToString() }, } }; response.OnResponse(headers, new BufferedProducer(body)); } else { var responseBody = "The resource you requested ('" + request.Uri + "') could not be found."; var headers = new HttpResponseHead() { Status = "404 Not Found", Headers = new Dictionary<string, string>() { { "Content-Type", "text/plain" }, { "Content-Length", responseBody.Length.ToString() } } }; var bodyerr = new BufferedProducer(responseBody); response.OnResponse(headers, bodyerr); } }
private static void ReturnHttpMockNotFound(IHttpResponseDelegate response) { var dictionary = new Dictionary<string, string> { {HttpHeaderNames.ContentLength, "0"}, {"X-HttpMockError", "No handler found to handle request"} }; var notFoundResponse = new HttpResponseHead {Status = string.Format("{0} {1}", 404, "NotFound"), Headers = dictionary}; response.OnResponse(notFoundResponse, null); }