Package org.glassfish.jersey.server.mvc

Examples of org.glassfish.jersey.server.mvc.Viewable


        list.add("item1");
        list.add("item2");
        list.add("item3");
        map.put("items", list);

        return new Viewable("/hello", map);
    }
View Full Code Here


        list.add("item1");
        list.add("item2");
        list.add("item3");
        map.put("items", list);

        return new Viewable("/hello.ftl", map);
    }
View Full Code Here

    @GET
    @Path("hello-default-model")
    @Produces(MediaType.TEXT_HTML)
    public Viewable getHelloWithDefaultModel() {
        return new Viewable("/hello-default-model.ftl", "Pavel");
    }
View Full Code Here

    public Viewable getAutoTemplate() {
        final Map<String, String> map = new HashMap<String, String>();
        map.put("user", "Pavel");

        // template name is derived from resource class name
        return new Viewable("/org/glassfish/jersey/examples/freemarker/resources/FreemarkerResource.ftl",
                map);
    }
View Full Code Here

        list.add("item1");
        list.add("item2");
        list.add("item3");
        map.put("items", list);

        return new Viewable("/hello", map);
    }
View Full Code Here


    @GET
    @Produces("text/csv")
    public Viewable listAsCsv() {
        return new Viewable("/flight/list-csv", list());
    }
View Full Code Here

    @Produces(TEXT_HTML)
    public Viewable bookAsHtml(@PathParam("id") String flightId) {
        Map<String, Object> model = new HashMap<String, Object>();
        model.put("flightId", flightId);
        model.put("reservationId", book(flightId));
        return new Viewable("/flight/reservation", model);
    }
View Full Code Here

    @GET
    @Path("viewable-relative")
    @Produces("text/html")
    public Viewable viewableRelative() {
        return new Viewable("index", model);
    }
View Full Code Here

    @GET
    @Path("viewable-absolute")
    @Produces("text/html")
    public Viewable viewableAbsolute() {
        return new Viewable(absolutePath, model);
    }
View Full Code Here

        public Response toResponse(WebApplicationException exception) {
            // Absolute.
            if (exception.getResponse().getStatus() == 404) {
                return Response
                        .status(404)
                        .entity(new Viewable("/org/glassfish/jersey/tests/e2e/server/mvc/ExceptionViewProcessorTest/404", "404"))
                        .build();
            }

            // Relative.
            if (exception.getResponse().getStatus() == 406) {
                return Response.status(406).entity(
                        new Viewable("/org/glassfish/jersey/tests/e2e/server/mvc/ExceptionViewProcessorTest/WebAppExceptionMapper/406",
                                "406")).build();
            }

            return exception.getResponse();
        }
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.server.mvc.Viewable

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.