Package org.rendersnake

Examples of org.rendersnake.Renderable


     * @param html
     * @return
     * @throws IOException
     */
    private Renderable renderContentOn(final HtmlCanvas html) throws IOException {
        return new Renderable() {

            public void renderOn(HtmlCanvas html) throws IOException {
               
                html.h1().write("Minimal")._h1();
                html.write(StringResource.get("content/Example-minimal.html"),false);
View Full Code Here


     * @throws Exception
     * @return a RenderableView | null
     */
    public View resolveViewName(String viewName, Locale locale) throws Exception {

        final Renderable component = appCtx.getBean(viewName, Renderable.class);
        if (component == null) return null;
        return new RenderableView(component, this.contentType);
    }
View Full Code Here

     * by looking for a named component that matches the path.
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String uri = request.getPathInfo();
        Renderable component = this.dispatchMap.get(uri);
        if (component == null) {
            response.sendError(404);
        } else {
            HtmlCanvas canvas = HtmlCanvasFactory.createCanvas(request,response,response.getWriter());
            PageContext context = canvas.getPageContext();
View Full Code Here

        for (Key<?> key : injector.getBindings().keySet()) {
            Type type = key.getTypeLiteral().getType();
            if (type instanceof Class<?>) {
                Class<?> klass = (Class<?>) type;
                if (Renderable.class.isAssignableFrom(klass)) {
                    Renderable p = (Renderable)injector.getInstance(klass);
                    Named annotation = klass.getAnnotation(Named.class);
                    if (annotation != null) {
                        dispatchMap.put(annotation.value(), p);
                        LOG.info("Binding component:"+klass+" to:" + annotation);
                    } else {
View Full Code Here

        if (exception != null) {
            // general error
            html.write(String.format("[Render Error] general exception [%s]", exception.getMessage()));
        }
        // if debugging, the error component is available
        Renderable errorComponent = (Renderable)(html.getPageContext().getObject("renderable.error"));
        if (errorComponent != null) {
            html.write(" in ").write(errorComponent.getClass().getName());
        } else {
            html.a(href("?inspect")).write(" Inspect details")._a();
            this.renderStackTraceOn(html);
        }
        html._div();
View Full Code Here

TOP

Related Classes of org.rendersnake.Renderable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.