package com.yeshi.buwan.controller.api; import java.io.PrintWriter; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.yeshi.buwan.util.OSSManager; @Controller @RequestMapping("/upload/img") public class ImageController { @RequestMapping(value = "/{path}", method = RequestMethod.GET) public String ad(@PathVariable String path, HttpServletRequest request, PrintWriter out) { return "redirect:" + OSSManager.getInstance().getUrl(path + ".jpg"); } }