| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package main | 5 package main |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 "log" | 9 "log" |
| 10 | 10 |
| 11 "mojo/public/go/application" | 11 "mojo/public/go/application" |
| 12 "mojo/public/go/bindings" | 12 "mojo/public/go/bindings" |
| 13 "mojo/public/go/system" | 13 "mojo/public/go/system" |
| 14 | 14 |
| 15 » "mojo/services/http_server/public/interfaces/http_request" | 15 » "mojo/services/http_server/interfaces/http_request" |
| 16 » "mojo/services/http_server/public/interfaces/http_response" | 16 » "mojo/services/http_server/interfaces/http_response" |
| 17 » "mojo/services/http_server/public/interfaces/http_server" | 17 » "mojo/services/http_server/interfaces/http_server" |
| 18 » "mojo/services/http_server/public/interfaces/http_server_factory" | 18 » "mojo/services/http_server/interfaces/http_server_factory" |
| 19 "mojo/services/network/public/interfaces/net_address" | 19 "mojo/services/network/public/interfaces/net_address" |
| 20 ) | 20 ) |
| 21 | 21 |
| 22 //#include "mojo/public/c/system/types.h" | 22 //#include "mojo/public/c/system/types.h" |
| 23 import "C" | 23 import "C" |
| 24 | 24 |
| 25 type HttpHandler struct{} | 25 type HttpHandler struct{} |
| 26 | 26 |
| 27 func (h *HttpHandler) HandleRequest(request http_request.HttpRequest) (http_resp
onse.HttpResponse, error) { | 27 func (h *HttpHandler) HandleRequest(request http_request.HttpRequest) (http_resp
onse.HttpResponse, error) { |
| 28 resp := "Hello, Go http handler!" | 28 resp := "Hello, Go http handler!" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 96 } |
| 97 | 97 |
| 98 //export MojoMain | 98 //export MojoMain |
| 99 func MojoMain(handle C.MojoHandle) C.MojoResult { | 99 func MojoMain(handle C.MojoHandle) C.MojoResult { |
| 100 application.Run(&HttpHandlerDelegate{}, system.MojoHandle(handle)) | 100 application.Run(&HttpHandlerDelegate{}, system.MojoHandle(handle)) |
| 101 return C.MOJO_RESULT_OK | 101 return C.MOJO_RESULT_OK |
| 102 } | 102 } |
| 103 | 103 |
| 104 func main() { | 104 func main() { |
| 105 } | 105 } |
| OLD | NEW |