Package org.glassfish.jersey.examples.jersey_ejb.entities

Examples of org.glassfish.jersey.examples.jersey_ejb.entities.Message


    public Message addMessage(String msg) {
        return addMessage(msg, new Date());
    }

    private Message addMessage(String msg, Date date) {
        Message m = new Message(date, msg, getNewId());

        list.add(0, m);

        return m;
    }
View Full Code Here


        return m;
    }

    public Message getMessage(int uniqueId) {
        int index = 0;
        Message m;

        while(index < list.size()) {
            if((m = list.get(index)).getUniqueId() == uniqueId)
                return m;
            index++;
View Full Code Here

        return singleton.getMessages();
    }

    @POST
    public Response addMessage(String msg) throws URISyntaxException {
        Message m = singleton.addMessage(msg);

        URI msgURI = ui.getRequestUriBuilder().path(Integer.toString(m.getUniqueId())).build();

        return Response.created(msgURI).build();
    }
View Full Code Here

    }

    @Path("{msgNum}")
    @GET
    public Message getMessage(@PathParam("msgNum") int msgNum) {
        Message m = singleton.getMessage(msgNum);

        if(m == null) {
            // This exception will be passed through to the JAX-RS runtime
            // No other runtime exception will behave this way unless the
            // exception is annotated with javax.ejb.ApplicationException
View Full Code Here

    public synchronized Message addMessage(String msg) {
        return addMessage(msg, new Date());
    }

    private synchronized Message addMessage(String msg, Date date) {
        Message m = new Message(date, msg, getNewId());

        list.addFirst(m);

        return m;
    }
View Full Code Here

        return m;
    }

    public Message getMessage(int uniqueId) {
        int index = 0;
        Message m;

        while(index < list.size()) {
            if((m = list.get(index)).getUniqueId() == uniqueId)
                return m;
            index++;
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.examples.jersey_ejb.entities.Message

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.