org.atmosphere.samples.pubsub.spring
Class PubSubController

java.lang.Object
  extended by org.atmosphere.samples.pubsub.spring.PubSubController

@Controller
@RequestMapping(value="/")
public class PubSubController
extends Object

Example shows a simple Spring Controller that replicates the logic from AtmosphereHandlerPubSub.java URL to access is: http://localhost:8080/Atmosphere-pubsub-spring-tiles/pubsub/

Author:
westraj

Constructor Summary
PubSubController()
           
 
Method Summary
 org.springframework.web.servlet.ModelAndView broadcastMessage(javax.servlet.http.HttpServletRequest request)
          Takes a request to post data and broadcasts it to everyone else.
 String loadPage()
          Handles the main page load
 org.springframework.web.servlet.ModelAndView subscribe(javax.servlet.http.HttpServletRequest request)
          This method takes a request to subscribe to the topic
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PubSubController

public PubSubController()
Method Detail

loadPage

@RequestMapping(produces="text/html")
public String loadPage()
Handles the main page load

Parameters:
request -
response -
Returns:
ModelAndView

subscribe

@RequestMapping(value="{topic}",
                method=GET)
public org.springframework.web.servlet.ModelAndView subscribe(javax.servlet.http.HttpServletRequest request)
                                                       throws Exception
This method takes a request to subscribe to the topic

Parameters:
request -
Returns:
ModelAndView
Throws:
Exception

broadcastMessage

@RequestMapping(value="{topic}",
                method=POST)
public org.springframework.web.servlet.ModelAndView broadcastMessage(javax.servlet.http.HttpServletRequest request)
                                                              throws Exception
Takes a request to post data and broadcasts it to everyone else.

Parameters:
request -
Returns:
String
Throws:
Exception


Copyright © 2013. All Rights Reserved.