Skip to content

Commit

Permalink
More fix for #220 [runtime] Allow WebSocketProtocol to dispatch async…
Browse files Browse the repository at this point in the history
…hronously
  • Loading branch information
jfarcand committed Mar 12, 2012
1 parent 3d9fe4f commit ba7d4af
Showing 1 changed file with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,32 +337,40 @@ public HttpSession getSession(boolean create) {

@Override
public String getRemoteAddr() {
return b.remoteAddr;
return b.request != null ? b.request.getRemoteAddr() : b.remoteAddr;
}

@Override
public String getRemoteHost() {
return b.remoteHost;
return b.request != null ? b.request.getRemoteHost() : b.remoteHost;
}

@Override
public int getRemotePort() {
return b.remotePort;
return b.request != null ? b.request.getRemotePort() : b.remotePort;
}

@Override
public String getLocalName() {
return b.localName;
return b.request != null ? b.request.getLocalName() : b.localName;
}

@Override
public int getLocalPort() {
return b.localPort;
return b.request != null ? b.request.getLocalPort() : b.localPort;
}

@Override
public String getLocalAddr() {
return b.localAddr;
return b.request != null ? b.request.getLocalAddr() : b.localAddr;
}

/**
* Dispatch the request asynchronously to container. The default is false.
* @return true to dispatch asynchronously the request to container.
*/
public boolean dispatchRequestAsynchronously(){
return b.dispatchRequestAsynchronously;
}

/**
Expand Down Expand Up @@ -433,6 +441,7 @@ public final static class Builder {
private String localAddr = "";
private String localName = "";
private int localPort = 0;
private boolean dispatchRequestAsynchronously;

public Builder() {
}
Expand All @@ -442,6 +451,11 @@ public Builder headers(Map<String, String> headers) {
return this;
}

public Builder dispatchRequestAsynchronously(boolean dispatchRequestAsynchronously) {
this.dispatchRequestAsynchronously = dispatchRequestAsynchronously;
return this;
}

public Builder remoteAddr(String remoteAddr) {
this.remoteAddr = remoteAddr;
return this;
Expand Down

0 comments on commit ba7d4af

Please sign in to comment.