spring mvc rest 4种http动作


    @RequestMapping(value = "/channel_cfgs/channel/{channel}", method = RequestMethod.DELETE)
    @ResponseStatus(HttpStatus.NO_CONTENT)
    public void deleteChannelCFG(@PathVariable String channel) {
        logger.info("deleteChannelCFG is call!");
        System.out.println(channel);
    }

    @RequestMapping(value = "/channel_cfgs/channel/{channel}", method = RequestMethod.PUT)
    @ResponseStatus(HttpStatus.NO_CONTENT)
    public void updateChannelCFG(@PathVariable String channel, @RequestBody ChannelCFG channelCFG) {
        logger.info("updateChannelCFG is call!");
        System.out.println(channel);
        System.out.println(channelCFG);
    }

    @RequestMapping(value = "/channel_cfgs/channel/{channel}", method = RequestMethod.POST)
    @ResponseStatus(HttpStatus.CREATED)
    public void addChannelCFG(@PathVariable String channel, @RequestBody ChannelCFG channelCFG) {
        logger.info("addChannelCFG is call!");
        System.out.println(channel);
        System.out.println(channelCFG);
    }

    @RequestMapping(value = "/channel_cfgs/channel/{channel}", method = RequestMethod.GET)
    public @ResponseBody
    ChannelCFG getChannelCFG(@PathVariable String channel) {
        logger.info("getChannelCFG is call!");
        ChannelCFG cfg1 = new ChannelCFG();
        cfg1.setChannel_id(channel);
        cfg1.setIsp_hold("5:3:1:0.5:0.5");
        cfg1.setTotal_band(22222222);
        cfg1.setUser("bo.hu");
        return cfg1;
    }

你可能感兴趣的:(spring mvc rest)