@POST
 @Path("RSAComposedNode.Assemble")
 public Response assemble() {
   try {
     service.assembleComposedNode(getCurrentContext());
   } catch (EntityNotFoundException e) {
     throw PodmExceptions.notFound();
   } catch (EntityOperationException e) {
     throw new ClientErrorException("Assembly action could not be completed!", METHOD_NOT_ALLOWED);
   }
   return Response.accepted().build();
 }
  @POST
  public Response login(final User user) {
    try {
      final User userFromDb = manager.getUserByEmail(user.getEmail());

      if (user.getPassword().equals(userFromDb.getPassword())) {
        AuthProvider provider = new AuthProvider();
        final String token = provider.addToken(userFromDb.getId());

        return Response.accepted().header("token", token).build();
      }

      throw new AuthorizationException("Wrong username or password");
    } catch (ECommerceManagerException e) {
      throw new AuthorizationException("Wrong username or password");
    }
  }
Esempio n. 3
0
 private ResponseBuilder getResponse(Object entity, Status status) {
   return Response.accepted(entity).status(status);
 }
 @PUT
 @Produces(MediaType.APPLICATION_JSON)
 public Response update(Project project) {
   return Response.accepted(project).build();
 }