O Grails falha ao analisar a solicitação quando o tipo de conteúdo é especificado durante a postagem
Usandowget
Eu faço dois posts no mesmo URL com xml no corpo. Os primeiros trabalhos. O segundo tem o tipo de conteúdo especificado e não funciona. Por que isso e como faço para que o grails analise a solicitação mesmo quando o tipo de conteúdo é especificado?
primeiro wget:
wget http://localhost:8080/myApp/myMoeView/save --post-file=xmltest.xml
Registros do Grails (observe os "parâmetros analisados"):
2014-02-27 18:44:05,465 [http-bio-8080-exec-9] INFO httplogger.DefaultHttpLogger - << #3425 POST http://localhost:8080/myApp/mrMoeView/save
2014-02-27 18:44:05,465 [http-bio-8080-exec-9] INFO httplogger.DefaultHttpLogger - << #3425 headers [Cookie: JSESSIONID=D5B2399D6FFB800130E826DCD7DB0C37]
2014-02-27 18:44:05,465 [http-bio-8080-exec-9] INFO httplogger.DefaultHttpLogger - << #3425 body: ''
2014-02-27 18:44:05,491 [http-bio-8080-exec-9] INFO httplogger.DefaultHttpLogger - << #3425 dispatched to mrMoeView/save with parsed params ['<?xml version':'{"1.0" encoding="UTF-8" standalone="yes"?><mrMoeView><absoluteTolerance>1.004</absoluteTolerance><endTime>0</endTime><id>4187</id><lastModified>2014-01-07 00:00:00.000 PST</lastModified><modelRealizationId>1193</modelRealizationId><mrMoeId>4187</mrMoeId><mrMoeName>Default MOE from Model 2140</mrMoeName><relativeTolerance>1e-4</relativeTolerance><startTime>0</startTime></mrMoeView>
segundo wget:
wget http://localhost:8080/myApp/mrMoeView/save --post-file=xmltest.xml --header="Content-Type:application/xml"
Registros do Grails (observe nenhum parâmetro analisado e o corpo possui todo o xml):
2014-02-27 18:46:27,291 [http-bio-8080-exec-5] INFO httplogger.DefaultHttpLogger - << #3427 POST http://localhost:8080/processdb/mrMoeView/save
2014-02-27 18:46:27,291 [http-bio-8080-exec-5] INFO httplogger.DefaultHttpLogger - << #3427 headers [Cookie: JSESSIONID=B1FAAB54422AC7F1E243D4CE68C72B77]
2014-02-27 18:46:27,291 [http-bio-8080-exec-5] INFO httplogger.DefaultHttpLogger - << #3427 body: '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><mrMoeView><absoluteTolerance>1.004</absoluteTolerance><endTime>0</endTime><id>4187</id><lastModified>2014-01-07 00:00:00.000 PST</lastModified><modelRealizationId>1193</modelRealizationId><mrMoeId>4187</mrMoeId><mrMoeName>Default MOE from Model 2140</mrMoeName><relativeTolerance>1e-4</relativeTolerance><startTime>0</startTime></mrMoeView>'
2014-02-27 18:46:27,320 [http-bio-8080-exec-5] INFO httplogger.DefaultHttpLogger - << #3427 dispatched to mrMoeView/save with parsed params [].
Grails versão 2.3.5
ATUALIZAR
UrlMapping:
class UrlMappings {
static mappings = {
"/$controller/$action?/$id?"(parseRequest:true){
constraints {
// apply constraints here
}
}
"/"(view:"/index")
"500"(view:'/error')
}
}