You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Chris <sh...@yahoo.com> on 2009/02/23 23:24:15 UTC

Apostrophe in path generates error

When I call session.getItem(path) and the path has an apostrophe in a 
filename, it generates a "javax.jcr.RepositoryException: invalid path:" 
error.

Does anyone know why?

Do I need to escape apostrophes? What other characters need to be 
escaped? Is this documented anywhere?


RE: Apostrophe in path generates error

Posted by Dave Brosius <db...@mebigfatguy.com>.
see

org.apache.jackrabbit.utils.Text.escapeIllegalJcrChars

-----Original Message-----
From: "Chris" <sh...@yahoo.com>
Sent: Monday, February 23, 2009 5:24pm
To: users@jackrabbit.apache.org
Subject: Apostrophe in path generates error

When I call session.getItem(path) and the path has an apostrophe in a 
filename, it generates a "javax.jcr.RepositoryException: invalid path:" 
error.

Does anyone know why?

Do I need to escape apostrophes? What other characters need to be 
escaped? Is this documented anywhere?


Accessing Jackrabbit over JNDI

Posted by Kurz Wolfgang <wo...@gwvs.de>.
Hello everyone, 

i still havent figured this out:-(


I really have no clue whats going wrong. But I am always getting the same exception:

javax.naming.NamingException: Cannot create resource instance

Here is my code:

Server.xml:

<GlobalNamingResources>
	
	<Resource name="jcr/globalRepository"
		  auth="Container"
          type="javax.jcr.Repository"
          factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory"
          configFilePath="U:/jackrabbit/repository.xml"
          repHomeDir="U:/jackrabbit"/>

 </GlobalNamingResources>

And in web.xml I do this:

    <resource-env-ref>
		<description>Content Repository</description>
		<resource-env-ref-name>jcr/globalRepository</resource-env-ref-name>
		<resource-env-ref-type>javax.jcr.Repository</resource-env-ref-type>		
	</resource-env-ref>

And in the code I try this:


InitialContext context = new InitialContext();		
Context environment = (Context) context.lookup("java:comp/env");
Repository repository = (Repository) environment.lookup("jcr/globalRepository");


I really need to figure this out cause using jackrabbit over rmi isn't really an option for the productive servers.

If anyone had some hints for me I would really appreciate them:-)

Thx a lot in advance!


RE: Apostrophe in path generates error

Posted by "Connor, Brett (LNG-TWY)" <Br...@lexisnexis.co.uk>.
I had the right place, the one you've shown below.

My main problem however is how to reverse the escaping when listing
content through WebDAV. I cannot find a clear extension point to do this
without copying and pasting a whole load of functionality buried
underneath PROPFIND handling. Can you give me any hints where I should
be looking? thanks


-----Original Message-----
From: Connor, Brett (LNG-TWY) [mailto:Brett.Connor@lexisnexis.co.uk] 
Sent: 25 February 2009 14:13
To: users@jackrabbit.apache.org
Subject: RE: Apostrophe in path generates error

Thanks Angela. I've tried something here already but I found a problem
with listing nodes (mapping the WebDAV location to a windows webfolder)
- I haven't managed to get the translation working both ways. I may have
just messed it up of course. I'll have another look now I know I'm in
the right area. Thanks
 

-----Original Message-----
From: Angela Schreiber [mailto:anchela@day.com]
Sent: 25 February 2009 14:04
To: users@jackrabbit.apache.org
Subject: Re: Apostrophe in path generates error


> This leads to me to think I'm not looking in the right place. Any 
> pointers are welcome. Thanks

* An implementation may choose to circumvent the incompatibility of a
* repository path with the URI path by applying an appropriate
* conversion.
* This utility method allows to retrieve this transformed
* repository path.
DavResourceLocator.getRepositoryPath()


LexisNexis is a trading name of REED ELSEVIER (UK) LIMITED - Registered office - 1-3 STRAND, LONDON WC2N 5JR
Registered in England - Company No. 02746621


RE: Apostrophe in path generates error

Posted by "Connor, Brett (LNG-TWY)" <Br...@lexisnexis.co.uk>.
Thanks Angela. I've tried something here already but I found a problem
with listing nodes (mapping the WebDAV location to a windows webfolder)
- I haven't managed to get the translation working both ways. I may have
just messed it up of course. I'll have another look now I know I'm in
the right area. Thanks
 

-----Original Message-----
From: Angela Schreiber [mailto:anchela@day.com] 
Sent: 25 February 2009 14:04
To: users@jackrabbit.apache.org
Subject: Re: Apostrophe in path generates error


> This leads to me to think I'm not looking in the right place. Any 
> pointers are welcome. Thanks

* An implementation may choose to circumvent the incompatibility of a
* repository path with the URI path by applying an appropriate
* conversion.
* This utility method allows to retrieve this transformed
* repository path.
DavResourceLocator.getRepositoryPath()

LexisNexis is a trading name of REED ELSEVIER (UK) LIMITED - Registered office - 1-3 STRAND, LONDON WC2N 5JR
Registered in England - Company No. 02746621


Re: Apostrophe in path generates error

Posted by Angela Schreiber <an...@day.com>.
> This leads to me to think I'm not looking in the right place. Any pointers
> are welcome. Thanks

* An implementation may choose to circumvent the incompatibility of a
* repository path with the URI path by applying an appropriate
* conversion.
* This utility method allows to retrieve this transformed
* repository path.
DavResourceLocator.getRepositoryPath()

Re: Apostrophe in path generates error

Posted by Julian Reschke <ju...@gmx.de>.
Connor, Brett (LNG-TWY) wrote:
> I've just come across the same problem. ' and a few others are not legal
> in JCR path names.
> 
> My problem is that they are legal in WebDAV and so I need to escape /
> unescape these for WebDAV access. I've had a quick look around to see
> where there is a natural extension point for this but so far I can't
> find the right place. I've looked at IOHandler, DavLocator etc but
> everywhere seems to be more of a copy / paste than just the extension I
> would expect to just escape / unescape one name - other places I've
> extended Jackrabbit have been well architected extension points. This
> leads to me to think I'm not looking in the right place. Any pointers
> are welcome. Thanks

Note that they will be legal in JCR 2.0 (JCR-283), and thus in some 
future version of Jackrabbit.

Best regards, Julian

RE: Apostrophe in path generates error

Posted by "Connor, Brett (LNG-TWY)" <Br...@lexisnexis.co.uk>.
I've just come across the same problem. ' and a few others are not legal
in JCR path names.

My problem is that they are legal in WebDAV and so I need to escape /
unescape these for WebDAV access. I've had a quick look around to see
where there is a natural extension point for this but so far I can't
find the right place. I've looked at IOHandler, DavLocator etc but
everywhere seems to be more of a copy / paste than just the extension I
would expect to just escape / unescape one name - other places I've
extended Jackrabbit have been well architected extension points. This
leads to me to think I'm not looking in the right place. Any pointers
are welcome. Thanks


-----Original Message-----
From: news [mailto:news@ger.gmane.org] On Behalf Of Chris
Sent: 23 February 2009 22:24
To: users@jackrabbit.apache.org
Subject: Apostrophe in path generates error

When I call session.getItem(path) and the path has an apostrophe in a
filename, it generates a "javax.jcr.RepositoryException: invalid path:" 
error.

Does anyone know why?

Do I need to escape apostrophes? What other characters need to be
escaped? Is this documented anywhere?


LexisNexis is a trading name of REED ELSEVIER (UK) LIMITED - Registered office - 1-3 STRAND, LONDON WC2N 5JR
Registered in England - Company No. 02746621


Re: Apostrophe in path generates error

Posted by Ben Vanberg <be...@soundstrue.com>.
Yes. This is an invalid character for a JCR path. I have seen this
documented in the JCR spec (jsr170-1.0.pdf).

Quote, Section 6.2.5.2 Name:
 
nonspace ::= (* Any Unicode character except: '/', ':', '[', ']', '*', ''',
'"', '|' or any whitespace
character *)

So basically an ' is an invalid character for a path along with /:[]*"|. I
used a regex to strip these from our path names.

Ben.

On 2/23/09 3:24 PM, "Chris" <sh...@yahoo.com> wrote:

> When I call session.getItem(path) and the path has an apostrophe in a
> filename, it generates a "javax.jcr.RepositoryException: invalid path:"
> error.
> 
> Does anyone know why?
> 
> Do I need to escape apostrophes? What other characters need to be
> escaped? Is this documented anywhere?
>