我有一个使用我创建的插件的Grails应用程序。两者都使用Spring-security-core插件。
我的插件有域类,控制器和视图。要显示的数据是从地图上绘制的线中选择的。返回的数据显示在浏览器窗口底部的列表中。我在其中一个应该显示所选记录的字段上创建了一个链接。
当我点击此链接时,我收到以下错误:
| Error 2014-05-27 16:14:11,415 [http-bio-8082-exec-6] ERROR errors.GrailsExceptionResolver - StreamCorruptedException occurred when processing request: [GET] /test/bridge/show/661
invalid stream header: 8401FE00. Stacktrace follows:
Message: invalid stream header: 8401FE00
Line | Method
->> 802 | readStreamHeader in java.io.ObjectInputStream
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 299 | <init> in ''
| 55 | show . . . . . . in RIMS.bridge.BridgeController
| 195 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter . . . . in grails.plugin.cache.web.filter.AbstractFilter
| 53 | doFilter in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
| 49 | doFilter . . . . in grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter
| 82 | doFilter in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 1145 | runWorker . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | run . . . . . . in java.lang.Thread
失败的代码是我尝试使用以下操作获取ID的数据:
@Secured(["hasRole('ROLE_MAP_USER')"])
def show(Long id) {
println "ID: ${id}"
def princObj = springSecurityService?.principal
log.debug "User: ${princObj}"
def bridgeInstance = RIMS.bridge.Bridge.get(id)
if (!bridgeInstance) {
flash.message = message(code: 'default.not.found.message', args: [message(code: 'bridge.label', default: 'Bridge'), id])
redirect(action: "list")
return
}
render(plugin: "nhvr", view:"show", model: [bridgeInstance: bridgeInstance])
}
返回的用户,退回到log.debug&#34;用户:$ {princObj}&#34;是正确的,并具有所需的角色。
我不知道该怎么办。任何人都可以建议尝试一下吗?
以下是Bridge类的代码:
package RIMS.bridge
class Bridge {
String bridgeNo
String roadNo
BigDecimal linkNo
BigDecimal chng
String travelDirectionCode
BigDecimal northing
BigDecimal easting
String overUnderCode
Date dateActive
Date dateArchived
String tranUser
Date tranDateTime
String tranType
Serializable obj
String cwayCode
String constructed
static hasMany = [
bridgeClearances: BridgeClearance,
bridgeCulverts: BridgeCulvert,
bridgeDimensions: BridgeDimension,
bridgeDrawings: BridgeDrawing,
bridgeDucts: BridgeDuct,
bridgeHydraulics: BridgeHydraulic,
bridgeMaintenances: BridgeMaintenance,
bridgeMiscellaneouses: BridgeMiscellaneous,
bridgeParts: BridgePart,
bridgeServices: BridgeService,
bridgeSpans: BridgeSpan,
bridgeSubstructures: BridgeSubstructure,
bridgeSuperstructures: BridgeSuperstructure]
static mapping = {
id generator: "assigned"
version false
}
static constraints = {
bridgeNo maxSize: 10
roadNo nullable: true, maxSize: 5
linkNo nullable: true
chng nullable: true
travelDirectionCode maxSize: 10
northing nullable: true
easting nullable: true
overUnderCode maxSize: 10
dateArchived nullable: true
tranUser maxSize: 30
tranType maxSize: 6
obj nullable: true
cwayCode nullable: true, maxSize: 4
constructed nullable: true, maxSize: 3
}
def locateByBridgeNo(String bridgeNo){
println "locating by no: ${bridgeNo}"
withCriteria{
eq('bridgeNo', bridgeNo)
}
}
static listActiveBridges(){
withCriteria(){
isNull('dateArchived')
}
}
static listBridgesByBridgeNo(String bridgeNo){
withCriteria(){
eq('bridgeNo', bridgeNo)
}
}
String toString(){
return "${bridgeNo} Road: ${roadNo}, Link: ${linkNo}, chainage: ${chng}"
}
}