标签: grails-2.0.4

如何绕过Spring安全登录检查grails

我有控制器方法,它返回json数据,没有安全检查逻辑.

def getJsonData(){
 // return json

}
Run Code Online (Sandbox Code Playgroud)

我正在从另一台服务器(跨域)的php页面做ajax请求.

      $.ajax({
             type: "GET",
             url: "http://localhost:8080/training/getJsonData",
             data: { ListID: '1'},
              dataType: "jsonp",
              success: function(data) {
               alert('Hi'+data);
                $("#success").html(data);

            }
         });
Run Code Online (Sandbox Code Playgroud)

数据不是来自服务器,只有在用户登录到应用服务器时才有效.如何在不检查grails登录的情况下提供这些请求.

php ajax grails spring-security grails-2.0.4

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

如何告诉Grails将JSONNull渲染为null?

我有一个从Groovy的HTTPBuilder返回的JSON对象.JSON包含一些表示为JSONNull对象的空值.问题是当我尝试在响应中渲染JSON时,我在尝试渲染JSONNull时出现错误.我得到的回复只是部分呈现的.我希望它呈现为"null".我该怎么做呢?

码:

render(contentType: "text/json") {
    listOfJSONObjectsThatIncludeJSONNulls
}
Run Code Online (Sandbox Code Playgroud)

错误:

| Error 2013-09-17 11:33:56,965 [http-bio-8080-exec-4] ERROR errors.GrailsExceptionResolver  - JSONException occurred when processing request: [GET] /my/action
Object is null. Stacktrace follows:
Message: Object is null
   Line | Method
->>  69 | isEmpty        in net.sf.json.JSONNull
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   199 | …
Run Code Online (Sandbox Code Playgroud)

null grails json grails-2.0.4

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

标签 统计

grails ×2

grails-2.0.4 ×2

ajax ×1

json ×1

null ×1

php ×1

spring-security ×1