小编mru*_*lan的帖子

Set-Cookie Header位于响应中,但浏览器未在下一个请求中设置Cookie

我正在开发一个需要状态良好的REST Api(没有解决方法,我使用的是没有可序列化对象的本机库等)

此Rest API在域domainA上的Web服务器上公开.响应包含一个设置为*的Access-Control-Allow-Origin标头,所以我不需要JSON-P.(我不知道这个细节是否关心).

我在请求DomainA的domainB上做了一个GWT使用此API的示例.浏览器不会添加先前设置的cookie.它的作品"无国籍".

样本也必须在DomainA上吗?是否有设置工作区或特定标题?

编辑:我在Cookie中设置了一个主域名.它不起作用.浏览器仍然没有在下一个请求标头中设置cookie会话.

请求:

HeadersPreviewResponseCookiesTiming
Request URL:http://subdomainB.mydomain.com/request
Request Method:POST
Status Code:200 OK
Request Headersview source
Accept:*/*
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
Content-Length:1185
Content-type:application/x-www-form-urlencoded
Host:subdomainB.mydomain.com
Origin:http://subdomainA.mydomain.com
Referer:http://subdomainA.mydomain.com/BLABLABLA
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.8 (KHTML, like Gecko) Chrome/20.0.1105.0 Safari/536.8
Run Code Online (Sandbox Code Playgroud)

响应:

Response Headersview source
Access-Control-Allow-Origin:*
Cache-Control:no-cache, no-store, max-age=0
Connection:Keep-Alive
Content-Language:fr-FR
Content-Type:application/json;charset=UTF-8
Date:Wed, 25 Apr 2012 07:59:03 GMT
Expires:Thu, 01 Jan 1970 00:00:00 GMT, Thu, 01 Jan 1970 00:00:00 GMT
Keep-Alive:timeout=15, max=100
Pragma:no-cache
Server:Jetty(7.5.4.v20111024)
Set-Cookie:JSESSIONID=cookieValue;Path=/;Domain=.mydomain.com
Transfer-Encoding:chunked
Run Code Online (Sandbox Code Playgroud)

cookies rest session json http

9
推荐指数
1
解决办法
6659
查看次数

使用 Spring EL 的复杂表达式(条件和括号)

我正在使用具有弹簧安全性的 spring-EL

是否可以使用括号制作“复杂”的条件表达式?

@PreAuthorize("( hasRole('ROLE_USER') and ( isOwnerDocumentUUID( #docUuids ) ) or hasRole('ROLE_ADMIN')  ")
Run Code Online (Sandbox Code Playgroud)

抛出一个 java.lang.IllegalArgumentException:

解析表达式失败

@PreAuthorize("hasRole('ROLE_USER') and ( isOwnerDocumentUUID( #docUuids ) ")
Run Code Online (Sandbox Code Playgroud)

被接受。

spring spring-security spring-el

6
推荐指数
1
解决办法
2894
查看次数

JQ:当属性值存在于 bash 数组中时选择

我正在使用 jq 1.4。当我的$selected_subnets(bash 变量)中存在 VPCZoneIdentifier 时,我尝试选择元素。

selected_subnets="valueA valueB"

input='{"elements":[
           {"name": "nameA", "VPCZoneIdentifier": "valueA"}, 
           {"name": "nameB", "VPCZoneIdentifier": "valueB"}, 
           {"name": "nameC", "VPCZoneIdentifier": "valueC"}
       ]}'
Run Code Online (Sandbox Code Playgroud)

testmatchfn 仅在 v1.5 上可用。

bash amazon-ec2 vpc jq

3
推荐指数
1
解决办法
1182
查看次数

标签 统计

amazon-ec2 ×1

bash ×1

cookies ×1

http ×1

jq ×1

json ×1

rest ×1

session ×1

spring ×1

spring-el ×1

spring-security ×1

vpc ×1