com.gargoylesoftware.htmlunit.WebRequestSettings.getRequestParameters()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(145)

本文整理了Java中com.gargoylesoftware.htmlunit.WebRequestSettings.getRequestParameters()方法的一些代码示例,展示了WebRequestSettings.getRequestParameters()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebRequestSettings.getRequestParameters()方法的具体详情如下:
包路径:com.gargoylesoftware.htmlunit.WebRequestSettings
类名称:WebRequestSettings
方法名:getRequestParameters

WebRequestSettings.getRequestParameters介绍

[英]Retrieves the request parameters to use. If set, these request parameters will overwrite any request parameters which may be present in the #getUrl(). Should not be used in combination with the #setRequestBody(String).
[中]检索要使用的请求参数。如果设置,这些请求参数将覆盖#getUrl()中可能存在的任何请求参数。不应与#setRequestBody(字符串)结合使用。

代码示例

代码示例来源:origin: org.jenkins-ci/htmlunit

/**
 * Returns the parameters that were used in the last call to submitRequest().
 *
 * @return the parameters that were used in the last call to submitRequest()
 */
public List<NameValuePair> getLastParameters() {
  return lastRequest_.getRequestParameters();
}

代码示例来源:origin: org.jvnet.hudson/htmlunit

/**
 * Returns the parameters that were used in the last call to submitRequest().
 *
 * @return the parameters that were used in the last call to submitRequest()
 */
public List<NameValuePair> getLastParameters() {
  return lastRequest_.getRequestParameters();
}

代码示例来源:origin: net.disy.htmlunit/htmlunit

/**
 * Returns the parameters that were used in the last call to submitRequest().
 *
 * @return the parameters that were used in the last call to submitRequest()
 */
public List<NameValuePair> getLastParameters() {
  return lastRequest_.getRequestParameters();
}

代码示例来源:origin: stackoverflow.com

Final WebClient webClient = new WebClient();

// Instead of requesting the page directly we create a WebRequestSettings object
WebRequestSettings requestSettings = new WebRequestSettings(
 new URL("URL GOES HERE"), HttpMethod.POST);

// Then we set the request parameters
requestSettings.setRequestParameters(new ArrayList());
requestSettings.getRequestParameters().add(new NameValuePair("name of value to post", "value"));

// Finally, we can get the page
HtmlPage page = webClient.getPage(requestSettings);

代码示例来源:origin: org.jenkins-ci/htmlunit

buffer.append("method: '" + settings.getHttpMethod().name() + "', ");
if (settings.getHttpMethod() == HttpMethod.POST && settings.getEncodingType() == FormEncodingType.URL_ENCODED) {
  buffer.append("postParameters: " + nameValueListToJsMap(settings.getRequestParameters()) + ", ");

代码示例来源:origin: net.disy.htmlunit/htmlunit

buffer.append("method: '" + settings.getHttpMethod().name() + "', ");
if (settings.getHttpMethod() == HttpMethod.POST && settings.getEncodingType() == FormEncodingType.URL_ENCODED) {
  buffer.append("postParameters: " + nameValueListToJsMap(settings.getRequestParameters()) + ", ");

代码示例来源:origin: org.jenkins-ci/htmlunit

newRequest.setRequestParameters(settings.getRequestParameters());
newRequest.setAdditionalHeaders(settings.getAdditionalHeaders());
return getResponse(newRequest);

代码示例来源:origin: org.jvnet.hudson/htmlunit

buffer.append("method: '" + settings.getHttpMethod().name() + "', ");
if (settings.getHttpMethod() == HttpMethod.POST && settings.getEncodingType() == FormEncodingType.URL_ENCODED) {
  buffer.append("postParameters: " + nameValueListToJsMap(settings.getRequestParameters()) + ", ");

代码示例来源:origin: org.jvnet.hudson/htmlunit

newRequest.setRequestParameters(settings.getRequestParameters());
newRequest.setAdditionalHeaders(settings.getAdditionalHeaders());
return getResponse(newRequest);

代码示例来源:origin: net.disy.htmlunit/htmlunit

newRequest.setRequestParameters(settings.getRequestParameters());
newRequest.setAdditionalHeaders(settings.getAdditionalHeaders());
return getResponse(newRequest);

代码示例来源:origin: net.disy.htmlunit/htmlunit

if (webRequestSettings.getRequestParameters().isEmpty()) {
  String queryString = webRequestSettings.getUrl().getQuery();
  queryString = webClient_.encodeQuery(queryString, true);
  final NameValuePair[] pairs = new NameValuePair[webRequestSettings.getRequestParameters().size()];
  webRequestSettings.getRequestParameters().toArray(pairs);
  httpMethod.setQueryString(pairs);
    && method instanceof PostMethod) {
  final PostMethod postMethod = (PostMethod) httpMethod;
  for (final NameValuePair pair : webRequestSettings.getRequestParameters()) {
    postMethod.removeParameter(pair.getName(), pair.getValue());
  for (final NameValuePair pair : webRequestSettings.getRequestParameters()) {
    postMethod.addParameter(pair.getName(), pair.getValue());
  for (final NameValuePair pair : webRequestSettings.getRequestParameters()) {
    final PartBase newPart;
    if (pair instanceof KeyDataPair) {

代码示例来源:origin: org.jenkins-ci/htmlunit

if (webRequestSettings.getRequestParameters().isEmpty()) {
  String queryString = webRequestSettings.getUrl().getQuery();
  queryString = webClient_.encodeQuery(queryString, true);
  final NameValuePair[] pairs = new NameValuePair[webRequestSettings.getRequestParameters().size()];
  webRequestSettings.getRequestParameters().toArray(pairs);
  httpMethod.setQueryString(pairs);
    && method instanceof PostMethod) {
  final PostMethod postMethod = (PostMethod) httpMethod;
  for (final NameValuePair pair : webRequestSettings.getRequestParameters()) {
    postMethod.removeParameter(pair.getName(), pair.getValue());
  for (final NameValuePair pair : webRequestSettings.getRequestParameters()) {
    postMethod.addParameter(pair.getName(), pair.getValue());
  for (final NameValuePair pair : webRequestSettings.getRequestParameters()) {
    final PartBase newPart;
    if (pair instanceof KeyDataPair) {

代码示例来源:origin: net.disy.htmlunit/htmlunit

final List<NameValuePair> parameters = webRequestSettings.getRequestParameters();

代码示例来源:origin: org.jvnet.hudson/htmlunit

if (webRequestSettings.getRequestParameters().isEmpty()) {
  String queryString = webRequestSettings.getUrl().getQuery();
  queryString = webClient_.encodeQuery(queryString, true);
  final NameValuePair[] pairs = new NameValuePair[webRequestSettings.getRequestParameters().size()];
  webRequestSettings.getRequestParameters().toArray(pairs);
  httpMethod.setQueryString(pairs);
    && method instanceof PostMethod) {
  final PostMethod postMethod = (PostMethod) httpMethod;
  for (final NameValuePair pair : webRequestSettings.getRequestParameters()) {
    postMethod.removeParameter(pair.getName(), pair.getValue());
  for (final NameValuePair pair : webRequestSettings.getRequestParameters()) {
    postMethod.addParameter(pair.getName(), pair.getValue());
  for (final NameValuePair pair : webRequestSettings.getRequestParameters()) {
    final PartBase newPart;
    if (pair instanceof KeyDataPair) {

代码示例来源:origin: org.jenkins-ci/htmlunit

final List<NameValuePair> parameters = webRequestSettings.getRequestParameters();

代码示例来源:origin: org.jvnet.hudson/htmlunit

final List<NameValuePair> parameters = webRequestSettings.getRequestParameters();

相关文章