/*
 * Copyright 2002-2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.zuoxiaolong.blog.web.controller;

import com.zuoxiaolong.blog.common.spring.BaseController;

/**
 * @author Boren You
 * @dateTime 2016/6/11 0:23
 * @since 1.0.0
 */
public abstract class WebBaseController extends BaseController {
}

@@ -717,16 +717,144 @@
 troller;
+%0Aimport com.zuoxiaolong.blog.common.utils.JsonUtils;%0A%0Aimport javax.servlet.http.HttpServletResponse;%0Aimport java.io.IOException;
 %0A%0A/**%0A *
@@ -985,10 +985,670 @@
 oller %7B%0A
+%0A    /**%0A     * %E5%AE%A2%E6%88%B7%E7%AB%AF%E8%BF%94%E5%9B%9EJSON%E5%AD%97%E7%AC%A6%E4%B8%B2%0A     * @param object%0A     * @return%0A     */%0A    protected void renderJson(Object object) %7B%0A        renderText(JsonUtils.toJson(object), %22application/json%22);%0A    %7D%0A%0A    /**%0A     * %E5%AE%A2%E6%88%B7%E7%AB%AF%E8%BF%94%E5%9B%9E%E5%AD%97%E7%AC%A6%E4%B8%B2%0A     * @param string%0A     * @return%0A     */%0A    protected void renderText(String string, String type) %7B%0A        try %7B%0A            HttpServletResponse response = getResponse();%0A            response.reset();%0A            response.setContentType(type);%0A            response.setCharacterEncoding(%22utf-8%22);%0A            response.getWriter().print(string);%0A        %7D catch (IOException e) %7B%0A            throw new RuntimeException(e);%0A        %7D%0A    %7D%0A%0A
 %7D%0A

添加返回JSon的工具类.