小编flu*_*xon的帖子

Grails查询标准:如何使用列返回地图?

是否可以使用条件查询grails并接收地图列表而不是列表列表?我想在结果中使用列名称,然后使用"关联数组"而不是数组数组偏移.我现在做的事情就像

    def topFiveUsers = BlogEntry.createCriteria().list {
        projections {
            count('id')
            groupProperty('author')
        }
        maxResults 5
    }
Run Code Online (Sandbox Code Playgroud)

结果[[123, app.User:1][111, app.User:2][...]...],即列表列表.我宁愿想要类似的东西[[posts:123, author: app.User:1][posts: 111, author app.User:2][...]...].

一如既往:非常感谢帮助!

grails hibernate createcriteria

13
推荐指数
2
解决办法
6620
查看次数

使用单个htpasswd密码保护devel grails应用程序

我正在向公共领域的一些同事展示一个grails应用程序.到目前为止,我正在开发模式,并没有通过战争部署.

我需要确保应用程序安全,以防止他们查看/播放它.我已经有一个用户mgmt,但在sb看到任何我希望有.htpasswd之类的保护之前.如果可能的话,我不想用插件扩展应用程序本身(例如,shiro).

有什么想法/建议?

非常感谢!

security grails basic-authentication .htpasswd

5
推荐指数
1
解决办法
1459
查看次数

IndexOutOfBounds使用Javas imageio.write()创建png格式的字节数组

javax.imageio.ImageIO用来将a BufferedImage b写入字节数组,最后写入文件。创建字节数组时,十分之十java.lang.IndexOutOfBoundsException会抛出a。但是,仅使用相同的图像是无法复制的。

BufferedImage img = ...
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// the next line will lead to the exception being thrown
ImageIO.write(img, "png", baos);
byte[] byteArray = baos.toByteArray()
Run Code Online (Sandbox Code Playgroud)

结果是:

java.lang.IndexOutOfBoundsException
Line | Method
->>  166 | seek                       in
javax.imageio.stream.FileCacheImageOutputStream
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - …
Run Code Online (Sandbox Code Playgroud)

java png bytearray exception javax.imageio

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