11.07.2015 Views

webMathematica™ Wolfram - Wolfram Research

webMathematica™ Wolfram - Wolfram Research

webMathematica™ Wolfram - Wolfram Research

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

of request very convenient. However, it is also very useful to be able to return other formatssuch as Mathematica notebooks or TeX documents. Mathematica commands for generatingwebMathematica User Guide 125browser, it can often launch a helper application that provides special functionality for thatformat. This section discusses how to use webMathematica to return general content of differentformats.Direct ReturnThe simplest way to return content type other than HTML is to write a page that only returnsyour data. If your data is static, you should insert it into the page. Alternatively, if it has to begenerated each time by Mathematica, you should just have an evaluate tag that returns yourdata and not use any HTML markup. It is a good idea to set the content type at the top of thepage. This technique can be useful for AJAX and web service interactions. An example follows.MSPFormat[ Integrate[ 1/(1-x^3),x], StandardForm, RawMathML]An alternative to using a page directive is to use the ContentType option of MSPPageOptions.The following example demonstrates how this can be done.MSPPageOptions[ ContentType -> "text/mathml"]MSPFormat[ Integrate[ 1/(1-x^3),x], StandardForm, RawMathML]It is probably more convenient just to use the page directory.MSPReturnWhen an MSP script evaluates MSPReturn, the processing of the script is terminated and thefirst argument is immediately returned. The second argument specifies the content type. In thisexample a notebook object is returned, and the result is set to be application/mathematica.MSPReturn[ "Notebook[Cell[\"Hello\",\"Title\"]]","application/mathematica"]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!