Package com.meterware.httpunit

Examples of com.meterware.httpunit.PutMethodWebRequest


    for (String path : paths)
      jsonPaths.put(path);
    body.put(ProtocolConstants.KEY_PATH, jsonPaths);
    if (removeUntracked)
      body.put(GitConstants.KEY_REMOVE_UNTRACKED, removeUntracked);
    WebRequest request = new PutMethodWebRequest(requestURI, IOUtilities.toInputStream(body.toString()), "UTF-8");
    request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1");
    setAuthentication(request);
    return request;
  }
View Full Code Here


    JSONObject body = new JSONObject();
    body.put(GitConstants.KEY_TAG_NAME, tagName);
    // checkout the tag into a new local branch
    // TODO: temporary workaround, JGit fails to checkout a new branch named as the tag
    body.put(GitConstants.KEY_BRANCH_NAME, "tag_" + tagName);
    WebRequest request = new PutMethodWebRequest(requestURI, IOUtilities.toInputStream(body.toString()), "UTF-8");
    request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1");
    setAuthentication(request);
    return webConversation.getResponse(request);
  }
View Full Code Here

  protected WebResponse getPostGitBlame(String blameUri, String commitId) throws JSONException, IOException, SAXException {
    assertBlameUri(blameUri);
    String requestURI = toAbsoluteURI(blameUri);
    JSONObject body = new JSONObject();
    body.put(GitConstants.KEY_COMMIT, commitId);
    WebRequest request = new PutMethodWebRequest(requestURI, IOUtilities.toInputStream(body.toString()), "application/json");
    request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1");
    setAuthentication(request);
    return webConversation.getResponse(request);
  }
View Full Code Here

  protected WebResponse checkoutBranch(String cloneLocation, String branchName) throws JSONException, IOException, SAXException {
    String requestURI = toAbsoluteURI(cloneLocation);
    JSONObject body = new JSONObject();
    body.put(GitConstants.KEY_BRANCH_NAME, branchName);
    WebRequest request = new PutMethodWebRequest(requestURI, IOUtilities.toInputStream(body.toString()), "UTF-8");
    request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1");
    setAuthentication(request);
    return webConversation.getResponse(request);
  }
View Full Code Here

  protected static WebRequest getPutGitCommitRequest(String location, String tagName) throws UnsupportedEncodingException, JSONException {
    String requestURI = toAbsoluteURI(location);
    JSONObject body = new JSONObject();
    body.put(ProtocolConstants.KEY_NAME, tagName);
    WebRequest request = new PutMethodWebRequest(requestURI, IOUtilities.toInputStream(body.toString()), "application/json");
    request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1");
    setAuthentication(request);
    return request;
  }
View Full Code Here

      json.put(ProtocolConstants.KEY_NAME, name);
      json.put(SiteConfigurationConstants.KEY_WORKSPACE, workspaceId);
      json.putOpt(SiteConfigurationConstants.KEY_MAPPINGS, mappings);
      json.putOpt(SiteConfigurationConstants.KEY_HOST_HINT, hostHint);
      json.putOpt(SiteConfigurationConstants.KEY_HOSTING_STATUS, hostingStatus);
      WebRequest request = new PutMethodWebRequest(toAbsoluteURI(locationUri), IOUtilities.toInputStream(json.toString()), "application/json");
      request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1");
      setAuthentication(request);
      return request;
    } catch (UnsupportedEncodingException e) {
      fail(e.getMessage());
    } catch (JSONException e) {
View Full Code Here

    String requestURI = toAbsoluteURI(location);
    JSONObject body = new JSONObject();
    JSONArray array = new JSONArray();
    array.put(value);
    body.put(GitConstants.KEY_CONFIG_ENTRY_VALUE, array);
    WebRequest request = new PutMethodWebRequest(requestURI, IOUtilities.toInputStream(body.toString()), "UTF-8");
    request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1");
    setAuthentication(request);
    return request;
  }
View Full Code Here

    return createFileResp;
  }

  private WebRequest createSetPreferenceRequest(String location, String key, String value) throws UnsupportedEncodingException {
    String body = "key=" + URLEncoder.encode(key, "UTF-8") + "&value=" + URLEncoder.encode(value, "UTF-8");
    return new PutMethodWebRequest(location, new ByteArrayInputStream(body.getBytes()), "application/x-www-form-urlencoded");
  }
View Full Code Here

    return waitForTask(webConversation.getResponse(request));
  }

  protected ServerStatus applyStash(String applyStashLocation) throws Exception {
    JSONObject body = new JSONObject();
    WebRequest request = new PutMethodWebRequest(toAbsoluteURI(applyStashLocation), IOUtilities.toInputStream(body.toString()), "application/json"); //$NON-NLS-1$

    request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1"); //$NON-NLS-1$
    setAuthentication(request);
    return waitForTask(webConversation.getResponse(request));
  }
View Full Code Here

    return null;
  }

  protected WebRequest getPutFileRequest(String uri, String body) {
    try {
      WebRequest request = new PutMethodWebRequest(makeResourceURIAbsolute(uri), IOUtilities.toInputStream(body), "application/json");
      request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1");
      setAuthentication(request);
      return request;
    } catch (UnsupportedEncodingException e) {
      fail(e.getMessage());
    }
View Full Code Here

TOP

Related Classes of com.meterware.httpunit.PutMethodWebRequest

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.