Examples of ResolvedViewable


Examples of com.sun.jersey.spi.template.ResolvedViewable

    public void writeTo(Viewable v,
            Class<?> type, Type genericType, Annotation[] annotations,
            MediaType mediaType, MultivaluedMap<String, Object> httpHeaders,
            OutputStream entityStream) throws IOException {
        final ResolvedViewable rv = resolve(v);
        if (rv == null)
            throw new IOException("The template name, " +
                    v.getTemplateName() +
                    ", could not be resolved to a fully qualified template name");

        rv.writeTo(entityStream);
    }
View Full Code Here

Examples of com.sun.jersey.spi.template.ResolvedViewable

                context.getMatchResult().group(1) :
                "";

            // Resolve the viewable
            Viewable v = new Viewable(templatePath, resource);
            ResolvedViewable rv = tc.resolveViewable(v);
            if (rv == null) {
                return false;
            }

            // If an internal match resource request then always return true
            if (request.getMethod().equals(WebApplicationContext.HTTP_METHOD_MATCH_RESOURCE)) {
                return true;
            }

            if (context.isTracingEnabled()) {
                context.trace(String.format("accept implicit view: \"%s\" -> %s, %s",
                        templatePath,
                        ReflectionHelper.objectToString(resource),
                        rv.getTemplateName()));
            }

            // Push the response filters
            context.pushContainerResponseFilters(responseFilters);
View Full Code Here

Examples of com.sun.jersey.spi.template.ResolvedViewable

   
    private ResolvedViewable resolveAbsoluteViewable(Viewable v) {
        for (ViewProcessor vp : getViewProcessors()) {
            Object resolvedTemplateObject = vp.resolve(v.getTemplateName());
            if (resolvedTemplateObject != null) {
                return new ResolvedViewable(vp, resolvedTemplateObject, v);
            }
        }

        return null;
    }
View Full Code Here

Examples of com.sun.jersey.spi.template.ResolvedViewable

            String absolutePath = getAbsolutePath(c, path, '/');

            for (ViewProcessor vp : getViewProcessors()) {
                Object resolvedTemplateObject = vp.resolve(absolutePath);
                if (resolvedTemplateObject != null) {
                    return new ResolvedViewable(vp, resolvedTemplateObject, v, c);
                }
            }
        }

        // Find in flat files
        for (Class c = resolvingClass; c != Object.class; c = c.getSuperclass()) {
            String absolutePath = getAbsolutePath(c, path, '.');

            for (ViewProcessor vp : getViewProcessors()) {
                Object resolvedTemplateObject = vp.resolve(absolutePath);
                if (resolvedTemplateObject != null) {
                    return new ResolvedViewable(vp, resolvedTemplateObject, v, c);
                }
            }
        }

        return null;
View Full Code Here

Examples of com.sun.jersey.spi.template.ResolvedViewable

    public void writeTo(Viewable v,
            Class<?> type, Type genericType, Annotation[] annotations,
            MediaType mediaType, MultivaluedMap<String, Object> httpHeaders,
            OutputStream entityStream) throws IOException {
        final ResolvedViewable rv = resolve(v);
        if (rv == null)
            throw new IOException("The template name, " +
                    v.getTemplateName() +
                    ", could not be resolved to a fully qualified template name");

        rv.writeTo(entityStream);
    }
View Full Code Here

Examples of com.sun.jersey.spi.template.ResolvedViewable

                context.getMatchResult().group(1) :
                "";

            // Resolve the viewable
            Viewable v = new Viewable(templatePath, resource);
            ResolvedViewable rv = tc.resolveViewable(v);
            if (rv == null) {
                return false;
            }

            // If an internal match resource request then always return true
            if (request.getMethod().equals(WebApplicationContext.HTTP_METHOD_MATCH_RESOURCE)) {
                return true;
            }

            if (context.isTracingEnabled()) {
                context.trace(String.format("accept implicit view: \"%s\" -> %s, %s",
                        templatePath,
                        ReflectionHelper.objectToString(resource),
                        rv.getTemplateName()));
            }

            // Push the response filters
            context.pushContainerResponseFilters(responseFilters);
View Full Code Here

Examples of com.sun.jersey.spi.template.ResolvedViewable

   
    private ResolvedViewable resolveAbsoluteViewable(Viewable v) {
        for (ViewProcessor vp : getViewProcessors()) {
            Object resolvedTemplateObject = vp.resolve(v.getTemplateName());
            if (resolvedTemplateObject != null) {
                return new ResolvedViewable(vp, resolvedTemplateObject, v);
            }
        }

        return null;
    }
View Full Code Here

Examples of com.sun.jersey.spi.template.ResolvedViewable

            String absolutePath = getAbsolutePath(c, path, '/');

            for (ViewProcessor vp : getViewProcessors()) {
                Object resolvedTemplateObject = vp.resolve(absolutePath);
                if (resolvedTemplateObject != null) {
                    return new ResolvedViewable(vp, resolvedTemplateObject, v, c);
                }
            }
        }

        // Find in flat files
        for (Class c = resolvingClass; c != Object.class; c = c.getSuperclass()) {
            String absolutePath = getAbsolutePath(c, path, '.');

            for (ViewProcessor vp : getViewProcessors()) {
                Object resolvedTemplateObject = vp.resolve(absolutePath);
                if (resolvedTemplateObject != null) {
                    return new ResolvedViewable(vp, resolvedTemplateObject, v, c);
                }
            }
        }

        return null;
View Full Code Here

Examples of org.glassfish.jersey.server.mvc.spi.ResolvedViewable

                        final MultivaluedMap<String, Object> httpHeaders,
                        final OutputStream entityStream) throws IOException, WebApplicationException {
        final Template template = TemplateHelper.getTemplateAnnotation(annotations);

        try {
            final ResolvedViewable resolvedViewable = resolve(viewable, template);
            if (resolvedViewable == null) {
                throw new WebApplicationException(
                        new ProcessingException(LocalizationMessages.TEMPLATE_NAME_COULD_NOT_BE_RESOLVED(viewable.getTemplateName())),
                        Response.Status.NOT_FOUND);
            }

            httpHeaders.putSingle(HttpHeaders.CONTENT_TYPE, resolvedViewable.getMediaType());
            resolvedViewable.writeTo(entityStream);
        } catch (ViewableContextException vce) {
            throw new NotFoundException(vce);
        }
    }
View Full Code Here

Examples of org.glassfish.jersey.server.mvc.spi.ResolvedViewable

                final ImplicitViewable implicitViewable = (ImplicitViewable) viewable;

                for (final String templateName : implicitViewable.getTemplateNames()) {
                    final Viewable simpleViewable = new Viewable(templateName, viewable.getModel(), viewable.getResolvingClass());

                    final ResolvedViewable resolvedViewable = resolve(simpleViewable, producibleMediaTypes,
                            simpleViewable.getResolvingClass(), viewableContext, templateProcessors);

                    if (resolvedViewable != null) {
                        return resolvedViewable;
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.