io.dropwizard.views.View Java Examples
The following examples show how to use
io.dropwizard.views.View.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ViewResource.java From dropwizard-java8 with Apache License 2.0 | 5 votes |
@GET @Produces("text/html;charset=UTF-8") @Path("/utf8.ftl") public View freemarkerUTF8() { return new View("/views/ftl/utf8.ftl", Charsets.UTF_8) { }; }
Example #2
Source File: ViewResource.java From dropwizard-java8 with Apache License 2.0 | 5 votes |
@GET @Produces("text/html;charset=ISO-8859-1") @Path("/iso88591.ftl") public View freemarkerISO88591() { return new View("/views/ftl/iso88591.ftl", Charsets.ISO_8859_1) { }; }
Example #3
Source File: ViewResource.java From dropwizard-java8 with Apache License 2.0 | 5 votes |
@GET @Produces("text/html;charset=UTF-8") @Path("/utf8.mustache") public View mustacheUTF8() { return new View("/views/mustache/utf8.mustache", Charsets.UTF_8) { }; }
Example #4
Source File: ViewResource.java From dropwizard-java8 with Apache License 2.0 | 5 votes |
@GET @Produces("text/html;charset=ISO-8859-1") @Path("/iso88591.mustache") public View mustacheISO88591() { return new View("/views/mustache/iso88591.mustache", Charsets.ISO_8859_1) { }; }
Example #5
Source File: AdminResource.java From incubator-pinot with Apache License 2.0 | 5 votes |
@GET @Path(value = "/") @ApiOperation(value = "Load the ThirdEye admin dashboard.") @Produces(MediaType.TEXT_HTML) public View getDashboardView() { return new ThirdEyeAdminView(); }
Example #6
Source File: HandlebarsViewRenderer.java From incubator-pinot with Apache License 2.0 | 5 votes |
@Override public void render(View view, Locale locale, OutputStream output) throws IOException, WebApplicationException { try (Writer writer = new OutputStreamWriter(output, view.getCharset().orElse(Charsets.UTF_8))) { compilationCache.get(view.getTemplateName()).apply(view, writer); } catch (FileNotFoundException | ExecutionException e) { throw new FileNotFoundException("Template " + view.getTemplateName() + " not found."); } }
Example #7
Source File: TrimouViewRenderer.java From trimou with Apache License 2.0 | 5 votes |
@Override public void render(View view, Locale locale, OutputStream output) throws IOException, WebApplicationException { Mustache template = null; if (hasLocalizedTemplates && locale != null) { // First try the Locale template = engine.getMustache(getLocalizedTemplateName(view.getTemplateName(), locale.toString())); if (template == null) { // Then only the language template = engine.getMustache(getLocalizedTemplateName(view.getTemplateName(), locale.getLanguage())); } } if (template == null) { template = engine.getMustache(view.getTemplateName()); } if (template == null) { throw new FileNotFoundException("Template not found: " + view.getTemplateName()); } final Writer writer = new OutputStreamWriter(output, engine.getConfiguration().getStringPropertyValue(EngineConfigurationKey.DEFAULT_FILE_ENCODING)); try { template.render(writer, view); } catch (MustacheException e) { throw new IOException(e); } finally { writer.flush(); } }
Example #8
Source File: DashboardResource.java From incubator-pinot with Apache License 2.0 | 4 votes |
@GET @Path(value = "/") @Produces(MediaType.TEXT_HTML) public View getDashboardView() { return new DashboardView(); }
Example #9
Source File: ThirdEyeResource.java From incubator-pinot with Apache License 2.0 | 4 votes |
@GET @Path(value = "/") @Produces(MediaType.TEXT_HTML) public View getDashboardView() { return new ThirdEyeView(); }
Example #10
Source File: HandlebarsViewRenderer.java From incubator-pinot with Apache License 2.0 | 4 votes |
@Override public boolean isRenderable(View view) { return view.getTemplateName().endsWith(HANDLEBARS_FILE_SUFFIX); // || view.getTemplateName().endsWith(".mustache"); // we can replace dropwizard-views-mustache with this. }
Example #11
Source File: TrimouViewRenderer.java From trimou with Apache License 2.0 | 4 votes |
@Override public boolean isRenderable(View view) { return view.getTemplateName().endsWith(suffix); }