Re: [Xsltforms-support] Packaging an XForms application as a .exe file
Brought to you by:
alain-couthures
From: William V. <wi...@bi...> - 2012-06-15 16:02:45
|
I've developed a solution based in NanoHTTPD called NanoXFServer. You can download it form http://dianaydavid.com/download/nanoxfserver.zip Basically is a tiny Java Webserver that supports PUT Method, so you can save XForms submissions locally. Take a look to instance-save-test.xforms Sadly, my wordpress based website, has been shut down, with the full documentation. But here is a transcript: NANOXFSERVER * WHAT IS IT? NanoXFServer is a really small web server based in Java that can handle PUT and XML-URLENCODED-POSTXForms submission methods. It´s based in the smallest, fully functional WebServer available in Java: NanoHTTPD http://elonen.iki.fi/code/nanohttpd/ [1] * WHY A WEB SERVER FOR XFORMS? If you are developing XForms using a javascript based implementation (probably XSLTForms), you must be facing two problems if you want to run your XForms locally: * For security reasons, javascript is disabled (fully or partially, depending on your browser) when you open a local file in your browser, so your XForms won't work. * There is no way of saving the XML Instance data to a local file (for security reasons also), so you need javscript tricks or a full web server if you want to see the XForm data The purpose of NanoXFServer is to allow XForms to run locally for testing (or maybe for full local applications) without an Web Server (like Apache or eXist-db) * HOW IT WORKS? The simplest way of using NanoXFServer is to copy nanoxfserver.jar to the folder where your XForms resides, and then run it with the following command: JAVA -JAR NANOXFSERVER.JAR Then point your browser to http://localhost and you´ll get a listing of the files on your directory. Choose your XForms and it's running. Take in account that you'll need two prerequisites: * You'll need Java JRE installed on yout computer * If you are using a client based XForms Implementation (like XSLTForms) you´ll need the appropiated files (xsltforms folder) and processing instructions in your XForms, in order to get it running For saving your instances locally, use the PUT submission method, and specify a relative file name in the ACTION or RESOURCE attribute of the submission element, like this: <XF:SUBMISSION ID="DOPUT" RESOURCE="DATA/PUTDATA.XML" METHOD="PUT" /> XML Instance will be stored in a file named PUTDATA.XML under the DATA folder (the folder must exists).. If you are using XSLTForms, you can also use the XML-URLENCODED-POST method, this way: <XF:SUBMISSION ID="DOPOST" RESOURCE="POSTDATA.XML" METHOD="XML-URLENCODED-POST"> Using XML-URLENCODED-POST, the browser will show the resulting instance (useful for quick testing) * WHAT CAN IT DO? NanoXFServer adds the following features to NanoHTTPD: * Support for PUT submission method. * Support for XML-URLENCODED-POST submission method (supported in XSLTForms). * XML Instances are saved with UTF-8 file encoding * Inhibits use of .. on instance saving. * Serves the following file extensions as etxt/xml: .xml .xsl .xslt .xsd .xforms * Serves .xhtml files as application/xhtml+xml (not supported for all browsers) Here is a complete list of features form the NanoHTTPD web page: * Only one Java file * Java 1.1 compatible * Released as open source, Modified BSD licence * No fixed config files, logging, authorization etc. (Implement by yourself if you need them.) * Supports parameter parsing of GET and POST methods * Parameter names must be unique. (Adding support to multiple instance of a parameter is not difficult, but would make the interface a bit more cumbersome to use.) * Supports both dynamic content and file serving * Supports file upload (since version 1.2, 2010) * Never caches anything * Doesn't limit bandwidth, request time or simultaneous connections * Default code serves files and shows all HTTP parameters and headers * File server supports directory listing, index.html and index.htm * File server supports partial content (streaming) * File server supports ETags * File server does the 301 redirection trick for directories without / * File server supports simple skipping for files (continue download) * File server serves also very long files without memory overhead * Contains a built-in list of most common mime types * All header names are converted lowercase so they don't vary between browsers/clients Hope this help you or at least bring new ideas, Bill El 2012-06-14 15:27, Alain Couthures escribió: > Hi vidhya, > > I think that XSLTForms could do the trick with just an extension to the > current applet. > > I can image a form allowing to select a folder and different options. > The applet will then return an XML document serialization having hexa > encoded files in this folder as leaf elements. > > Then, an XSLT 1.0 stylesheet can transform this document into a source file. > > This source file would include a basic HTTP server and would start a > browser at the initial page (There are online examples for tiny HTTP > servers in C for gcc or in Java). > > The last step would, of course, be to compile the generated source file > (with a generated command file maybe?). > > What do you think? > > -Alain > > Le 13/06/2012 07:19, srividhya a écrit : >> Hi all!!! >> Hai i have developed the application using xsltforms in offline >> mode. In terms of security concern, we can't able to give the >> application as folder(ie. with xsltforms folder and forms). so, i need >> your help regarding how to package as the .exe file or .jar file. If >> anybody have a idea help me... >> Awaiting for the reply... >> >> thanks, >> vidhya. > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support -- William David Velasquez Laboratorio de Software Bitlab http://bitlab.com.co Movil 310 412 0218 Links: ------ [1] http://elonen.iki.fi/code/nanohttpd/ |