I am a newbie with OO. I just installed OO 2.2 on my windows XP SP2.
I use Eclipse 3.3 with Tomcat and other plug-ins to develop a java web application. I expect the application can provide client the capability to open a OO template file from server using the local installed OO. I am not sure if it Is a right strategy, or I should launch local OO first then ask client to download my OO template from server?
As the first step I tried an example called BootstrapConnectionOdtToPdfQuickAndDirty, it was successful to run as local java application. But when I try to publish the jar files using jnlp, it failed.
Following is what I did.
- I export the jar with required OO jars, i.e. juh.jar/ jurt.jar/ ridl.jar/ unoil.jar
- I use keytool and jarsigner to break the sandbox limitation since I need to access the local file
- I still set a client odt file to be loaded by local OO (surely they are on the same machine) in the published function as the first try, which is the same as in local java application
- When I start the server and click the jnlp link, there is no response from local OO, although another published jnlp based application run succefssully (this one is not related to OO)
Who can help me on that?
Thanks and regards,
Leo
the source code of the example is attached below
Code: Select all
import com.sun.star.beans.PropertyValue;
import com.sun.star.bridge.XUnoUrlResolver;
import com.sun.star.comp.helper.Bootstrap;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.frame.XStorable;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
public class BootstrapConnectionOdtToPdfQuickAndDirty {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String loadUrl="file:///d:/users/leo/temp/test.odt";
String storeUrl="file:///d:/users/leo/temp/test.pdf";
try {
XComponentContext xContext = Bootstrap.bootstrap();
XMultiComponentFactory xMultiComponentFactory = xContext.getServiceManager();
XComponentLoader xcomponentloader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class,xMultiComponentFactory.createInstanceWithContext("com.sun.star.frame.Desktop", xContext));
Object objectDocumentToStore = xcomponentloader.loadComponentFromURL(loadUrl, "_blank", 0, new PropertyValue[0]);
PropertyValue[] conversionProperties = new PropertyValue[1];
conversionProperties[0] = new PropertyValue();
conversionProperties[0].Name = "FilterName";
conversionProperties[0].Value = "writer_pdf_Export";
XStorable xstorable = (XStorable) UnoRuntime.queryInterface(XStorable.class,objectDocumentToStore);
xstorable.storeToURL(storeUrl,conversionProperties);
}
catch (java.lang.Exception e) {
e.printStackTrace();
}
finally {
System.exit(0);
}
}
}| Edit: TerryE: formatted for readability |