小编Vee*_*ndi的帖子

HTTP选项转发前请求已加载已取消,Chrome中有待处理状态

我正在使用Sencha Touch 2.1.0.我正在进行HTTP GET调用.这是一个CORS请求.因此它正在按预期发送Pre-flight HTTP OPTIONS命令.

我在我的服务器上安装了CORS过滤器并进行了配置.来自我的代码的电话一直很顺利,直到昨天.突然间它今天停止加载数据.当我在Chrome中查看网络电话时,我发现OPTIONS方法显示为"已取消加载"

方法:选项
状态文本:"加载取消"
类型:待定
启动器:Connection.js:319

我第一次配置CORS过滤器时遇到了类似的问题.当我清除浏览器缓存时,它开始工作.这一次,我不确定它为什么突然停止工作.即使我在浏览器中清除缓存和历史记录,也无法修复.

如果我在Firefox中使用HTTPRequestor进行同样的调用,那么它的效果非常好.这是电话.由于保密原因,我屏蔽了网址.

OPTIONS http://myurl/rest/items?_dc=1358304888220&page=1&start=0&limit=25 HTTP/1.1
Access-Control-Request-Method: GET
Origin: http://localhost:8080
Access-Control-Request-Headers: accept, origin, x-requested-with
Run Code Online (Sandbox Code Playgroud)

同样的确切请求给了我一个非常好的HTTPRequestor响应.结果如下:

OPTIONS http://myurl/rest/items?_dc=1358304888220&page=1&start=0&limit=25
Access-Control-Request-Headers: accept, origin, x-requested-with
Access-Control-Request-Method: GET
Origin: http://localhost:8080


 -- response --
200 OK
Date:  Wed, 16 Jan 2013 03:19:27 GMT

Server:  Apache-Coyote/1.1

Access-Control-Allow-Origin:  http://localhost:8080

Access-Control-Allow-Credentials:  true

Access-Control-Allow-Methods:  HEAD, GET, POST, OPTIONS

Access-Control-Allow-Headers:  X-Requested-With, Origin, Accept, Content-Type

Content-Length:  0

Strict-Transport-Security:  max-age=15768000, includeSubDomains

Keep-Alive:  timeout=15, max=100

Connection:  Keep-Alive
Run Code Online (Sandbox Code Playgroud)

在商店中使用Sencha代码进行此调用:

    proxy: {
        type: 'ajax',
        method: 'GET', …
Run Code Online (Sandbox Code Playgroud)

google-chrome cors http-options-method sencha-touch-2

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

如何将Calendar param作为输入传递给rest服务?

这是我想要做的:

@POST
@Path("/MyPath")
@Produces("text/xml")
@RolesAllowed({"user"})
public Output myMethod (@QueryParam("itemId") long ItemId, 
                                    @QueryParam("plannedstartdate") Calendar plannedStartDate, 
                                    @QueryParam("plannedreturndate") Calendar plannedReturnDate)
Run Code Online (Sandbox Code Playgroud)

我正在使用JBoss AS7.据我所知,resteasy已集成到JBoss AS7中.我能够运行简单的休息服务.

我找到的关于传递日期的唯一文档位于以下链接:http: //docs.jboss.org/resteasy/2.0.0.GA/userguide/html/StringConverter.html#StringParamUnmarshaller

由于说明不明确,我无法遵循此并解决问题.当我尝试创建示例中给出的注释DateFormat时,它无法识别StringParamUnmarshaller.我不知道从哪里得到它.如果resteasy已经集成到JBoss AS7中,这不应该被识别吗?

我的pom.xml具有以下依赖项:

  <!-- Import the JAX-RS API, we use provided scope as the API is included 
     in JBoss AS 7 -->
  <dependency>
     <groupId>org.jboss.spec.javax.ws.rs</groupId>
     <artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
     <scope>provided</scope>
  </dependency>
Run Code Online (Sandbox Code Playgroud)

对此方法的调用失败,因为不会发生字符串到日历的转换.我不想传递String而不是Calendar,因为有其他客户端直接调用java.任何人都可以帮助我如何将日期传递给Rest Calls?

谢谢Veer

rest date jax-rs resteasy jboss7.x

2
推荐指数
1
解决办法
3882
查看次数