jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Harris" <michael.e.har...@gmail.com>
Subject Re: webdav integration
Date Thu, 17 Jul 2008 18:57:57 GMT
Alex

ok Ive got a jetty instance imbedded in my test harness. Ive extended the
simple webdav servlet, subclassed it to return my repo, and attached it to
jetty.  Now I am trying to write some webdav client code.  Unfortunately the
documentation is exceedingly horrible.

The first method I need to write is to just get a list of what is in the
repo.  the SearchMethod seems like it is the tool.  HOwever, I have no idea,
and the javadocs don't help, on what the search info should be.

I know I am asking a lot, but here is what i have

what i added to my test repo

                Node root = session.getRootNode();
                Node assets = root.addNode("assets");

                    // Store content
                    Node asset = assets.addNode("asset");
                    asset.setProperty("url", "http://asset1url.org");
                    asset.setProperty("name", "Asset 1");
                    asset.setProperty("typetype", "image");

                    Node asset2 = assets.addNode("asset");
                    asset2.setProperty("url", "http://asset2url.org");
                    asset2.setProperty("name", "Asset 2");
                    asset2.setProperty("type", "image");

my client code looks like

        HttpClient client = new HttpClient();
        SearchMethod method = new SearchMethod("/", "", "");
        client.executeMethod(method);
        byte[] resp = method.getResponseBody();
        System.out.println(resp);

I am getting a domexception when i run the client.  Any insight?

org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or
change an object in a way which is incorrect with regard to namespaces.
    at
com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.checkNamespaceWF(CoreDocumentImpl.java:2388)
    at
com.sun.org.apache.xerces.internal.dom.ElementNSImpl.setName(ElementNSImpl.java:143)
    at
com.sun.org.apache.xerces.internal.dom.ElementNSImpl.<init>(ElementNSImpl.java:112)
    at
com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.createElementNS(CoreDocumentImpl.java:1969)
    at
org.apache.jackrabbit.webdav.xml.DomUtil.createElement(DomUtil.java:401)
    at
org.apache.jackrabbit.webdav.xml.DomUtil.createElement(DomUtil.java:422)
    at
org.apache.jackrabbit.webdav.xml.DomUtil.addChildElement(DomUtil.java:477)
    at
org.apache.jackrabbit.webdav.search.SearchInfo.toXml(SearchInfo.java:158)
    at
org.apache.jackrabbit.webdav.client.methods.DavMethodBase.setRequestBody(DavMethodBase.java:198)
    at
org.apache.jackrabbit.webdav.client.methods.SearchMethod.<init>(SearchMethod.java:44)
    at
org.apache.jackrabbit.webdav.client.methods.SearchMethod.<init>(SearchMethod.java:36)



On Thu, Jul 17, 2008 at 7:07 AM, Alexander Klimetschek <aklimets@day.com>
wrote:

> Hi,
>
> you can extend the SimpleWebdavServlet (inside jackrabbit-jcr-server
> and you also need the jackrabbit-webdav lib). The only thing you will
> have to do is to overwrite the getRepository() method and provide your
> own (Transient)Repository. Then you need to have a servlet container
> started from within your application or junit test (I think Jetty is
> the simplest for this task).
>
> Have a look at the javadocs:
>
> http://jackrabbit.apache.org/api/1.4/org/apache/jackrabbit/webdav/simple/SimpleWebdavServlet.html
>
> See also http://wiki.apache.org/jackrabbit/WebDAV for some infos and
> links to the javadocs.
>
> Otherwise you can install a servlet container and deploy the entire
> jackrabbit-webapp.war:
>
> http://www.apache.org/dyn/closer.cgi/jackrabbit/binaries/jackrabbit-webapp-1.4.war
>
> Regards,
> Alex
>
> On Wed, Jul 16, 2008 at 9:33 PM, Michael Harris
> <michael.e.harris@gmail.com> wrote:
> > hello
> >
> > new to jackrabbit.  I can setup a a TransientRepository and add nodes to
> it
> > (basically by following first hops). what i wanted to do next was access
> > that repo via the webdav api.
> >
> > the question is, how do i do this in a junit environment without a
> > webserver?  Is it even possible?  So setup the Transient Repo in the test
> > setup, then have some sort
> > of simple client that accesses that repo via webdav.
> >
> > I couldn't find any tutorials/help articles on this sort of thing.
> >
> > thanx
> > --
> > ---------------------
> > Michael Harris
> >
>
>
>
> --
> Alexander Klimetschek
> alexander.klimetschek@day.com
>



-- 
---------------------
Michael Harris

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message