Package com.elasticinbox.rest

Examples of com.elasticinbox.rest.BadRequestException


      // delete old message
      messageDAO.delete(mailbox, messageId);
    } catch (MimeParserException mpe) {
      logger.error("Unable to parse message: ", mpe);
      throw new BadRequestException("Parsing error. Invalid MIME message.");
    } catch (OverQuotaException oqe) {
      throw new WebApplicationException(Response.Status.NOT_ACCEPTABLE);
    } catch (IOException ioe) {
      logger.error("Unable to read message stream: ", ioe);
      throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
View Full Code Here


          .addMarkers(addMarkers).removeMarkers(removeMarkers)
          .build();

      messageDAO.modify(mailbox, messageId, modification);
    } catch (IllegalLabelException ile) {
      throw new BadRequestException(ile.getMessage());
    } catch (Exception e) {
      logger.warn("Internal Server Error: ", e);
      throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
    }
View Full Code Here

      try {
        ObjectMapper mapper = new ObjectMapper();
        label = mapper.readValue(requestJSONContent, Label.class);
      } catch (Exception e) {
        logger.info("Malformed JSON request: {}", e.getMessage());
        throw new BadRequestException("Malformed JSON request");
      }

      if (label.getName() == null && labelName != null) {
        label.setName(labelName);
      }
    }

    label.setId(labelId);

    try {
      labelDAO.update(mailbox, label);
    } catch (IllegalLabelException ile) {
      throw new BadRequestException(ile.getMessage());
    } catch (ExistingLabelException ele) {
      throw new RESTApplicationException(Status.CONFLICT, ele.getMessage());
    } catch (Exception e) {
      logger.error("Updating label failed: ", e);
      return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
View Full Code Here

      try {
        ObjectMapper mapper = new ObjectMapper();
        label = mapper.readValue(requestJSONContent, Label.class);
      } catch (Exception e) {
        logger.info("Malformed JSON request: {}", e.getMessage());
        throw new BadRequestException("Malformed JSON request");
      }
    }

    if (label.getName() == null && labelName == null) {
      throw new BadRequestException("Label name must be specified");
    }

    Integer newLabelId = null;

    try {
      newLabelId = labelDAO.add(mailbox, label);
    } catch (IllegalLabelException ile) {
      throw new BadRequestException(ile.getMessage());
    } catch (ExistingLabelException ele) {
      throw new RESTApplicationException(Status.CONFLICT, ele.getMessage());
    } catch (Exception e) {
      logger.error("Adding label failed", e);
      throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
View Full Code Here

TOP

Related Classes of com.elasticinbox.rest.BadRequestException

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.