logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: Patch submission: msg#00035

Subject: Re: Patch submission
On Mon, 2004-08-30 at 23:07 +0200, Joern Turner wrote:
> Hi Chris,
> 
> i've still a question regarding this Servlet patch:
> how do you use this method at runtime to set a DOM? Looks a bit odd to 
> me to put it in this location cause you already have such a method on 
> ChibaBean...
> 
> please enlighten me ... ;)

I have my own servlet which integrates with your ServletAdapter.  My
Servlet looks something like:


DocumentLoader loader = new DocumentLoader("http://my xmlrpc server");
/* DocumentLoader is a class I am using to get a Document from my XMLRPC
server similarly to the XMLRPCUriResolver  */
..
Read request params into a hashtable
..
Document xform = loader.load("getForm", params, true);
...
create the instance URL based on results from the loader
...
instanceURIMap.put("maininstance", instanceURL);
...
and then further down
adapter.setFormDoc(formDoc);


So basically, my form as well as the instance comes off the XML-RPC
server.

Chris

> 
> Joern
> 
> Chris Picton wrote:
> 
> > Hi Joern.
> > 
> > Now that I have gotten over my problems with 0.9.7, would you please
> > consider applying the attached patch.
> > 
> > I allows the ChibaServlet to accept the form document as either a
> > filename, or as a w3c Document, which is what I need for my app.
> > 
> > Thanks
> > Chris
> > 
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > --- chiba-0.9.7/src/org/chiba/adapter/web/ServletAdapter.java.orig  
> > 2004-08-15 21:03:59.000000000 +0200
> > +++ chiba-0.9.7/src/org/chiba/adapter/web/ServletAdapter.java       
> > 2004-08-17 09:42:31.948179505 +0200
> > @@ -109,6 +109,7 @@
> >  import org.chiba.xml.xforms.exception.XFormsException;
> >  import org.w3c.dom.events.Event;
> >  import org.w3c.dom.events.EventTarget;
> > +import org.w3c.dom.Document;
> >  
> >  import java.io.File;
> >  import java.io.Writer;
> > @@ -134,6 +135,7 @@
> >      private ChibaBean chibaBean = null;
> >      private String configPath = null;
> >      private String formPath = null;
> > +    private Document formDoc = null;
> >      private String actionUrl = null;
> >      private String CSSFile = null;
> >      private String stylesheet = null;
> > @@ -166,17 +168,28 @@
> >       * @throws XFormsException If an error occurs
> >       */
> >      public void init() throws XFormsException {
> > -        File f = new File(locateFile(formPath));
> > +        if (formPath == null && formDoc == null) {
> > +            throw new XFormsException("No XForm document source 
> > specified");
> > +        }
> > +        
> >          // create bean
> >          this.chibaBean = new ChibaBean(); //using default configuration
> > +        chibaBean.setContext(this.context);
> > +        
> > +        if (formPath != null) {
> > +            File f = new File(locateFile(formPath));
> > +            chibaBean.setBaseURI(f.getParentFile().toURI().toString());
> > +            chibaBean.setXMLContainer(f.getAbsolutePath());
> > +        } else {
> > +            //Is this needed?
> > +            chibaBean.setBaseURI("/");
> > +            chibaBean.setXMLContainer(formDoc);
> > +        }
> >  
> > -        chibaBean.setBaseURI(f.getParentFile().toURI().toString());
> >          //use custom config-file if this param is existent
> >          if ((configPath != null) && !(configPath.equals(""))) {
> >              chibaBean.setConfig(configPath);
> >          }
> > -        chibaBean.setContext(this.context);
> > -        chibaBean.setXMLContainer(f.getAbsolutePath());
> >  
> >          // import instances if any
> >          //todo: refactor to be handled via ChibaContext (WebContext) too
> > @@ -379,6 +392,15 @@
> >      // ************************* ACCESSORS 
> > ********************************************
> >  
> >      /**
> > +     * sets the Document holding the xform
> > +     *
> > +     * @param formDoc the XForms Document
> > +     */
> > +    public void setFormDoc(Document formDoc) {
> > +        this.formDoc = formDoc;
> > +    }
> > +
> > +    /**
> >       * returns the ChibaBean instance used with this servletAdapter
> >       *
> >       * @return the ChibaBean instance used with this servletAdapter
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> _______________________________________________
> Chiba-developer mailing list
> Chiba-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/chiba-developer
-- 
Chris Picton <chibadev-list-LvsDHNe4pjXPKWblFCUSJw@xxxxxxxxxxxxxxxx>
Tangent Systems



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click


<Prev in Thread] Current Thread [Next in Thread>