Serving CDF from webMathematica

489 Views Asked by At

Suppose I enter the following (edited) snippet of code into Mathematica.

manip = Manipulate[x, {x, 0, 1}];
nb = Developer`UseFrontEnd[
    CreateDocument[manip, ShowCellBracket -> False, 
    Visible -> False]];
nbTest = ExportString[nb, "NB"] =!= $Failed;
cdfTest = ExportString[nb, "CDF"] =!= $Failed;
version = First[StringSplit[SystemInformation["Kernel", "ReleaseID"]]];
{{nbTest, cdfTest},version}

I find that both nbTest and cdfTest are True. If I run the same command from within webMathematica, nbTest is True but cdfTest is False. You can see that result here:

http://www.cs.unca.edu:8082/webMathematica/generateCDF.jsp

You can see the code that generates that result here:

http://www.cs.unca.edu:8082/webMathematica/generateCDF.jsp.txt

I have searched the security configuration of webMathematica to find a way to enable CDF export but have found none. Does anyone know a way to enable this? Of course, it might be disabled in this context intentionally.

My intention is to serve CDF documents generated dynamically from a JSP page accessed via an HTML form. This should allow nice CDF interaction in conjunction with textual input.

Edit: I've updated the version of Mathematica on our server and updated the code above so that the full version string appears. Thus, we can see that it is version 8.0.1. The problem persists.

1

There are 1 best solutions below

0
Arnoud Buzing On

Mark,

Could you try wrapping the ExportString[ ..., "CDF" ] in UsingFrontEnd and see if that helps?

C:\Users\arnoudb>math.exe
Mathematica 8.0 for Microsoft Windows (64-bit)
Copyright 1988-2011 Wolfram Research, Inc.

In[1]:= nb = CreateDocument[ Manipulate[x,{x,0,1}] ] // UsingFrontEnd

Out[1]= -NotebookObject-

In[2]:= ExportString[ nb, "CDF" ]

FrontEndObject::notavail:
   A front end is not available; certain operations require a front end.

Export::nofe: A front end is not available; export of CDF
     requires a front end.

Out[2]= $Failed

In[3]:= ExportString[ nb, "CDF" ] // UsingFrontEnd // Head

Out[3]= String

In[4]:= $Version

Out[4]= 8.0 for Microsoft Windows (64-bit) (October 7, 2011)

In[5]:= $ReleaseNumber

Out[5]= 4