org.apache.commons.httpclient.Header.setValue()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(114)

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

Header.setValue介绍

暂无

代码示例

代码示例来源:origin: Alfresco/alfresco-repository

public void setContentType(String contentType)
{
  for (Header hdr : headers)
  {
    if (HEADER_CONTENT_TYPE.equals( hdr.getName() ))
    {
      hdr.setValue(contentType);
      return;
    }
  }
  headers.add(new Header(HEADER_CONTENT_TYPE, contentType));
}

代码示例来源:origin: org.alfresco/alfresco-repository

public void setContentType(String contentType)
{
  for (Header hdr : headers)
  {
    if (HEADER_CONTENT_TYPE.equals( hdr.getName() ))
    {
      hdr.setValue(contentType);
      return;
    }
  }
  headers.add(new Header(HEADER_CONTENT_TYPE, contentType));
}

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

// Create an instance of org.apache.axis2.client.ServiceClient
ServiceClient client = ...

// Create an instance of org.apache.axis2.client.Options
Options options = new Options();

List list = new ArrayList();

// Create an instance of org.apache.commons.httpclient.Header
Header header = new Header();

// Http header. Name : user, Value : admin
header.setName("user");
header.setValue("admin");

list.add(header);
options.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_HEADERS, list);

client.setOptions(options);

代码示例来源:origin: org.alfresco/alfresco-repository

public void addRequestHeaders(Header[] headers)
{
  for (Header newHdr : headers)
  {
    // See if we already have one of these headers
    Header existingHdr = null;
    for (Header hdr : this.headers)
    {
      if (newHdr.getName().equals( hdr.getName() ))
      {
        existingHdr = hdr;
      }
    }
    
    // Update or add as needed
    if (existingHdr != null)
    {
      existingHdr.setValue(newHdr.getValue());
    }
    else
    {
      this.headers.add(newHdr);
    }
  }
}

代码示例来源:origin: Alfresco/alfresco-repository

public void addRequestHeaders(Header[] headers)
{
  for (Header newHdr : headers)
  {
    // See if we already have one of these headers
    Header existingHdr = null;
    for (Header hdr : this.headers)
    {
      if (newHdr.getName().equals( hdr.getName() ))
      {
        existingHdr = hdr;
      }
    }
    
    // Update or add as needed
    if (existingHdr != null)
    {
      existingHdr.setValue(newHdr.getValue());
    }
    else
    {
      this.headers.add(newHdr);
    }
  }
}

代码示例来源:origin: org.netpreserve.commons/webarchive-commons

/**
   * If a 'Proxy-Connection' header has been added to the request,
   * it'll be of a 'keep-alive' type.  Until we support 'keep-alives',
   * override the Proxy-Connection setting and instead pass a 'close'
   * (Otherwise every request has to timeout before we notice
   * end-of-document).
   * @param method Method to find proxy-connection header in.
   */
  public void handleAddProxyConnectionHeader(HttpMethod method) {
    Header h = method.getRequestHeader("Proxy-Connection");
    if (h != null) {
      h.setValue("close");
      method.setRequestHeader(h);
    }
  }
}

代码示例来源:origin: iipc/webarchive-commons

/**
   * If a 'Proxy-Connection' header has been added to the request,
   * it'll be of a 'keep-alive' type.  Until we support 'keep-alives',
   * override the Proxy-Connection setting and instead pass a 'close'
   * (Otherwise every request has to timeout before we notice
   * end-of-document).
   * @param method Method to find proxy-connection header in.
   */
  public void handleAddProxyConnectionHeader(HttpMethod method) {
    Header h = method.getRequestHeader("Proxy-Connection");
    if (h != null) {
      h.setValue("close");
      method.setRequestHeader(h);
    }
  }
}

代码示例来源:origin: org.netpreserve.commons/commons-web

/**
   * If a 'Proxy-Connection' header has been added to the request,
   * it'll be of a 'keep-alive' type.  Until we support 'keep-alives',
   * override the Proxy-Connection setting and instead pass a 'close'
   * (Otherwise every request has to timeout before we notice
   * end-of-document).
   * @param method Method to find proxy-connection header in.
   */
  public void handleAddProxyConnectionHeader(HttpMethod method) {
    Header h = method.getRequestHeader("Proxy-Connection");
    if (h != null) {
      h.setValue("close");
      method.setRequestHeader(h);
    }
  }
}

代码示例来源:origin: harikrishnan83/rapa

@Override
  public Header getResponseHeader(String headerName) {
    Header header = new Header();
    header.setName("Cache-Control");
    header.setValue(cacheControlHeaderValue);
    return header;
  }
};

代码示例来源:origin: nextcloud/android-library

String redirectedDestination = redirectionBase + destinationPath;
destination.setValue(redirectedDestination);
method.setRequestHeader(destination);

相关文章