removed atmosphere from project

This commit is contained in:
Lucas Pleß 2012-03-12 00:18:20 +01:00
parent dfba009524
commit 68b44c76a8
6 changed files with 16 additions and 199 deletions

64
pom.xml
View File

@ -8,10 +8,8 @@
<properties>
<org.springframework.version>3.1.0.RELEASE</org.springframework.version>
<!--<jettyVersion>7.2.0.v20101020</jettyVersion>-->
<jettyVersion>8.1.0.RC4</jettyVersion>
<jettyVersion>7.2.0.v20101020</jettyVersion>
<org.slf4j.version>1.6.4</org.slf4j.version>
<atmosphere.version>0.9-SNAPSHOT</atmosphere.version>
</properties>
<repositories>
@ -119,40 +117,6 @@
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>${atmosphere.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-ping</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-compat-jetty</artifactId>
<version>${atmosphere.version}</version>
</dependency>
<!--<dependency>-->
<!--<groupId>javax.inject</groupId>-->
<!--<artifactId>javax.inject</artifactId>-->
<!--<version>1</version>-->
<!--<scope>compile</scope>-->
<!--</dependency>-->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.9</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@ -179,19 +143,19 @@
<version>2.3.2</version>
</plugin>
<!--<plugin>-->
<!--<groupId>org.apache.maven.plugins</groupId>-->
<!--<artifactId>maven-dependency-plugin</artifactId>-->
<!--<executions>-->
<!--<execution>-->
<!--<id>install</id>-->
<!--<phase>install</phase>-->
<!--<goals>-->
<!--<goal>sources</goal>-->
<!--</goals>-->
<!--</execution>-->
<!--</executions>-->
<!--</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>

View File

@ -1,30 +0,0 @@
/**
*
*/
package de.ctdo.bunti.websocket;
import javax.servlet.http.HttpServletRequest;
import org.atmosphere.cpr.AtmosphereResource;
import org.springframework.core.MethodParameter;
import org.springframework.web.bind.support.WebArgumentResolver;
import org.springframework.web.context.request.NativeWebRequest;
public class AtmosphereResourceArgumentResolver implements WebArgumentResolver {
/* (non-Javadoc)
* @see org.springframework.web.bind.support.WebArgumentResolver#resolveArgument(org.springframework.core.MethodParameter, org.springframework.web.context.request.NativeWebRequest)
*/
@Override
public Object resolveArgument(MethodParameter methodParameter, NativeWebRequest webRequest) throws Exception {
if (AtmosphereResource.class.isAssignableFrom(methodParameter.getParameterType())) {
return AtmosphereUtils.getAtmosphereResource(webRequest.getNativeRequest(HttpServletRequest.class));
} else {
return WebArgumentResolver.UNRESOLVED;
}
}
}

View File

@ -1,25 +0,0 @@
package de.ctdo.bunti.websocket;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.atmosphere.cpr.AtmosphereResource;
import org.atmosphere.cpr.AtmosphereServlet;
import org.springframework.util.Assert;
public final class AtmosphereUtils {
public static AtmosphereResource<HttpServletRequest, HttpServletResponse> getAtmosphereResource(
HttpServletRequest request) {
AtmosphereResource<HttpServletRequest, HttpServletResponse> resource =
(AtmosphereResource<HttpServletRequest, HttpServletResponse>) request.getAttribute(AtmosphereServlet.ATMOSPHERE_RESOURCE);
Assert.notNull(resource,"AtmosphereResource could not be located for the request. Check that AtmosphereServlet is configured correctly in web.xml");
return resource;
}
}

View File

@ -1,57 +0,0 @@
package de.ctdo.bunti.websocket;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.atmosphere.cpr.AtmosphereResource;
import org.atmosphere.cpr.Broadcaster;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class WebSocketController {
private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketController.class);
@RequestMapping(value="/buntisocket", method=RequestMethod.GET)
@ResponseBody
public void websockets(final AtmosphereResource<HttpServletRequest,HttpServletResponse> event) {
final HttpServletRequest req = event.getRequest();
// final HttpServletResponse res = event.getResponse();
LOGGER.debug("call to websockets " + req.toString());
final ObjectMapper mapper = new ObjectMapper();
event.suspend();
final Broadcaster bc = event.getBroadcaster();
bc.scheduleFixedBroadcast(new Callable<String>() {
private long sinceId = 0;
@Override
public String call() throws Exception {
LOGGER.debug("call was called");
return mapper.writeValueAsString("blafaselblubb");
}
}, 10, TimeUnit.SECONDS);
}
}

View File

@ -10,13 +10,7 @@
<context:component-scan base-package="de.ctdo.bunti.web*"/>
<!-- Configures the @Controller programming model -->
<mvc:annotation-driven>
<mvc:argument-resolvers>
<bean class="de.ctdo.bunti.websocket.AtmosphereResourceArgumentResolver" />
</mvc:argument-resolvers>
</mvc:annotation-driven>
<mvc:annotation-driven/>
<!-- Forwards requests to the "/" resource to the "welcome" view -->
<mvc:view-controller path="/" view-name="index"/>
@ -24,7 +18,6 @@
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources/ directory -->
<mvc:resources mapping="/resources/**" location="/resources/" />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />

View File

@ -35,35 +35,7 @@
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.atmosphere.cpr.MeteorServlet</servlet-class>
<init-param>
<param-name>org.atmosphere.servlet</param-name>
<param-value>org.springframework.web.servlet.DispatcherServlet</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.cpr.broadcasterClass</param-name>
<param-value>org.atmosphere.cpr.DefaultBroadcaster</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.cpr.broadcastFilterClasses</param-name>
<param-value>org.atmosphere.client.JavascriptClientFilter</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.cpr.CometSupport.maxInactiveActivity</param-name>
<param-value>30</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.useStream</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.useWebSocket</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.useNative</param-name>
<param-value>true</param-value>
</init-param>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/META-INF/spring/mvc/servlet-context.xml</param-value>