Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: Grails-Mail-1.0
-
Component/s: None
-
Labels:None
-
Environment:WinXP, Grails 1.1.1, plugins.mail=0.7.1, plugins.springws=0.2.3
Description
I have a grails-springws endpoint that is attempting to send an email using the grails-mail plugin. grails-mail supposedly supports use of a gsp to produce the message body even when there is no current request.
In my endpoint I successfully send a message using the 'html' format as follows and the endpoint will operate correctly:
def mailService
...
mailService.sendMail {
to 'you@example.com'
subject 'A subject'
html '<b>Hello</b> World'
}
But if I use the 'body' format, which uses an absolute path to a gsp as follows:
def mailService
...
mailService.sendMail {
to 'you@example.com'
subject 'A subject'
body view:'/myController/mail/myTemplate', model:['myInstance':myInstance]
}
... the email is sent, but the endpoint fails:
2009-09-25 16:44:47,415 [17613323@qtp0-33] ERROR mortbay.log - /my-project/services/MyRequest/MyRequest.wsdl
java.lang.IllegalStateException: WRITER
at org.mortbay.jetty.Response.getOutputStream(Response.java:564)
at javax.servlet.ServletResponseWrapper.getOutputStream(ServletResponseWrapper.java:112)
at org.codehaus.groovy.grails.web.sitemesh.GrailsPageResponseWrapper$6.create(GrailsPageResponseWrapper.java:137)
at com.opensymphony.module.sitemesh.filter.RoutableServletOutputStream.getDestination(RoutableServletOutputStream.java:35)
at com.opensymphony.module.sitemesh.filter.RoutableServletOutputStream.write(RoutableServletOutputStream.java:118)
at org.springframework.ws.transport.TransportOutputStream.write(TransportOutputStream.java:60)
It would appear that the mailService is writing its output in such a way that it is corrupting the output stream being used by the endpoint.
I see the exactly same thing with a service exposed via the CXF plugin.