Created
July 3, 2013 14:18
-
-
Save awartoft/5918275 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package com.cyant.chat.protocol.listener; | |
import com.cyant.chat.modal.Customer; | |
import com.cyant.chat.modal.customer.Activity; | |
import com.fasterxml.jackson.databind.JsonNode; | |
import org.atmosphere.cpr.AtmosphereRequest; | |
import org.atmosphere.cpr.AtmosphereResource; | |
import org.atmosphere.cpr.AtmosphereResourceEvent; | |
import org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import java.util.Date; | |
public class CustomerActivity extends AtmosphereResourceEventListenerAdapter | |
{ | |
private final Logger logger = LoggerFactory.getLogger(CustomerActivity.class); | |
@Override | |
public void onSuspend(AtmosphereResourceEvent atmosphereResourceEvent) | |
{ | |
AtmosphereRequest request = atmosphereResourceEvent.getResource().getRequest(); | |
// parse url | |
String url = request.getHeader("Origin").concat(request.getPathInfo()); | |
Activity activity = new Activity(url); | |
atmosphereResourceEvent.getResource().session().setAttribute("activity", activity); | |
} | |
@Override | |
public void onDisconnect(AtmosphereResourceEvent atmosphereResourceEvent) | |
{ | |
throw new NullPointerException(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment