Skip to content
This repository has been archived by the owner on Apr 19, 2019. It is now read-only.

Commit

Permalink
[split] fix compile errors in README.md examples * add .name("myServi…
Browse files Browse the repository at this point in the history
…ce") to use of ServerBuilder * replace .codec(Http) with .codec(Http.get()) in use of ServerBuilder and ClientBuilder Github-pull-request: twitter#109

Signed-off-by: Steve Gury <stevegury@twitter.com>

RB_ID=86675
  • Loading branch information
earldouglas authored and stevegury committed Sep 24, 2012
1 parent 38e4092 commit 8f8c163
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions README.md
Expand Up @@ -84,8 +84,8 @@ The following server, which is shown in both Scala and Java, responds to a clien

val address: SocketAddress = new InetSocketAddress(10000) // 3

val server: Server[HttpRequest, HttpResponse] = ServerBuilder() // 4
.codec(Http)
val server: Server = ServerBuilder() // 4
.codec(Http())
.bindTo(address)
.name("HttpServer")
.build(service)
Expand All @@ -100,7 +100,7 @@ The following server, which is shown in both Scala and Java, responds to a clien
};

ServerBuilder.safeBuild(service, ServerBuilder.get() // 4
.codec(Http.get())
.codec(Http())
.name("HttpServer")
.bindTo(new InetSocketAddress("localhost", 10000))); // 3

Expand Down Expand Up @@ -129,7 +129,7 @@ The client, which is shown in both Scala and Java, connects to the server, and i
##### Scala HTTP Client Implementation

val client: Service[HttpRequest, HttpResponse] = ClientBuilder() // 1
.codec(Http)
.codec(Http())
.hosts(address)
.hostConnectionLimit(1)
.build()
Expand All @@ -143,7 +143,7 @@ The client, which is shown in both Scala and Java, connects to the server, and i
##### Java HTTP Client Implementation

Service<HttpRequest, HttpResponse> client = ClientBuilder.safeBuild(ClientBuilder.get() // 1
.codec(Http.get())
.codec(Http())
.hosts("localhost:10000")
.hostConnectionLimit(1));

Expand Down Expand Up @@ -1044,7 +1044,8 @@ The following example encapsulates the filters and service in the previous examp
= handleExceptions andThen authorize andThen respond

val server: Server = ServerBuilder()
.codec(Http)
.name("myService")
.codec(Http())
.bindTo(new InetSocketAddress(8080))
.build(myService)
}
Expand All @@ -1061,7 +1062,7 @@ In this example, the `HandleExceptions` filter is executed before the `authorize
A robust client has little to do with the lines of code (SLOC) that goes into it; rather, the robustness depends on how you configure the client and the testing you put into it. Consider the following HTTP client:

val client = ClientBuilder()
.codec(Http)
.codec(Http())
.hosts("localhost:10000,localhost:10001,localhost:10003")
.hostConnectionLimit(1) // max number of connections at a time to a host
.connectionTimeout(1.second) // max time to spend establishing a TCP connection
Expand Down Expand Up @@ -1337,7 +1338,7 @@ The following example shows the instantiation and invocation of the server. Call
public static void main(String[] args) {
ServerBuilder.safeBuild(new HTTPServer(),
ServerBuilder.get()
.codec(Http.get())
.codec(Http())
.name("HTTPServer")
.bindTo(new InetSocketAddress("localhost", 8080)));

Expand Down Expand Up @@ -1399,7 +1400,7 @@ The following example shows the instantiation and invocation of a client. Callin
Service<HttpRequest, HttpResponse> httpClient =
ClientBuilder.safeBuild(
ClientBuilder.get()
.codec(Http.get())
.codec(Http())
.hosts(new InetSocketAddress(8080))
.hostConnectionLimit(1));

Expand Down

0 comments on commit 8f8c163

Please sign in to comment.