package com.cab.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cab.service.CabBannerServiceImpl;

@Controller
@RequestMapping(value="cabBanner")
public class CaiBannerController {
	private static final Logger logger = Logger.getLogger(CaiBannerController.class);
	@Autowired
	public CabBannerServiceImpl cabBannerSerivce;
	
	//得到所有接口
	@RequestMapping(value="/getAll")
	@ResponseBody//结果不会被解析为跳转路径，而是直接写入HTTP response body中
	public void getAll(HttpServletResponse response,HttpServletRequest request) {
		try {
			System.out.println("test--------------");
			response.setCharacterEncoding("UTF-8");
			response.setContentType("text/html");
			String result = cabBannerSerivce.getAll();
		    response.getWriter().write(result);
		} catch (Exception e) {
			// TODO: handle exception
			logger.error(e);
		}
	}
}
