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

io.yawp.commons.http.JsonResponse Maven / Gradle / Ivy

There is a newer version: 2.08alpha
Show newest version
package io.yawp.commons.http;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

public class JsonResponse extends HttpResponse {

	private String json;

	public JsonResponse(String json) {
		this.json = json;
	}

	@Override
	public String getText() {
		return json;
	}

	@Override
	public void execute(HttpServletResponse resp) throws IOException {
		resp.setContentType("application/json;charset=UTF-8");
		resp.setCharacterEncoding("UTF-8");
		if (json != null) {
			resp.getWriter().print(json);
		}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy