コード例 #1
0
 @POST
 @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
 @Produces(GrouptalkMediaType.GROUPTALK_AUTH_TOKEN)
 public Response createJoinGroup(
     @FormParam("userid") String userid,
     @FormParam("groupid") String groupid,
     @Context UriInfo uriInfo)
     throws URISyntaxException {
   if (userid == null || groupid == null)
     throw new BadRequestException("all parameters are mandatory");
   JoinGroupDAO joinGroupDAO = new JoinGroupDAOImpl();
   JoinGroup joinGroup = null;
   AuthToken authenticationToken = null;
   try {
     joinGroup =
         joinGroupDAO.createJoinGroup(securityContext.getUserPrincipal().getName(), groupid);
   } catch (SQLException e) {
     throw new InternalServerErrorException();
   }
   URI uri = new URI(uriInfo.getAbsolutePath().toString() + "/" + joinGroup.getUserid());
   return Response.created(uri)
       .type(GrouptalkMediaType.GROUPTALK_InterestGroups)
       .entity(joinGroup)
       .build();
 }