springmvc中应用通用入口路由匹配

package com.dstech.dssp.httpclient.control;


import com.dstech.dssp.base.user.User;
import com.dstech.dssp.control.WebUser;
import com.dstech.dssp.httpclient.service.HttpClientService;
import com.dstech.dssp.web.util.UserUtil;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@RequestMapping({"/rest"})
public class HttpClientControl extends AbstractHttpClientControl
{


  @Value("${restUrl}")
  private String restUrl;


  @Value("${webSecurity:false}")
  private boolean security;


  @Autowired
  private HttpClientService httpClientService;


  @RequestMapping(value={"/{busiComp}/{serviceName}/id/{id}"}, method={org.springframework.web.bind.annotation.RequestMethod.DELETE})
  public void delete(@PathVariable String busiComp, @PathVariable String serviceName, @PathVariable String id, HttpServletRequest request, HttpServletResponse response)
    throws Exception
  {
    doService(request, response, null);
  }


  @RequestMapping(value={"/{busiComp}/codeList/{codeName}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
  public void getCodeList(@PathVariable String busiComp, @PathVariable String codeName, @RequestParam(required=false, defaultValue="false") boolean refresh, HttpServletRequest request, HttpServletResponse response, @RequestParam(required=false, defaultValue="") String dsspUserId)
    throws Exception
  {
    doService(request, response, null);
  }


  @RequestMapping(value={"/{busiComp}/codeList/{codeItem}/{codeName}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
  public void getCodeList(@PathVariable String busiComp, @PathVariable String codeItem, @PathVariable String codeName, @RequestParam(required=false, defaultValue="false") boolean refresh, HttpServletRequest request, HttpServletResponse response)
    throws Exception
  {
    doService(request, response, null);
  }


  @RequestMapping(value={"/{busiComp}/{service}/{operate}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
  public void getCommonDeal(@PathVariable String busiComp, @PathVariable String service, @PathVariable String operate, HttpServletRequest request, HttpServletResponse response)
    throws Exception
  {
    doService(request, response, null);
  }


  public HttpClientService getHttpClientService()
  {
    return this.httpClientService;
  }


  public String getRestUrl()
  {
    return this.restUrl;
  }


  @RequestMapping(value={"/{busiComp}/tree/{treeName}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
  public void getTreeNodeList(@PathVariable String busiComp, @PathVariable String treeName, @RequestParam(required=false) String id, @RequestParam(required=false, defaultValue="") String viewName, @RequestParam(required=false) String defaultId, @RequestParam(required=false, defaultValue="false") boolean allData, HttpServletRequest request, HttpServletResponse response, @RequestParam(required=false, defaultValue="") String dsspUserId)
    throws Exception
  {
    doService(request, response, null);
  }


  public User getUser(HttpServletRequest request)
  {
    return UserUtil.getUser(request);
  }
  @RequestMapping(value={"/user"}, method={org.springframework.web.bind.annotation.RequestMethod.GET}, produces={"application/json; charset=UTF-8"})
  @ResponseBody
  public User getWebUser(HttpServletRequest request) {
    User user = UserUtil.getUser(request);
    if ((user != null) && ((user instanceof WebUser))) {
      user = ((WebUser)user).getUser();
    }
    return user;
  }


  public boolean isSecurity()
  {
    return this.security;
  }


  @RequestMapping(value={"/{busiComp}/{service}/{operate}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST, org.springframework.web.bind.annotation.RequestMethod.PUT, org.springframework.web.bind.annotation.RequestMethod.DELETE})
  public void postCommonDeal(@PathVariable String busiComp, @PathVariable String service, @PathVariable String operate, HttpServletRequest request, HttpServletResponse response)
    throws Exception
  {
    doService(request, response, null);
  }


  @RequestMapping(value={"/{busiComp}/{service}/id/{id}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
  public void queryById(@PathVariable String busiComp, @PathVariable String service, @PathVariable String id, @RequestParam(required=false) String beanName, HttpServletRequest request, HttpServletResponse response)
    throws Exception
  {
    doService(request, response, null);
  }


  @RequestMapping(value={"/{busiComp}/{serviceName}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
  public void saveInsert(@PathVariable String busiComp, @PathVariable String serviceName, @RequestParam(required=false, defaultValue="false") boolean multi, HttpServletRequest request, HttpServletResponse response)
    throws Exception
  {
    doService(request, response, null);
  }


  @RequestMapping(value={"/{busiComp}/{serviceName}/saveMasterDetail/{detailBeanName}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
  public void saveMasterDetail(@PathVariable String busiComp, @PathVariable String serviceName, @PathVariable String detailBeanName, HttpServletRequest request, HttpServletResponse response) throws Exception
  {
    doService(request, response, null);
  }


  @RequestMapping(value={"/{busiComp}/{serviceName}/saveMasterDetail2/{detail1BeanName}/{detail2BeanName}"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
  public void saveMasterDetail2(@PathVariable String busiComp, @PathVariable String serviceName, @PathVariable String detail1BeanName, @PathVariable String detail2BeanName, HttpServletRequest request, HttpServletResponse response)
    throws Exception
  {
    doService(request, response, null);
  }


  @RequestMapping(value={"/{busiComp}/{serviceName}/id/{id}"}, method={org.springframework.web.bind.annotation.RequestMethod.PUT})
  public void saveUpdate(@PathVariable String busiComp, @PathVariable String serviceName, @PathVariable String id, HttpServletRequest request, HttpServletResponse response)
    throws Exception
  {
    doService(request, response, null);
  }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值