Package org.auto.comet.example.chat.web.controller

Source Code of org.auto.comet.example.chat.web.controller.ChatController

package org.auto.comet.example.chat.web.controller;

import org.auto.comet.example.chat.service.IChatService;
import org.auto.comet.example.chat.web.view.ResourceModelAndView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
* @author XiaohangHu
* */
@Controller
@RequestMapping("/chat.do")
public class ChatController {

  @Autowired
  private IChatService chatService;

  @RequestMapping(params = "method=sendMessage")
  public ModelAndView sendMessage(String userId, String targetUserId,
      String message) {
    this.chatService.sendMessage(userId, targetUserId, message);
    ModelMap modelMap = new ModelMap();
    modelMap.addAttribute("success", "true");
    return new ResourceModelAndView(modelMap);
  }

}
TOP

Related Classes of org.auto.comet.example.chat.web.controller.ChatController

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.