val clientOptions =
HttpClientOptions()
.setDefaultHost("$BUCKET.s3.amazonaws.com")
.setMaxPoolSize(1000)
val client = vertx.createHttpClient(clientOptions)
val serverOptions =
HttpServerOptions()
.setAcceptBacklog(1000)
vertx.createHttpServer(serverOptions)
.requestHandler { request ->
val path = request.path()
when (request.method()) {
HttpMethod.GET -> {
client.get(path) { s3Response ->
if (s3Response.statusCode() != 200)
request.response().setStatusCode(s3Response.statusCode()).end()
else {
val response =
request.response()
.putHeader(LENGTH_HEADER, s3Response.getHeader(LENGTH_HEADER))
val pump = Pump.pump(s3Response, response)
s3Response.endHandler { response.end() }
pump.start()
}
}
.putHeader("Date", "...") // put required headers
.end()
}
else ->
request.response().setStatusCode(400).end("Unsupported HTTP verb")
}
}
.listen(8080) { result ->
if (result.succeeded())
future.complete()
else
future.fail(result.cause())
}
--
You received this message because you are subscribed to a topic in the Google Groups "vert.x" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vertx/77_JUc3mEuY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/9c2ae20a-ff39-4b04-a9f3-548a7bc97706%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/089aec15-14ec-45a0-a2bf-301c6d7abc2d%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "vert.x" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vertx/77_JUc3mEuY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/etPan.566f445a.4516dde9.10e%40juliens-mbp-2.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/d7f9f8e5-0abc-4379-8b29-8c7012e73203%40googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/7cbb7f4b-afe9-45b7-b630-c2cd9a1af9f4%40googlegroups.com.