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

net.javapla.jawn.core.Renderer Maven / Gradle / Ivy

The newest version!
package net.javapla.jawn.core;

/**
 * Rendering of responses
 *
 */
public interface Renderer {
    
//    Renderer TO_STRING = (ctx, value) -> {
//        if (ctx.req().accepts(MediaType.PLAIN/*ctx.resp().contentType()*/)) {
//            return value.toString().getBytes(ctx.resp().charset());
//        }
//        throw Up.NotAcceptable(ctx.req().header("Accept").value());
//    };
    

    /**
     * 
     * @param ctx
     * @param value
     * @return null if the response has been handled by the renderer
     * @throws Exception
     */
    byte[] render(Context ctx, Object value) throws Exception;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy