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

com.fastchar.out.FastOutText Maven / Gradle / Ivy

package com.fastchar.out;

import com.fastchar.core.FastAction;
import com.fastchar.core.FastChar;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class FastOutText extends FastOut {

    public FastOutText() {
        this.contentType = "text/plain";
    }


    @Override
    public void response(FastAction action) throws Exception {
        HttpServletResponse response = action.getResponse();
        response.setHeader("Pragma", "no-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);
        response.setStatus(getStatus());
        response.setContentType(toContentType());
        response.setCharacterEncoding(getCharset());

        PrintWriter writer = response.getWriter();
        writer.write(String.valueOf(data));
        writer.flush();
    }
}






© 2015 - 2024 Weber Informatics LLC | Privacy Policy