Browse Source
Although ServletHttpRequest provides access to Cookies, other implementations may not. At the moment this was only needed for SockJS to check the value of the JSESSIONID cookie. This is now down by parsing the raw cookie values locally. If comprehensive cookie support is to be added, we should probably consider HttpHeaders as a potential candidate.pull/336/head
5 changed files with 18 additions and 182 deletions
@ -1,73 +0,0 @@
@@ -1,73 +0,0 @@
|
||||
/* |
||||
* Copyright 2002-2013 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.http; |
||||
|
||||
|
||||
/** |
||||
* Representation of a cookie value parsed from a "Cookie" request header or a |
||||
* "Set-Cookie" response header. |
||||
* |
||||
* @author Rossen Stoyanchev |
||||
* @since 4.0 |
||||
* |
||||
* @see http://www.ietf.org/rfc/rfc2109.txt
|
||||
*/ |
||||
public interface Cookie { |
||||
|
||||
/** |
||||
* Returns the name of the cookie. |
||||
*/ |
||||
String getName(); |
||||
|
||||
/** |
||||
* Returns the value of the cookie. |
||||
*/ |
||||
String getValue(); |
||||
|
||||
/** |
||||
* Returns the path on the server to which the browser returns this cookie. |
||||
*/ |
||||
String getPath(); |
||||
|
||||
/** |
||||
* Returns the comment describing the purpose of this cookie. |
||||
*/ |
||||
String getComment(); |
||||
|
||||
/** |
||||
* Returns the domain name set for this cookie. |
||||
*/ |
||||
String getDomain(); |
||||
|
||||
/** |
||||
* Returns the maximum age of the cookie, specified in seconds. |
||||
*/ |
||||
int getMaxAge(); |
||||
|
||||
/** |
||||
* Returns <code>true</code> if the browser is sending cookies only over a |
||||
* secure protocol, or <code>false</code> if the browser can send cookies |
||||
* using any protocol. |
||||
*/ |
||||
boolean isSecure(); |
||||
|
||||
/** |
||||
* Sets the version of the cookie protocol this cookie complies with. |
||||
*/ |
||||
int getVersion(); |
||||
|
||||
} |
||||
@ -1,80 +0,0 @@
@@ -1,80 +0,0 @@
|
||||
/* |
||||
* Copyright 2002-2012 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.http.server; |
||||
|
||||
import org.springframework.http.Cookie; |
||||
|
||||
|
||||
/** |
||||
* A {@link Cookie} that wraps a {@link javax.servlet.http.Cookie}. |
||||
* |
||||
* @author Rossen Stoyanchev |
||||
* @since 4.0 |
||||
*/ |
||||
public class ServletServerCookie implements Cookie { |
||||
|
||||
private final javax.servlet.http.Cookie servletCookie; |
||||
|
||||
|
||||
public ServletServerCookie(javax.servlet.http.Cookie servletCookie) { |
||||
this.servletCookie = servletCookie; |
||||
} |
||||
|
||||
@Override |
||||
public String getName() { |
||||
return this.servletCookie.getName(); |
||||
} |
||||
|
||||
@Override |
||||
public String getValue() { |
||||
return this.servletCookie.getValue(); |
||||
} |
||||
|
||||
@Override |
||||
public String getPath() { |
||||
return this.servletCookie.getPath(); |
||||
} |
||||
|
||||
@Override |
||||
public String getComment() { |
||||
return this.servletCookie.getComment(); |
||||
} |
||||
|
||||
@Override |
||||
public String getDomain() { |
||||
return this.servletCookie.getDomain(); |
||||
} |
||||
|
||||
@Override |
||||
public int getMaxAge() { |
||||
return this.servletCookie.getMaxAge(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean isSecure() { |
||||
return this.servletCookie.getSecure(); |
||||
} |
||||
|
||||
@Override |
||||
public int getVersion() { |
||||
return this.servletCookie.getVersion(); |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return "ServletServerCookie [servletCookie=" + this.servletCookie + "]"; |
||||
} |
||||
} |
||||
Loading…
Reference in new issue