Search in sources :

Example 1 with Message

use of org.glassfish.jersey.examples.jersey_ejb.entities.Message in project jersey by jersey.

the class MessageBoardResourceBean method addMessage.

@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();
}
Also used : Message(org.glassfish.jersey.examples.jersey_ejb.entities.Message) URI(java.net.URI) POST(javax.ws.rs.POST)

Example 2 with Message

use of org.glassfish.jersey.examples.jersey_ejb.entities.Message in project jersey by jersey.

the class MessageHolderSingletonBean method addMessage.

private Message addMessage(String msg, Date date) {
    Message m = new Message(date, msg, getNewId());
    list.add(0, m);
    return m;
}
Also used : Message(org.glassfish.jersey.examples.jersey_ejb.entities.Message)

Example 3 with Message

use of org.glassfish.jersey.examples.jersey_ejb.entities.Message in project jersey by jersey.

the class MessageHolderSingletonBean method getMessage.

public Message getMessage(int uniqueId) {
    int index = 0;
    Message m;
    while (index < list.size()) {
        if ((m = list.get(index)).getUniqueId() == uniqueId) {
            return m;
        }
        index++;
    }
    return null;
}
Also used : Message(org.glassfish.jersey.examples.jersey_ejb.entities.Message)

Aggregations

Message (org.glassfish.jersey.examples.jersey_ejb.entities.Message)3 URI (java.net.URI)1 POST (javax.ws.rs.POST)1