Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
319 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
206 changes: 206 additions & 0 deletions
206
src/main/java/io/vertx/core/http/impl/HttpClientRequestPushPromise.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,206 @@ | |||
/* | |||
* Copyright (c) 2011-2013 The original author or authors | |||
* ------------------------------------------------------ | |||
* All rights reserved. This program and the accompanying materials | |||
* are made available under the terms of the Eclipse Public License v1.0 | |||
* and Apache License v2.0 which accompanies this distribution. | |||
* | |||
* The Eclipse Public License is available at | |||
* http://www.eclipse.org/legal/epl-v10.html | |||
* | |||
* The Apache License v2.0 is available at | |||
* http://www.opensource.org/licenses/apache2.0.php | |||
* | |||
* You may elect to redistribute this code under either of these licenses. | |||
*/ | |||
|
|||
package io.vertx.core.http.impl; | |||
|
|||
import io.vertx.codegen.annotations.Nullable; | |||
import io.vertx.core.Handler; | |||
import io.vertx.core.MultiMap; | |||
import io.vertx.core.buffer.Buffer; | |||
import io.vertx.core.http.HttpClientRequest; | |||
import io.vertx.core.http.HttpClientResponse; | |||
import io.vertx.core.http.HttpMethod; | |||
|
|||
/** | |||
* @author <a href="mailto:julien@julienviet.com">Julien Viet</a> | |||
*/ | |||
class HttpClientRequestPushPromise extends HttpClientRequestBase { | |||
|
|||
private final HttpMethod method; | |||
private final String uri; | |||
private final String host; | |||
private final MultiMap headers; | |||
private Handler<HttpClientResponse> respHandler; | |||
|
|||
public HttpClientRequestPushPromise(HttpClientImpl client, HttpMethod method, String uri, String host, MultiMap headers) { | |||
super(client); | |||
this.method = method; | |||
this.uri = uri; | |||
this.host = host; | |||
this.headers = headers; | |||
} | |||
|
|||
@Override | |||
protected Object getLock() { | |||
return this; // | |||
} | |||
|
|||
@Override | |||
protected void doHandleResponse(HttpClientResponseImpl resp) { | |||
synchronized (getLock()) { | |||
if (respHandler != null) { | |||
respHandler.handle(resp); | |||
} | |||
} | |||
} | |||
|
|||
@Override | |||
protected void checkComplete() { | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest handler(Handler<HttpClientResponse> handler) { | |||
synchronized (getLock()) { | |||
respHandler = handler; | |||
return this; | |||
} | |||
} | |||
|
|||
@Override | |||
public boolean isChunked() { | |||
return false; | |||
} | |||
|
|||
@Override | |||
public HttpMethod method() { | |||
return method; | |||
} | |||
|
|||
@Override | |||
public String uri() { | |||
return uri; | |||
} | |||
|
|||
@Override | |||
public String getHost() { | |||
return host; | |||
} | |||
|
|||
@Override | |||
public MultiMap headers() { | |||
return headers; | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest write(Buffer data) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest setWriteQueueMaxSize(int maxSize) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest drainHandler(Handler<Void> handler) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest pause() { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest resume() { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest endHandler(Handler<Void> endHandler) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest setChunked(boolean chunked) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest setHost(String host) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest putHeader(String name, String value) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest putHeader(CharSequence name, CharSequence value) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest putHeader(String name, Iterable<String> values) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest putHeader(CharSequence name, Iterable<CharSequence> values) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest write(String chunk) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest write(String chunk, String enc) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest continueHandler(@Nullable Handler<Void> handler) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest sendHead() { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public void end(String chunk) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public void end(String chunk, String enc) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public void end(Buffer chunk) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public HttpClientRequest pushPromiseHandler(Handler<HttpClientRequest> handler) { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public void end() { | |||
throw new IllegalStateException(); | |||
} | |||
|
|||
@Override | |||
public boolean writeQueueFull() { | |||
throw new IllegalStateException(); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.