You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by 付 尧 <gu...@gmail.com> on 2008/10/01 09:08:27 UTC
Can't get the resource when _ in the path
There is a bug in the latest launchpad app.
Sling can't find the resource when there is 2 " _" in the path.
Such as /a/_b/_c.
At that case the resource "_c" can't be found. You will get a http 404
when trying to get it. But you can see it in WebDAV.
So, in the latest launchpad dojo extension can't work since it needs
dojo/_base/_loader/loader.js.
By the way, how can I debug the Servlets(such as SlingMainServlet) in
the sling using Eclipse?
-----
Jack
Re: Can't get the resource when _ in the path
Posted by 付 尧 <gu...@gmail.com>.
Sorry to bother you again.
I can attach the Eclipse Debugger to the jetty server, and I attach
all the Sling source code to the debugger.
But Server won't hang up at the break point. :(
I think the log explain the bug. Why get /_a/_b becomes /a/:b when ask
session to retrieve?
01.10.2008 15:50:12.710 *INFO* [btpool1-3] logs/request.log 01/Oct/
2008:15:50:12 +0800 [22] -> GET /_a/_b HTTP/1.1
01.10.2008 15:50:12.710 *DEBUG* [btpool1-3]
org.apache.jackrabbit.core.SessionImpl invalid path:/a/:b
01.10.2008 15:50:12.710 *DEBUG* [btpool1-3]
org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider
itemExists: Error checking for existence of /a/:b:
javax.jcr.RepositoryException: invalid path:/a/:b: '/a/:b' is not a
valid path. Prefix must not be empty: '/a/:b' is not a valid path.
Prefix must not be empty
-----
Jack
> Hi,
>
> On Wed, Oct 1, 2008 at 9:08 AM, 付 尧 <gu...@gmail.com> wrote:
>> ...By the way, how can I debug the Servlets(such as
>> SlingMainServlet) in the
>> sling using Eclipse?...
>
> What I do is start sling using java remote debugging parameters, and
> setup Eclipse for remote debugging.
>
> Example in launchpad/webapp:
>
> export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE
> -Xrunjdwp:transport=dt_socket,address=30303,server=y,suspend=n"
>
> mvn jetty:run
>
> ...and connect remote debugger to port 30303
>
> -Bertrand (no time to look at your other issue right now, sorry)
Re: Can't get the resource when _ in the path
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,
On Wed, Oct 1, 2008 at 1:34 PM, 付 尧 <gu...@gmail.com> wrote:
> ...I change the pattern to "/_([^/]+?)_|/:", only a tiny change. :)
>
> It works well now. Should I file a ticket in the tracker?...
Yes please, and thanks for your analysis!
-Bertrand
Re: Can't get the resource when _ in the path
Posted by 付 尧 <gu...@gmail.com>.
Hi to everyone.
I think I know how to use eclipse to debug sling now. ;) Thank you
for you advice, Delacretaz.
I get the bug now. It is in the regex pattern of url remapping.
Sling uses _a_b to map for a:b in jcr. The pattern is this /_(.+?)_|/:
But the regex is too greedy. So, if I have this, /_a/_b, <-- Only the
valid path, no namespaces.
It will use this mapping /_(a/)_b. So the result will be /a/:b, and it
is wrong.
I change the pattern to "/_([^/]+?)_|/:", only a tiny change. :)
It works well now. Should I file a ticket in the tracker?
-----
Jack
在 2008-10-1,下午3:55, Bertrand Delacretaz 写道:
> Hi,
>
> On Wed, Oct 1, 2008 at 9:08 AM, 付 尧 <gu...@gmail.com> wrote:
>> ...By the way, how can I debug the Servlets(such as
>> SlingMainServlet) in the
>> sling using Eclipse?...
>
> What I do is start sling using java remote debugging parameters, and
> setup Eclipse for remote debugging.
>
> Example in launchpad/webapp:
>
> export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE
> -Xrunjdwp:transport=dt_socket,address=30303,server=y,suspend=n"
>
> mvn jetty:run
>
> ...and connect remote debugger to port 30303
>
> -Bertrand (no time to look at your other issue right now, sorry)
Re: Can't get the resource when _ in the path
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,
On Wed, Oct 1, 2008 at 9:08 AM, 付 尧 <gu...@gmail.com> wrote:
> ...By the way, how can I debug the Servlets(such as SlingMainServlet) in the
> sling using Eclipse?...
What I do is start sling using java remote debugging parameters, and
setup Eclipse for remote debugging.
Example in launchpad/webapp:
export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,address=30303,server=y,suspend=n"
mvn jetty:run
...and connect remote debugger to port 30303
-Bertrand (no time to look at your other issue right now, sorry)