org.atmosphere.guice
Class AtmosphereGuiceServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.eclipse.jetty.websocket.WebSocketServlet
              extended by weblogic.servlet.http.AbstractAsyncServlet
                  extended by org.atmosphere.cpr.AtmosphereServlet
                      extended by org.atmosphere.guice.AtmosphereGuiceServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, CometProcessor, ServletContextProvider, WebSocketFactory.Acceptor, HttpEventServlet
Direct Known Subclasses:
GuiceManagedAtmosphereServlet

public class AtmosphereGuiceServlet
extends AtmosphereServlet

Google Guice Integration. To use it, just do in web.xml:

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:j2ee = "http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <listener> <listener-class>org.atmosphere.samples.guice.GuiceChatConfig</listener-class> </listener> <description>Atmosphere Chat</description> <display-name>Atmosphere Chat</display-name> <servlet> <description>AtmosphereServlet</description> <servlet-name>AtmosphereServlet</servlet-name> <servlet-class>org.atmosphere.guice.AtmosphereGuiceServlet</servlet-class> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>AtmosphereServlet</servlet-name> <url-pattern>/chat/*</url-pattern> </servlet-mapping> </web-app>

and then

public class GuiceConfig extends GuiceServletContextListener {

Author:
Jeanfrancois Arcand, Richard Wallace
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.atmosphere.cpr.AtmosphereServlet
AtmosphereServlet.Action, AtmosphereServlet.AtmosphereConfig, AtmosphereServlet.AtmosphereHandlerWrapper
 
Field Summary
static String JERSEY_PROPERTIES
           
protected static String SKIP_GUICE_FILTER
           
 
Fields inherited from class org.atmosphere.cpr.AtmosphereServlet
atmosphereHandlers, broadcasterCacheClassName, broadcasterClassName, broadcasterFactoryClassName, broadcasterFilters, cometSupport, config, isBroadcasterSpecified, isCometSupportConfigured, isCometSupportSpecified, isFilter, isSessionSupportSpecified, useBlockingImplementation, useNativeImplementation, useStreamForFlushingComments
 
Constructor Summary
AtmosphereGuiceServlet()
           
 
Method Summary
protected  boolean detectSupportedFramework(javax.servlet.ServletConfig sc)
          Auto-detect Jersey when no atmosphere.xml file are specified.
protected  void loadConfiguration(javax.servlet.ServletConfig sc)
          Install Guice event if other extension has been already installed.
 
Methods inherited from class org.atmosphere.cpr.AtmosphereServlet
addAtmosphereHandler, addAtmosphereHandler, addAtmosphereHandler, addBroadcasterType, addInitParameter, autoDetectAtmosphereHandlers, autoDetectContainer, configureBroadcaster, configureQueryStringAsRequest, configureWebDotXmlAtmosphereHandler, createCometSupportResolver, destroy, doCometSupport, doDelete, doGet, doHead, doInitParams, doInitParamsForWebSocket, doOptions, doPost, doPut, doRequest, doResponse, doTimeout, doTrace, doWebSocketConnect, event, event, event, getAtmosphereConfig, getBroadcasterCacheClassName, getBroadcasterFactory, getCometSupport, getDefaultBroadcasterClassName, getWebSocketProtocol, getWebSocketProtocolClassName, init, initWebSocketProtocol, isIECandidate, isUseStreamForFlushingComments, loadAtmosphereDotXml, loadAtmosphereHandlersFromPath, lookupDefaultBroadcasterType, readSystemProperties, removeAllAtmosphereHandler, removeAllInitParams, removeAtmosphereHandler, sessionSupport, setBroadcasterCacheClassName, setBroadcasterFactory, setCometSupport, setDefaultBroadcasterClassName, setUseStreamForFlushingComments, setWebSocketProtocolClassName
 
Methods inherited from class weblogic.servlet.http.AbstractAsyncServlet
notify
 
Methods inherited from class org.eclipse.jetty.websocket.WebSocketServlet
checkOrigin, init, service
 
Methods inherited from class javax.servlet.http.HttpServlet
getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.atmosphere.di.ServletContextProvider
getServletContext
 
Methods inherited from interface javax.servlet.Servlet
getServletConfig, getServletInfo, service
 

Field Detail

JERSEY_PROPERTIES

public static final String JERSEY_PROPERTIES

SKIP_GUICE_FILTER

protected static final String SKIP_GUICE_FILTER
See Also:
Constant Field Values
Constructor Detail

AtmosphereGuiceServlet

public AtmosphereGuiceServlet()
Method Detail

loadConfiguration

protected void loadConfiguration(javax.servlet.ServletConfig sc)
                          throws javax.servlet.ServletException
Install Guice event if other extension has been already installed.

Overrides:
loadConfiguration in class AtmosphereServlet
Parameters:
sc - ServletConfig
Throws:
javax.servlet.ServletException

detectSupportedFramework

protected boolean detectSupportedFramework(javax.servlet.ServletConfig sc)
Auto-detect Jersey when no atmosphere.xml file are specified.

Overrides:
detectSupportedFramework in class AtmosphereServlet
Parameters:
sc - ServletConfig
Returns:
true if Jersey classes are detected


Copyright © 2011. All Rights Reserved.