This is documentation for an earlier version of webMathematica.
View current User Guide (Version 3.3)

MSPReturn


return the result with the specified MIME content type

set the filename associated with the response
  • MSPReturn allows a page to return something that is not an HTML result.
  • The three-argument form of MSPReturn is useful when you wish to set the filename associated with the response.
This example returns a Mathematica notebook directly to the client.
This example returns an XML fragment. These techniques can be useful for making informal web services for working with technologies such as Flash or JavaScript that have convenient tools for processing XML.
The three-argument form of MSPReturn is useful when you wish to set the filename associated with the response.
In this case the client might try to use a filename of mynotebook.nb. It should also be noted that for some clients, such as Internet Explorer, setting the filename header can cause the display of two Open or Save dialog boxes.
This example returns a Mathematica notebook directly to the client.
<msp:evaluate>
MSPReturn[ Notebook[ Cell[ "Hello", "Title"]],
"application/mathematica"]
</msp:evaluate>
This example returns an XML fragment. These techniques can be useful for making informal web services for working with technologies such as Flash or JavaScript that have convenient tools for processing XML.
<msp:evaluate>
MSPReturn[ ExportString[XMLElement["arg1", {}, {"5 6"}], "XML"],
"text/xml"]
</msp:evaluate>
The three-argument form of MSPReturn is useful when you wish to set the filename associated with the response.
<msp:evaluate>
MSPReturn[ Notebook[ Cell[ "Hello", "Title"]],
"application/mathematica", "mynotebook.nb"]
</msp:evaluate>
In this case the client might try to use a filename of mynotebook.nb. It should also be noted that for some clients, such as Internet Explorer, setting the filename header can cause the display of two Open or Save dialog boxes.