package io.dropwizard.views;

import javax.ws.rs.WebApplicationException;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Locale;
import java.util.Map;

The rendering engine for a type of view.
/** * The rendering engine for a type of view. */
public interface ViewRenderer {
Returns true if the renderer can render the given View.
Params:
  • view – a view
Returns:true if view can be rendered
/** * Returns {@code true} if the renderer can render the given {@link View}. * * @param view a view * @return {@code true} if {@code view} can be rendered */
boolean isRenderable(View view);
Renders the given View for the given Locale to the given OutputStream.
Params:
  • view – a view
  • locale – the locale in which the view should be rendered
  • output – the output stream
Throws:
/** * Renders the given {@link View} for the given {@link Locale} to the given {@link * OutputStream}. * * @param view a view * @param locale the locale in which the view should be rendered * @param output the output stream * @throws IOException if there is an error writing to {@code output} * @throws WebApplicationException if there is an error rendering the template */
void render(View view, Locale locale, OutputStream output) throws IOException;
options for configuring the view renderer
Params:
  • options –
/** * options for configuring the view renderer * @param options */
void configure(Map<String, String> options);
Returns:the key to use in the view configurations, i.e. 'freemarker' or 'mustache'.
/** * @return the key to use in the view configurations, i.e. 'freemarker' or 'mustache'. */
String getConfigurationKey(); }