Package de.taimos.httputils

Examples of de.taimos.httputils.HTTPRequest


    try {
      final String body;
      final String due = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
      final String bodyString = "{\"version\":{\"name\":\"%s\",\"status\":\"closed\",\"due_date\":\"%s\"}}";
      body = String.format(bodyString, version.getName(), due);
      final HTTPRequest req = this.createRequest("/versions/" + version.getId() + ".json");
      req.header(WSConstants.HEADER_CONTENT_TYPE, Redmine.APPLICATION_JSON);
      final HttpResponse put = req.body(body).put();
      if (!WS.isStatusOK(put)) {
        this.log.error(WS.getResponseAsString(put));
        throw new RedmineException(Redmine.STATUS_CHANGE_FAILED);
      }
    } catch (final Exception e) {
View Full Code Here


   * @param newName the new version name
   */
  public void renameVersion(final Version version, final String newName) {
    try {
      final String body = String.format("{\"version\":{\"name\":\"%s\"}}", newName);
      final HTTPRequest req = this.createRequest("/versions/" + version.getId() + ".json");
      req.header(WSConstants.HEADER_CONTENT_TYPE, Redmine.APPLICATION_JSON);
      final HttpResponse put = req.body(body).put();
      if (!WS.isStatusOK(put)) {
        this.log.error(WS.getResponseAsString(put));
        throw new RedmineException(Redmine.STATUS_CHANGE_FAILED);
      }
    } catch (final Exception e) {
View Full Code Here

   * @param name the version name
   */
  public void createVersion(final String project, final String name) {
    try {
      final String body = String.format("{\"version\":{\"name\":\"%s\",\"status\":\"open\"}}", name);
      final HTTPRequest req = this.createRequest("/projects/" + project + "/versions.json");
      req.header(WSConstants.HEADER_CONTENT_TYPE, Redmine.APPLICATION_JSON);
      final HttpResponse put = req.body(body).post();
      if (!WS.isStatusOK(put)) {
        this.log.error(WS.getResponseAsString(put));
        throw new RedmineException(Redmine.STATUS_CHANGE_FAILED);
      }
    } catch (final Exception e) {
View Full Code Here

TOP

Related Classes of de.taimos.httputils.HTTPRequest

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.