Package org.restlet.test.jaxrs.services.others

Examples of org.restlet.test.jaxrs.services.others.Person


*/
@Path("persons/{id}")
public class PersonResource {
    @GET
    public Person get(@PathParam("id") int id) {
        return new Person("firstname" + id, "lastname");
    }
View Full Code Here


    @GET
    @Produces( { "application/xml", "text/xml" })
    public PersonList getPersons() {
        final PersonList list = new PersonList();
        list.add(new Person("Angela", "Merkel"));
        list.add(new Person("Ehud", "Olmert"));
        list.add(new Person("George U.", "Bush"));
        return list;
    }
View Full Code Here

@Path("appPlusXml")
public class AppPlusXmlResource {
    @GET
    @Produces( { "application/Person+xml", APPLICATION_XML, TEXT_XML })
    public Person getPerson() {
        return new Person("Angela", "Merkel");
    }
View Full Code Here

    /** @see ContextResolverTest#test1() */
    @GET
    @Produces("text/html")
    public Person getHomeUri() {
        return new Person("Helmut", "Kohl");
    }
View Full Code Here

public class MessageBodyWriterTestResource {

    @GET
    @Produces("application/crazy-person")
    public Response get() {
        final Person person = new Person("Angela", "Merkel");
        return Response.ok(person).header("h1", "h1v").build();
    }
View Full Code Here

    @GET
    @Path("person")
    @Produces( { TEXT_XML, APPLICATION_XML, APPLICATION_JSON })
    public Person getPerson(@QueryParam("firstname") String firstname,
            @QueryParam("lastname") String lastname) {
        return new Person(firstname, lastname);
    }
View Full Code Here

        }
    }

    @SuppressWarnings("all")
    public static void main(String[] args) throws Exception {
        Person person = new Person("vn", "nn");
        JaxbElementProvider jaxbElementProvider = new JaxbElementProvider();
        jaxbElementProvider.contextResolver = new ContextResolver<JAXBContext>() {
            public JAXBContext getContext(Class<?> type) {
                return null;
            }
View Full Code Here

    @GET
    @Path("jaxb")
    @Produces("text/xml")
    public Person jaxbGet() {
        return new Person("Angela", "Merkel");
    }
View Full Code Here

     */
    public void testCreate() throws Exception {
        if (usesTcp()) {
            return;
        }
        final Person newPerson = new Person("Kurt", "Beck");
        final Response response1 = post(new JaxbRepresentation<Person>(
                newPerson));
        sysOutEntityIfError(response1);
        assertEquals(Status.SUCCESS_CREATED, response1.getStatus());
        final Reference newLocation = response1.getLocationRef();

        final Response response2 = get(newLocation, MediaType.TEXT_XML);
        sysOutEntityIfError(response2);
        assertEquals(Status.SUCCESS_OK, response2.getStatus());
        final JaxbRepresentation<Person> repr = new JaxbRepresentation<Person>(
                response2.getEntity(), Person.class);
        final Person person = repr.getObject();
        assertTrue(person.getFirstname().startsWith("firstname"));
        assertEquals("lastname", person.getLastname());
    }
View Full Code Here

public class OwnProviderTestService {

    @GET
    @Produces( { "text/crazy-person", "application/crazy-person" })
    public Response get() {
        final Person person = new Person("abc", "def");
        return Response.ok(person).header("h1", "h1v").build();
    }
View Full Code Here

TOP

Related Classes of org.restlet.test.jaxrs.services.others.Person

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.