MSPReturn


return the result with the specified MIME content type


set the filename associated with the response

DetailsDetails

  • 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.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

This example returns a Mathematica notebook directly to the client.

<msp:evaluate>
MSPReturn[ ToString[Notebook[{ Cell[ "Hello", "Title"]}], InputForm],
"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[ ToString[Notebook[{ Cell[ "Hello", "Title"]}], InputForm],
"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.