
com.zandero.rest.writer.PlainResponseWriter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rest.vertx Show documentation
Show all versions of rest.vertx Show documentation
JAX-RS REST annotation processor for vert.x verticals
The newest version!
package com.zandero.rest.writer;
import io.vertx.core.http.*;
import org.slf4j.*;
import static io.vertx.core.http.HttpHeaders.CONTENT_TYPE;
/**
* Returns toString() output
*
* @param provided response type
*/
// @Produces("html/text")
public class PlainResponseWriter implements HttpResponseWriter {
private final static Logger log = LoggerFactory.getLogger(PlainResponseWriter.class);
@Override
public void write(T result, HttpServerRequest request, HttpServerResponse response) {
String mediaType = response.headers().get(CONTENT_TYPE);
log.warn(request.path() + " - no writer for Content-Type='" + mediaType + "', defaulting to toString() as output!");
if (result != null) {
response.end(result.toString());
} else {
response.end();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy