javax.ws.rs.core.Cookie.toString()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(128)

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

Cookie.toString介绍

[英]Convert the cookie to a string suitable for use as the value of the corresponding HTTP header.
[中]将cookie转换为适合用作相应HTTP头的值的字符串。

代码示例

代码示例来源:origin: resteasy/Resteasy

outList.add(new HeaderHolder(HeaderHolder.Type.COOKIE, Cookie.class.cast(o).toString()));

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

String[] cookieArray = new String[cookies.size()];
     //copy your List of Strings into the Array 
     int i=0;
     for(Cookie c : cookies ){
       cookieArray[i]=c.toString();
       i++;
      }
     //then pass it in your intent
     Intent intent = new Intent(this, Login.class);
     intent.putExtra("cookieArray", cookieArray);
     startActivity(i);

代码示例来源:origin: apache/cxf

/**
 * {@inheritDoc}
 */
@Override
public Client cookie(Cookie cookie) {
  possiblyAddHeader(HttpHeaders.COOKIE, cookie.toString());
  return this;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-rs-client

/**
 * {@inheritDoc}
 */
@Override
public Client cookie(Cookie cookie) {
  possiblyAddHeader(HttpHeaders.COOKIE, cookie.toString());
  return this;
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

/**
 * {@inheritDoc}
 */
public Client cookie(Cookie cookie) {
  possiblyAddHeader(HttpHeaders.COOKIE, cookie.toString());
  return this;
}

代码示例来源:origin: org.apache.wink/wink-client

public Resource cookie(Cookie value) {
  return cookie(value.toString());
}

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

WebDriver driver = new FirefoxDriver();
driver.get("https://www.google.com");

Path cookiesFile = Paths.get("C:\\Temp\\cookies.txt");

// save the cookies to a file for the current domain
try (PrintWriter file = new PrintWriter(cookiesFile.toFile(), "UTF-8")) {
  for (Cookie c : driver.manage().getCookies()) {
    file.println(c.toString());
  }
}

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

List<Cookie> cookies = ((DefaultHttpClient)httpclient).getCookieStore().getCookies();
for(Cookie cookie : cookies){
Log.i("Cookie", cookie.toString());

代码示例来源:origin: org.jboss.resteasy/resteasy-cache-core

outList.add(new HeaderHolder(HeaderHolder.Type.COOKIE, Cookie.class.cast(o).toString()));

代码示例来源:origin: apache/cxf

private static Object processCookieParam(Message m, String cookieName,
             Class<?> pClass, Type genericType,
             Annotation[] paramAnns, String defaultValue) {
  Cookie c = new HttpHeadersImpl(m).getCookies().get(cookieName);
  if (c == null && defaultValue != null) {
    c = Cookie.valueOf(cookieName + '=' + defaultValue);
  }
  if (c == null) {
    return null;
  }
  if (pClass.isAssignableFrom(Cookie.class)) {
    return c;
  }
  String value = InjectionUtils.isSupportedCollectionOrArray(pClass)
    && InjectionUtils.getActualType(genericType) == Cookie.class
    ? c.toString() : c.getValue();
  return InjectionUtils.createParameterObject(Collections.singletonList(value),
                        pClass,
                        genericType,
                        paramAnns,
                        null,
                        false,
                        ParameterType.COOKIE,
                        m);
}

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

public InputStream httpGetLowLevel(URL url) throws IOException
{
  WebRequest wrq=new WebRequest(url);

  ProxyConfig config =webClient.getProxyConfig();

  //set request webproxy
  wrq.setProxyHost(config.getProxyHost());
  wrq.setProxyPort(config.getProxyPort());
  wrq.setCredentials(webClient.getCredentialsProvider().getCredentials(new AuthScope(config.getProxyHost(), config.getProxyPort())));
  for(Cookie c:webClient.getCookieManager().getCookies(url)){
    wrq.setAdditionalHeader("Cookie", c.toString());            
  }           
  WebResponse wr= webClient.getWebConnection().getResponse(wrq);
  return wr.getContentAsStream();
}

相关文章