Class MemberResourceRESTService
- java.lang.Object
-
- org.jboss.as.quickstarts.kitchensink_ear.rest.MemberResourceRESTService
-
@Path("/members") @RequestScoped public class MemberResourceRESTService extends ObjectJAX-RS Example This class produces a RESTful service to read/write the contents of the members table.
-
-
Constructor Summary
Constructors Constructor Description MemberResourceRESTService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.ws.rs.core.ResponsecreateMember(Member member)Creates a new member from the values provided.booleanemailAlreadyExists(String email)Checks if a member with the same email address is already registered.List<Member>listAllMembers()MemberlookupMemberById(long id)
-
-
-
Method Detail
-
lookupMemberById
@GET @Path("/{id:[0-9][0-9]*}") @Produces("application/json") public Member lookupMemberById(@PathParam("id") long id)
-
createMember
@POST @Consumes("application/json") @Produces("application/json") public javax.ws.rs.core.Response createMember(Member member)Creates a new member from the values provided. Performs validation, and will return a JAX-RS response with either 200 ok, or with a map of fields, and related errors.
-
emailAlreadyExists
public boolean emailAlreadyExists(String email)
Checks if a member with the same email address is already registered. This is the only way to easily capture the "@UniqueConstraint(columnNames = "email")" constraint from the Member class.- Parameters:
email- The email to check- Returns:
- True if the email already exists, and false otherwise
-
-