Skip to content

Commit

Permalink
Bump to the latest Grizzly version, remove the hack as this has been …
Browse files Browse the repository at this point in the history
…fixed in grizzly
  • Loading branch information
jfarcand committed Jul 18, 2010
1 parent ad004f3 commit 02e26ec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 45 deletions.
Expand Up @@ -66,9 +66,7 @@
* @author Jeanfrancois Arcand
*/
public class GlassFishWebSocketSupport extends GrizzlyCometSupport {

private String atmosphereCtx = "";


private final GrizzlyApplication grizzlyApplication = new GrizzlyApplication();

public GlassFishWebSocketSupport(AtmosphereConfig config) {
Expand All @@ -83,7 +81,7 @@ public Action service(HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException {

String connection = req.getHeader("Connection");
if (connection == null || !connection.equalsIgnoreCase("Upgrade")) {
if (!"Upgrade".equalsIgnoreCase(connection)) {
return super.service(req, res);
} else {
Action action = suspended(req, res);
Expand Down Expand Up @@ -115,18 +113,13 @@ public class GrizzlyApplication extends WebSocketApplication {

private WebSocketProcessor webSocketProcessor;

@Override
public WebSocket createSocket(final Request request, final Response response) throws IOException {
return new AtmoWebSocket(this, request, response);
}

public void onConnect(WebSocket w) {

if (!AtmoWebSocket.class.isAssignableFrom(w.getClass())) {
if (!BaseServerWebSocket.class.isAssignableFrom(w.getClass())) {
throw new IllegalStateException();
}

AtmoWebSocket webSocket = AtmoWebSocket.class.cast(w);
BaseServerWebSocket webSocket = BaseServerWebSocket.class.cast(w);
webSocketProcessor = new WebSocketProcessor(config.getServlet(), new GrizzlyWebSocketSupport(webSocket));
try {
webSocketProcessor.connect(webSocket.getRequest());
Expand All @@ -149,38 +142,6 @@ public boolean supportWebSocket(){
return true;
}

/**
* Hack Grizzly internal to uniform websocket support in Atmosphere.
*/
private class AtmoWebSocket extends BaseServerWebSocket {

private Request coyoteRequest;

public AtmoWebSocket(WebSocketListener listener, final Request request, final Response response) {
super(listener, request, response);
coyoteRequest = request;
}

public HttpServletRequest getRequest() throws IOException {
GrizzlyRequest r = new GrizzlyRequest();
r.setRequest(coyoteRequest);
AtmoRequest h = new AtmoRequest(r);
h.contextImpl();
return h;
}

class AtmoRequest extends HttpServletRequestImpl {

public AtmoRequest(GrizzlyRequest request) throws IOException {
super(request);
}

public void contextImpl() {
setContextImpl(new ServletContextImpl());
}
}
}

public class GrizzlyWebSocketSupport implements WebSocketSupport {

private final WebSocket webSocket;
Expand Down
Expand Up @@ -498,7 +498,7 @@ public Object call() throws Exception {
return f;
}

/**
/** Meteor
* {@inheritDoc}
*/
public Future<?> scheduleFixedBroadcast(final Object o, long period, TimeUnit t) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -438,7 +438,7 @@
<maven-plugin.version>1.0.0</maven-plugin.version>
<servlet-version>3.0-b73</servlet-version>
<bayeux-version>1.1.0</bayeux-version>
<grizzly-version>1.9.19-beta5</grizzly-version>
<grizzly-version>1.9.19-beta6</grizzly-version>
<jboss-version>2.1.1.GA</jboss-version>
<grizzly10-version>1.0.31</grizzly10-version>
<jetty7-version>7.1.1.v20100517</jetty7-version>
Expand Down

0 comments on commit 02e26ec

Please sign in to comment.