本文整理匯總了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();
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
};
}
示例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;
}