當前位置: 首頁>>代碼示例>>Java>>正文


Java NewCookie.getValue方法代碼示例

本文整理匯總了Java中javax.ws.rs.core.NewCookie.getValue方法的典型用法代碼示例。如果您正苦於以下問題:Java NewCookie.getValue方法的具體用法?Java NewCookie.getValue怎麽用?Java NewCookie.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.ws.rs.core.NewCookie的用法示例。


在下文中一共展示了NewCookie.getValue方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getJsessionFromServer

import javax.ws.rs.core.NewCookie; //導入方法依賴的package包/類
/**
 *
 * @param client
 * @return
 */
protected String getJsessionFromServer(Client client) {
	Options options = new Options();
	options.setMonitor(true);
	MessageFromClient mfc = getMessageFromClient(OcelotServices.class, "initCore", getJson(options));
	WebTarget target = client.target("http://localhost:" + PORT + "/" + CTXPATH).path("ocelot").path("endpoint");
	Response res = target.request(MediaType.APPLICATION_FORM_URLENCODED).accept(MediaType.APPLICATION_JSON).post(Entity.form(new Form("mfc", mfcToJson(mfc))));
	res.readEntity(String.class);
	res = target.request(MediaType.APPLICATION_FORM_URLENCODED).accept(MediaType.APPLICATION_JSON).post(Entity.form(new Form("mfc", mfcToJson(mfc))));
	NewCookie jsession = res.getCookies().get("JSESSIONID");
	String result = res.readEntity(String.class);
	try {
		MessageToClient mtc = mtcFromJson(result);
		assertThat(mtc.getType()).isEqualTo(MessageType.RESULT);
	} catch (Throwable t) {
		t.printStackTrace();
	}
	return jsession.getValue();
}
 
開發者ID:ocelotds,項目名稱:ocelot,代碼行數:24,代碼來源:AbstractOcelotTest.java

示例2: toVertxCookie

import javax.ws.rs.core.NewCookie; //導入方法依賴的package包/類
public static io.vertx.ext.web.Cookie toVertxCookie(final NewCookie cookie) {

        final io.vertx.ext.web.Cookie vertxCookie = new CookieImpl(cookie.getName(), cookie.getValue());
        vertxCookie.setPath(cookie.getPath());
        vertxCookie.setDomain(cookie.getDomain());
        vertxCookie.setHttpOnly(cookie.isHttpOnly());
        vertxCookie.setChanged(true);
        vertxCookie.setMaxAge(cookie.getMaxAge());
        vertxCookie.setSecure(cookie.isSecure());
        return vertxCookie;
    }
 
開發者ID:trajano,項目名稱:app-ms,代碼行數:12,代碼來源:Conversions.java

示例3: makeHttpRequest

import javax.ws.rs.core.NewCookie; //導入方法依賴的package包/類
@Override
public HttpResponse makeHttpRequest(Entity entity, long startTime) {
    String method = request.getMethod();
    if ("PATCH".equals(method)) { // http://danofhisword.com/dev/2015/09/04/Jersey-Client-Http-Patch.html
        builder.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
    }
    Response resp;
    if (entity != null) {
        resp = builder.method(method, entity);
    } else {
        resp = builder.method(method);
    }
    byte[] bytes = resp.readEntity(byte[].class);
    long responseTime = getResponseTime(startTime);
    HttpResponse response = new HttpResponse(responseTime);
    response.setUri(getRequestUri());
    response.setBody(bytes);
    response.setStatus(resp.getStatus());
    for (NewCookie c : resp.getCookies().values()) {
        com.intuit.karate.http.Cookie cookie = new com.intuit.karate.http.Cookie(c.getName(), c.getValue());
        cookie.put(DOMAIN, c.getDomain());
        cookie.put(PATH, c.getPath());
        if (c.getExpiry() != null) {
            cookie.put(EXPIRES, c.getExpiry().getTime() + "");
        }
        cookie.put(SECURE, c.isSecure() + "");
        cookie.put(HTTP_ONLY, c.isHttpOnly() + "");
        cookie.put(MAX_AGE, c.getMaxAge() + "");
        response.addCookie(cookie);
    }
    for (Entry<String, List<Object>> entry : resp.getHeaders().entrySet()) {
        response.putHeader(entry.getKey(), entry.getValue());
    }
    return response;
}
 
開發者ID:intuit,項目名稱:karate,代碼行數:36,代碼來源:JerseyHttpClient.java

示例4: toString

import javax.ws.rs.core.NewCookie; //導入方法依賴的package包/類
@Override
public String toString(final NewCookie cookie) {
    final StringBuilder buf = new StringBuilder();
    buf.append(cookie.getName());
    buf.append('=');

    if (cookie.getValue() != null) {
        buf.append(cookie.getValue());
    }

    if (cookie.getPath() != null && cookie.getPath().length() > 0) {
        buf.append(";Path=").append(cookie.getPath());
    }

    if (cookie.getDomain() != null && cookie.getDomain().length() > 0) {
        buf.append(";Domain=").append(cookie.getDomain());
    }

    if (cookie.getMaxAge() >= 0) {
        buf.append(";Max-Age=");
        buf.append(cookie.getMaxAge());
    }

    if (cookie.isSecure()) {
        buf.append(";Secure");
    }

    if (cookie.isHttpOnly()) {
        buf.append(";HttpOnly");
    }

    return buf.toString();
}
 
開發者ID:minijax,項目名稱:minijax,代碼行數:34,代碼來源:MinijaxNewCookieDelegate.java

示例5: withCookieValue

import javax.ws.rs.core.NewCookie; //導入方法依賴的package包/類
public static Matcher<NewCookie> withCookieValue(final String value) {
    return new FeatureMatcher<NewCookie, String>(equalTo(value), "with cookie value", "cookie value") {
        @Override
        protected String featureValueOf(NewCookie actual) {
            return actual.getValue();
        }
    };
}
 
開發者ID:valid4j,項目名稱:http-matchers,代碼行數:9,代碼來源:NewCookieMatchers.java

示例6: mapCookie

import javax.ws.rs.core.NewCookie; //導入方法依賴的package包/類
private static Cookie mapCookie ( final Map.Entry<String, NewCookie> entry )
{
    final String name = entry.getKey ();
    final NewCookie nc = entry.getValue ();

    final Cookie cookie = new Cookie ( name, nc.getValue () );
    cookie.setComment ( nc.getComment () );
    cookie.setDomain ( nc.getDomain () );
    cookie.setHttpOnly ( nc.isHttpOnly () );
    cookie.setMaxAge ( nc.getMaxAge () );
    cookie.setPath ( nc.getPath () );
    cookie.setSecure ( nc.isSecure () );
    cookie.setVersion ( nc.getVersion () );
    return cookie;
}
 
開發者ID:eclipse,項目名稱:packagedrone,代碼行數:16,代碼來源:JaxRsResponseHandler.java


注:本文中的javax.ws.rs.core.NewCookie.getValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。