All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.xiaoyuge5201.request.RequestUtils Maven / Gradle / Ivy

There is a newer version: 1.3.5
Show newest version
/*
 * Copyright (c) 2020. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
 * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
 * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
 * Vestibulum commodo. Ut rhoncus gravida arcu.
 */

package com.github.xiaoyuge5201.request;


import javax.servlet.ServletResponse;
import java.io.PrintWriter;

/**
 * 请求
 * @author yugb
 */
public class RequestUtils {
    /**
     * @param response : 响应请求
     * @param object: object
     * @return void
     **/
    public static void out(ServletResponse response, Object object){
        PrintWriter out = null;
        try {
            response.setContentType("application/json;charset=UTF-8");
            response.setCharacterEncoding("UTF-8");
            out = response.getWriter();
            out.println(object.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }finally{
            if(null != out){
                out.flush();
                out.close();
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy