本文整理了Java中javax.ws.rs.core.Cookie.getValue()
方法的一些代码示例,展示了Cookie.getValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cookie.getValue()
方法的具体详情如下:
包路径:javax.ws.rs.core.Cookie
类名称:Cookie
方法名:getValue
[英]Get the value of the cookie.
[中]获取cookie的值。
代码示例来源:origin: swagger-api/swagger-core
private static Map<String, String> getCookies(HttpHeaders headers) {
Map<String, String> output = new HashMap<String, String>();
if (headers != null) {
for (String key : headers.getCookies().keySet()) {
Cookie cookie = headers.getCookies().get(key);
output.put(key, cookie.getValue());
}
}
return output;
}
代码示例来源:origin: com.sun.jersey/jersey-server
@Override
public MultivaluedMap<String, String> getCookieNameValueMap() {
if (cookieNames == null || headersModCount != headers.getModCount()) {
cookieNames = new MultivaluedMapImpl();
for (Map.Entry<String, Cookie> e : getCookies().entrySet()) {
cookieNames.putSingle(e.getKey(), e.getValue().getValue());
}
}
return cookieNames;
}
代码示例来源:origin: jersey/jersey
buf.append(c.getName());
buf.append("</td><td>");
buf.append(c.getValue());
buf.append("</td></tr>");
代码示例来源:origin: jersey/jersey
@Override
public Object apply(ContainerRequest containerRequest) {
// TODO: cache?
MultivaluedMap<String, String> cookies = new MultivaluedStringMap();
for (Map.Entry<String, Cookie> e : containerRequest.getCookies().entrySet()) {
cookies.putSingle(e.getKey(), e.getValue().getValue());
}
try {
return extractor.extract(cookies);
} catch (ExtractorException ex) {
throw new ParamException.CookieParamException(ex.getCause(),
extractor.getName(), extractor.getDefaultValueString());
}
}
}
代码示例来源:origin: jersey/jersey
@Override
public Object apply(ContainerRequest containerRequest) {
// TODO: cache?
MultivaluedMap<String, String> cookies = new MultivaluedStringMap();
for (Map.Entry<String, Cookie> e : containerRequest.getCookies().entrySet()) {
cookies.putSingle(e.getKey(), e.getValue().getValue());
}
try {
return extractor.extract(cookies);
} catch (ExtractorException ex) {
throw new ParamException.CookieParamException(ex.getCause(),
extractor.getName(), extractor.getDefaultValueString());
}
}
}
代码示例来源:origin: jersey/jersey
@Override
public String toString(Cookie cookie) {
throwIllegalArgumentExceptionIfNull(cookie, LocalizationMessages.COOKIE_IS_NULL());
StringBuilder b = new StringBuilder();
b.append("$Version=").append(cookie.getVersion()).append(';');
b.append(cookie.getName()).append('=');
StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getValue());
if (cookie.getDomain() != null) {
b.append(";$Domain=");
StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getDomain());
}
if (cookie.getPath() != null) {
b.append(";$Path=");
StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getPath());
}
return b.toString();
}
代码示例来源:origin: jersey/jersey
@Override
public String toString(Cookie cookie) {
throwIllegalArgumentExceptionIfNull(cookie, LocalizationMessages.COOKIE_IS_NULL());
StringBuilder b = new StringBuilder();
b.append("$Version=").append(cookie.getVersion()).append(';');
b.append(cookie.getName()).append('=');
StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getValue());
if (cookie.getDomain() != null) {
b.append(";$Domain=");
StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getDomain());
}
if (cookie.getPath() != null) {
b.append(";$Path=");
StringBuilderUtils.appendQuotedIfWhitespace(b, cookie.getPath());
}
return b.toString();
}
代码示例来源:origin: jersey/jersey
if (!name.equals(((Cookie) v).getName())) {
c = new Cookie(name, c.getValue(), c.getPath(), c.getDomain(), c.getVersion());
if (!name.equals(((Cookie) value).getName())) {
cookies.add(new Cookie(name, c.getValue(), c.getPath(), c.getDomain(), c.getVersion()));
代码示例来源:origin: resteasy/Resteasy
@Override
public CompletionStage<Object> inject(HttpRequest request, HttpResponse response, boolean unwrapAsync)
{
Cookie cookie = request.getHttpHeaders().getCookies().get(paramName);
if (type.equals(Cookie.class)) return CompletableFuture.completedFuture(cookie);
if (cookie == null) return CompletableFuture.completedFuture(extractValues(null));
List<String> values = new ArrayList<String>();
values.add(cookie.getValue());
return CompletableFuture.completedFuture(extractValues(values));
}
代码示例来源:origin: resteasy/Resteasy
public String toString(Cookie value)
{
StringBuffer buf = new StringBuffer();
ServerCookie.appendCookieValue(buf, 0, value.getName(), value.getValue(), value.getPath(), value.getDomain(), null, -1, false);
return buf.toString();
}
}
代码示例来源:origin: resteasy/Resteasy
public void cookie(Cookie cookie)
{
if (!(Cookie.class.equals(cookie.getClass())))
{
cookie = new Cookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie.getVersion());
}
headers.add(HttpHeaders.COOKIE, cookie);
}
代码示例来源:origin: org.glassfish.jersey.core/jersey-server
@Override
public Object apply(ContainerRequest containerRequest) {
// TODO: cache?
MultivaluedMap<String, String> cookies = new MultivaluedStringMap();
for (Map.Entry<String, Cookie> e : containerRequest.getCookies().entrySet()) {
cookies.putSingle(e.getKey(), e.getValue().getValue());
}
try {
return extractor.extract(cookies);
} catch (ExtractorException ex) {
throw new ParamException.CookieParamException(ex.getCause(),
extractor.getName(), extractor.getDefaultValueString());
}
}
}
代码示例来源:origin: resteasy/Resteasy
@Override
public Invocation.Builder cookie(Cookie cookie)
{
if (!(Cookie.class.equals(cookie.getClass())))
{
cookie = new Cookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie.getVersion());
}
getHeaders().cookie(cookie);
return this;
}
代码示例来源:origin: apache/cxf
protected String getEncodedJwtToken(ContainerRequestContext requestContext) {
Cookie cookie = requestContext.getCookies().get(cookieName);
if (cookie == null || cookie.getValue() == null) {
throw new JoseException("JWT cookie is not available");
}
return cookie.getValue();
}
代码示例来源:origin: io.swagger/swagger-jaxrs
private static Map<String, String> getCookies(HttpHeaders headers) {
Map<String, String> output = new HashMap<String, String>();
if (headers != null) {
for (String key : headers.getCookies().keySet()) {
Cookie cookie = headers.getCookies().get(key);
output.put(key, cookie.getValue());
}
}
return output;
}
代码示例来源:origin: com.sun.jersey/jersey-bundle
@Override
public MultivaluedMap<String, String> getCookieNameValueMap() {
if (cookieNames == null || headersModCount != headers.getModCount()) {
cookieNames = new MultivaluedMapImpl();
for (Map.Entry<String, Cookie> e : getCookies().entrySet()) {
cookieNames.putSingle(e.getKey(), e.getValue().getValue());
}
}
return cookieNames;
}
代码示例来源:origin: org.jboss.resteasy/resteasy-client
public void cookie(Cookie cookie)
{
if (!(Cookie.class.equals(cookie.getClass())))
{
cookie = new Cookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie.getVersion());
}
headers.add(HttpHeaders.COOKIE, cookie);
}
代码示例来源:origin: apache/cxf
private void doLogout(Cookie context, SecurityContext sc) {
if (context == null || sc.getUserPrincipal() == null || sc.getUserPrincipal().getName() == null) {
reportError("MISSING_RESPONSE_STATE");
throw ExceptionUtils.toBadRequestException(null, null);
}
stateProvider.removeResponseState(context.getValue());
}
代码示例来源:origin: org.jboss.resteasy/resteasy-client
@Override
public Invocation.Builder cookie(Cookie cookie)
{
if (!(Cookie.class.equals(cookie.getClass())))
{
cookie = new Cookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie.getVersion());
}
getHeaders().cookie(cookie);
return this;
}
代码示例来源:origin: org.apache.openejb/javaee-api
public NewCookie(Cookie cookie, String comment, int maxAge, boolean isSecure) {
super(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie
.getVersion());
this.comment = comment;
this.maxAge = maxAge;
this.isSecure = isSecure;
}
内容来源于网络,如有侵权,请联系作者删除!