Re: Debugging JavaScript esp files

2010-10-22 Thread Sandro Boehme

Hi Felix,


event is not triggered. Do you have an idea what might be different in
your environment?
right now I'm on a good way to find out why the compilationDone event is 
not triggered so there is no need for you to invest time in that right now.


Best,

Sandro


Re: Debugging JavaScript esp files

2010-10-22 Thread Felix Meschberger
Hi Sandro,

On 22.10.2010 16:15, Sandro Boehme wrote:
 Hi Felix,
 
 event is not triggered. Do you have an idea what might be different in
 your environment?
 right now I'm on a good way to find out why the compilationDone event is
 not triggered so there is no need for you to invest time in that right now.

Cool. Thanks for the info.

Regards
Felix

 
 Best,
 
 Sandro
 


Re: Debugging JavaScript esp files

2010-10-22 Thread Sandro Boehme

Hi Felix,

compilationDone is now triggered in my environment.
At some point I saw that the compilationDone event is triggered for Dim. 
This gave me a chance to find out how this is all suppose to work.


o Problem one:
I added the new JSDT-based debugger to the listener of the global 
ContextFactory instead of the current instance.


o Problem two:
The org.apache.sling.scripting.javascript.debug property had to be 
disabled as otherwise first the JSDT-based debugger specifies itself in 
the setDebugger() method of a single context. And after that the 
Rhino-based debugger overwrites this with its own instance. Thus the 
event was always triggered on the Rhino-based debugger.
For some reason the Sling debug property was actually not deactivated 
when I thought it was.


I will now try to find a way to set an activated breakpoint on the JS files.

Best,

Sandro

Am 22.10.10 16:18, schrieb Felix Meschberger:

Hi Sandro,

On 22.10.2010 16:15, Sandro Boehme wrote:

Hi Felix,


event is not triggered. Do you have an idea what might be different in
your environment?

right now I'm on a good way to find out why the compilationDone event is
not triggered so there is no need for you to invest time in that right now.


Cool. Thanks for the info.

Regards
Felix



Best,

Sandro







Re: Debugging JavaScript esp files

2010-10-20 Thread Sandro Boehme

Hi Felix,
Am 19.10.10 13:41, schrieb Felix Meschberger:

Hi,

On 19.10.2010 13:20, Sandro Boehme wrote:

Hi Felix,

Am 19.10.10 08:48, schrieb Felix Meschberger:

o In the Eclipse preferences one needs to map *.esp files to the
JavaScript content type.


Yes. Likewise for *.ecma. Though I have issues setting breakpoints on
*.esp files because on my box Eclipse tells it cannot resolve the line
number to set the breakpoint on.

I had the same problem first. But after adding *.esp to the JavaScript
content type and then opening the esp file with the JavaScript editor it
worked without problems.


I cannot easily find out if the
trigger to load the JavaScript files is already there somewhere.

I guess we only need to trigger the handleCompilationDone() methode
somewhere in Sling but I don't know enough about Sling to decide where
that would fit in or what to configure to make it fit. Maybe it could be
triggered during
...scripting.javascript.internal.RhinoJavaScriptEngine.eval(). Do you
have an idea?


Actually from my traces I see, that the Eclipse rhino.debugger bundle in
facts replies to the compilationDone event and informs the Eclipse
debugger about this.

This sounds good. What did you do to trigger the compilationDone event?
If that works I get some example scripts from the server and can then
try to find a mapping for the paths.


I wrote a simple /apps/nt/folder/html.esp script and then requested a
folder from Sling. This causes the html.esp script to be loaded and thus
the compilationDone event is sent and handled.

I did not have to do anything else.
I tried to load the script with and without the 
org.apache.sling.scripting.javascript.debug property being enabled 
(though this should not make a difference). But the compilationDone 
event is not triggered. Do you have an idea what might be different in 
your environment?


Best,

Sandro



Regards
Felix






Then the Eclipse debugger is probably supposed to send back breakpoints
for the script but fails to do so because of script path issues: Sling
reports script paths as they exist in Sling, e.g.
/apps/sling/nt/folder.html. Eclipse on the other hand (I am creating a
folder linking to a WebDAV mount of Sling) reports the script path as
the project IPath, that is prefixed with the project name and path to
the linked script folder.

In the end the Eclipse debugger is not able to match the script reported
from rhino.debugger in Sling with the script in Eclipse ...

I once debugged this and hacked the correct path into and in fact was
able to break a script and step through it. But we probably really need
some way of mapping the script paths ... I just didn't find out how to,
for example, set a prefix to cut off to get the actual script path from
the project's path.

Thanks for the details.

Best,

Sandro







Re: Debugging JavaScript esp files

2010-10-20 Thread Sandro Boehme

Hi Felix,

Am 17.10.10 20:28, schrieb Felix Meschberger:

Hi,

On 17.10.2010 16:05, Sandro Boehme wrote:

Hi Felix,

thanks for the feedback.
The Swing debugger GUI doesn't seem to work in this case as it cannot
open e.g. the explorer.esp file. It says:
Syntax error (.../explorer.esp#83)
This refers to the line containing only form action=# which is
correct in my opinion.


I would expect the line to be correct, but I must admit to not have used
this for quite some time, so ... this may really not properly work
(unfortunately).
it does actually work in my environment too. I was just expecting that I 
have to open the esp file using the menu of the Swing client and then 
have to set a breakpoint there. But that results in the error I 
described above. I didn't know that the script loads automatically into 
the Swing GUI as soon as it is accessed and loaded on the webserver.


Best,

Sandro



Am 16.10.10 20:22, schrieb Felix Meschberger:

Hi Sandro,

The best solution (which I once considered working on a long time ago
but never got around to implement) is to have Rhino debugging support in
Eclipse.

But for now, you may set the
org.apache.sling.scripting.javascript.debug framework property (e.g.
in the sling.properties file) to true. When this property is set to true
Rhino will launch the Swing debugger GUI (on the server system) once the
Rhino ScriptEngineFactory is started.

Regards
Felix


On 16.10.2010 15:36, Sandro Boehme wrote:

Hello,

I'm trying to get into the Sling Explorer and I'm wondering how (or if)
you guys debug these esp scripts? While the Eclipse debugger stops in
jsp files it doesn't stop in esp files as they don't contain Java code.
Is there a special JSR-223 debugger plugin or some trick I don't know
of?

Best,

Sandro












Re: Debugging JavaScript esp files

2010-10-19 Thread Felix Meschberger
Hi Sandro,

On 19.10.2010 02:39, Sandro Boehme wrote:
 Hi Felix,
 
 after diving into the topic I got the following understanding. Please
 correct me if I'm wrong.
 o In the Eclipse preferences one needs to map *.esp files to the
 JavaScript content type.

Yes. Likewise for *.ecma. Though I have issues setting breakpoints on
*.esp files because on my box Eclipse tells it cannot resolve the line
number to set the breakpoint on.

 o Now its possible to set a breakpoint in the esp file.
 o Next one needs to load the esp script file in the Breakpoints view.
 o Starting the debugger now calls new
 ...jsdt.debug.internal.rhino.jsdi.VirtualMachineImpl() which sends a
 scripts command request [1] to the
 ...jsdt.debug.internal.rhino.debugger.RequestHandler on the server side.
 That handler calls
 ...jsdt.debug.internal.rhino.debugger.RhinoDebuggerImpl.getScriptIds().
 The only location that sets the script id's is the
 handleCompilationDone() method of RhinoDebuggerImpl. I only see that
 indirectly called by
 oas.scripting.javascript.helper.SlingGlobal.require() and .execIdCall().
 As the latter is a method from org.mozilla.javascript.IdFunctionCall
 there are too many possible callers and I cannot easily find out if the
 trigger to load the JavaScript files is already there somewhere.
 
 I guess we only need to trigger the handleCompilationDone() methode
 somewhere in Sling but I don't know enough about Sling to decide where
 that would fit in or what to configure to make it fit. Maybe it could be
 triggered during
 ...scripting.javascript.internal.RhinoJavaScriptEngine.eval(). Do you
 have an idea?

Actually from my traces I see, that the Eclipse rhino.debugger bundle in
facts replies to the compilationDone event and informs the Eclipse
debugger about this.

Then the Eclipse debugger is probably supposed to send back breakpoints
for the script but fails to do so because of script path issues: Sling
reports script paths as they exist in Sling, e.g.
/apps/sling/nt/folder.html. Eclipse on the other hand (I am creating a
folder linking to a WebDAV mount of Sling) reports the script path as
the project IPath, that is prefixed with the project name and path to
the linked script folder.

In the end the Eclipse debugger is not able to match the script reported
from rhino.debugger in Sling with the script in Eclipse ...

I once debugged this and hacked the correct path into and in fact was
able to break a script and step through it. But we probably really need
some way of mapping the script paths ... I just didn't find out how to,
for example, set a prefix to cut off to get the actual script path from
the project's path.

Regards
Felix

 
 Best,
 
 Sandro
 
 [1] - http://wiki.eclipse.org/JSDT/Debug/Rhino_Debug_Wire_Protocol#scripts
 
 
 Am 18.10.10 02:58, schrieb Sandro Boehme:
 Hi Felix,

 that was fast. I'm impressed.
 Thanks for the tutorial. I can connect too but the debugger also doesn't
 stop at my breakpoint like in your case.

 Best,

 Sandro

 PS: Just in case somebody else want to follow: The export in step 5 is
 org.mozilla.javascript.debug.


 Am 17.10.10 23:00, schrieb Felix Meschberger:
 Hi,

 On 17.10.2010 20:34, Justin Edelson wrote:
 On Sun, Oct 17, 2010 at 2:28 PM, Felix
 Meschbergerfmesc...@gmail.com wrote:
 Hi,

 On 17.10.2010 16:05, Sandro Boehme wrote:
 Hi Felix,

 thanks for the feedback.
 The Swing debugger GUI doesn't seem to work in this case as it cannot
 open e.g. the explorer.esp file. It says:
 Syntax error (.../explorer.esp#83)
 This refers to the line containing only form action=# which is
 correct in my opinion.

 I would expect the line to be correct, but I must admit to not have
 used
 this for quite some time, so ... this may really not properly work
 (unfortunately).


 I also tried the Eclipse IDE for JavaScript Web Developers from
 http://www.eclipse.org/downloads/ as it contains debugging support
 for
 Rhino (http://wiki.eclipse.org/JSDT/Debug). But it doesn't work
 out of
 the box. Even though it is based on JPDA I guess there needs to be
 something Rhino specific installed on the serverside.

 Sounds interesting. Would be exactly what I had in mind ;-) Will
 investigate.

 It'd be better if this page wasn't blank:
 http://wiki.eclipse.org/JSDT/Debug/Embedding_Rhino_Debugger

 Yes, well, I got it sort of working with a bit hacking 

 1. deploy two JSDT bundles into Sling:
 org.eclipse.wst.jsdt.debug.rhino.debugger
 org.eclipse.wst.jsdt.debug.transport
 (ignore for now that these bundles use Require-Bundle
 and export internals ...)
 2. upgrade Sling Rhino reference to 1.7R2
 3. inside Sling add a dependency to the
 org.eclipse.wst.jsdt.debug.rhino.debugger project checked
 out from Eclipse CVS
 4. In the SlingContextFactory constructor instantiate a RhinoDebugger
 with a connector string (e.g.
 transport=socket,suspend=n,address=9000), register it as a
 listener and start the RhinoDebugger
 5. Export org.mozilla.javascript.debugger package and add an
 optional import to 

Re: Debugging JavaScript esp files

2010-10-19 Thread Sandro Boehme

Hi Felix,

Am 19.10.10 08:48, schrieb Felix Meschberger:
 o In the Eclipse preferences one needs to map *.esp files to the
 JavaScript content type.

 Yes. Likewise for *.ecma. Though I have issues setting breakpoints on
 *.esp files because on my box Eclipse tells it cannot resolve the line
 number to set the breakpoint on.
I had the same problem first. But after adding *.esp to the JavaScript 
content type and then opening the esp file with the JavaScript editor it 
worked without problems.



I cannot easily find out if the
trigger to load the JavaScript files is already there somewhere.

I guess we only need to trigger the handleCompilationDone() methode
somewhere in Sling but I don't know enough about Sling to decide where
that would fit in or what to configure to make it fit. Maybe it could be
triggered during
...scripting.javascript.internal.RhinoJavaScriptEngine.eval(). Do you
have an idea?


Actually from my traces I see, that the Eclipse rhino.debugger bundle in
facts replies to the compilationDone event and informs the Eclipse
debugger about this.

This sounds good. What did you do to trigger the compilationDone event?
If that works I get some example scripts from the server and can then 
try to find a mapping for the paths.




Then the Eclipse debugger is probably supposed to send back breakpoints
for the script but fails to do so because of script path issues: Sling
reports script paths as they exist in Sling, e.g.
/apps/sling/nt/folder.html. Eclipse on the other hand (I am creating a
folder linking to a WebDAV mount of Sling) reports the script path as
the project IPath, that is prefixed with the project name and path to
the linked script folder.

In the end the Eclipse debugger is not able to match the script reported
from rhino.debugger in Sling with the script in Eclipse ...

I once debugged this and hacked the correct path into and in fact was
able to break a script and step through it. But we probably really need
some way of mapping the script paths ... I just didn't find out how to,
for example, set a prefix to cut off to get the actual script path from
the project's path.

Thanks for the details.

Best,

Sandro


Re: Debugging JavaScript esp files

2010-10-19 Thread Felix Meschberger
Hi,

On 19.10.2010 13:20, Sandro Boehme wrote:
 Hi Felix,
 
 Am 19.10.10 08:48, schrieb Felix Meschberger:
 o In the Eclipse preferences one needs to map *.esp files to the
 JavaScript content type.

 Yes. Likewise for *.ecma. Though I have issues setting breakpoints on
 *.esp files because on my box Eclipse tells it cannot resolve the line
 number to set the breakpoint on.
 I had the same problem first. But after adding *.esp to the JavaScript
 content type and then opening the esp file with the JavaScript editor it
 worked without problems.
 
 I cannot easily find out if the
 trigger to load the JavaScript files is already there somewhere.

 I guess we only need to trigger the handleCompilationDone() methode
 somewhere in Sling but I don't know enough about Sling to decide where
 that would fit in or what to configure to make it fit. Maybe it could be
 triggered during
 ...scripting.javascript.internal.RhinoJavaScriptEngine.eval(). Do you
 have an idea?

 Actually from my traces I see, that the Eclipse rhino.debugger bundle in
 facts replies to the compilationDone event and informs the Eclipse
 debugger about this.
 This sounds good. What did you do to trigger the compilationDone event?
 If that works I get some example scripts from the server and can then
 try to find a mapping for the paths.

I wrote a simple /apps/nt/folder/html.esp script and then requested a
folder from Sling. This causes the html.esp script to be loaded and thus
the compilationDone event is sent and handled.

I did not have to do anything else.

Regards
Felix


 

 Then the Eclipse debugger is probably supposed to send back breakpoints
 for the script but fails to do so because of script path issues: Sling
 reports script paths as they exist in Sling, e.g.
 /apps/sling/nt/folder.html. Eclipse on the other hand (I am creating a
 folder linking to a WebDAV mount of Sling) reports the script path as
 the project IPath, that is prefixed with the project name and path to
 the linked script folder.

 In the end the Eclipse debugger is not able to match the script reported
 from rhino.debugger in Sling with the script in Eclipse ...

 I once debugged this and hacked the correct path into and in fact was
 able to break a script and step through it. But we probably really need
 some way of mapping the script paths ... I just didn't find out how to,
 for example, set a prefix to cut off to get the actual script path from
 the project's path.
 Thanks for the details.
 
 Best,
 
 Sandro
 


Re: Debugging JavaScript esp files

2010-10-19 Thread Sandro Boehme

Am 19.10.10 13:41, schrieb Felix Meschberger:

Hi,

I cannot easily find out if the
trigger to load the JavaScript files is already there somewhere.

I guess we only need to trigger the handleCompilationDone() methode
somewhere in Sling but I don't know enough about Sling to decide where
that would fit in or what to configure to make it fit. Maybe it could be
triggered during
...scripting.javascript.internal.RhinoJavaScriptEngine.eval(). Do you
have an idea?


Actually from my traces I see, that the Eclipse rhino.debugger bundle in
facts replies to the compilationDone event and informs the Eclipse
debugger about this.

This sounds good. What did you do to trigger the compilationDone event?
If that works I get some example scripts from the server and can then
try to find a mapping for the paths.


I wrote a simple /apps/nt/folder/html.esp script and then requested a
folder from Sling. This causes the html.esp script to be loaded and thus
the compilationDone event is sent and handled.

I did not have to do anything else.
Ah, I thought the compilationDone event should also get triggered if the 
bundle containing the script is deployed normally. But ok, I understand. 
The trigger is the update to WebDav.


Best,

Sandro


Re: Debugging JavaScript esp files

2010-10-19 Thread Felix Meschberger
Hi,

On 19.10.2010 14:21, Sandro Boehme wrote:
 Am 19.10.10 13:41, schrieb Felix Meschberger:
 Hi,
 I cannot easily find out if the
 trigger to load the JavaScript files is already there somewhere.

 I guess we only need to trigger the handleCompilationDone() methode
 somewhere in Sling but I don't know enough about Sling to decide where
 that would fit in or what to configure to make it fit. Maybe it
 could be
 triggered during
 ...scripting.javascript.internal.RhinoJavaScriptEngine.eval(). Do you
 have an idea?

 Actually from my traces I see, that the Eclipse rhino.debugger
 bundle in
 facts replies to the compilationDone event and informs the Eclipse
 debugger about this.
 This sounds good. What did you do to trigger the compilationDone event?
 If that works I get some example scripts from the server and can then
 try to find a mapping for the paths.

 I wrote a simple /apps/nt/folder/html.esp script and then requested a
 folder from Sling. This causes the html.esp script to be loaded and thus
 the compilationDone event is sent and handled.

 I did not have to do anything else.
 Ah, I thought the compilationDone event should also get triggered if the
 bundle containing the script is deployed normally. But ok, I understand.
 The trigger is the update to WebDav.

No, the triger is the actual execution of the script: Rhino first
compiles the script into an AST and the executes that. Once the script
has been compiled into the AST (a by-product could in fact be writing a
Java Class File) the compilationDone event is fired (IIRC).

Regards
Felix


Re: Debugging JavaScript esp files

2010-10-19 Thread Sandro Boehme

Hi Felix,

Am 19.10.10 15:28, schrieb Felix Meschberger:

Hi,

On 19.10.2010 14:21, Sandro Boehme wrote:

Am 19.10.10 13:41, schrieb Felix Meschberger:

Hi,

I cannot easily find out if the
trigger to load the JavaScript files is already there somewhere.

I guess we only need to trigger the handleCompilationDone() methode
somewhere in Sling but I don't know enough about Sling to decide where
that would fit in or what to configure to make it fit. Maybe it
could be
triggered during
...scripting.javascript.internal.RhinoJavaScriptEngine.eval(). Do you
have an idea?


Actually from my traces I see, that the Eclipse rhino.debugger
bundle in
facts replies to the compilationDone event and informs the Eclipse
debugger about this.

This sounds good. What did you do to trigger the compilationDone event?
If that works I get some example scripts from the server and can then
try to find a mapping for the paths.


I wrote a simple /apps/nt/folder/html.esp script and then requested a
folder from Sling. This causes the html.esp script to be loaded and thus
the compilationDone event is sent and handled.

I did not have to do anything else.

Ah, I thought the compilationDone event should also get triggered if the
bundle containing the script is deployed normally. But ok, I understand.
The trigger is the update to WebDav.


No, the triger is the actual execution of the script: Rhino first
compiles the script into an AST and the executes that. Once the script
has been compiled into the AST (a by-product could in fact be writing a
Java Class File) the compilationDone event is fired (IIRC).
Yes of course. I guess I didn't really read This causes the html.esp 
script to be loaded and thus the compilationDone event is sent and 
handled. in the first place :-/


Best,

Sandro


Re: Debugging JavaScript esp files

2010-10-18 Thread Sandro Boehme

Hi Felix,

after diving into the topic I got the following understanding. Please 
correct me if I'm wrong.
o In the Eclipse preferences one needs to map *.esp files to the 
JavaScript content type.

o Now its possible to set a breakpoint in the esp file.
o Next one needs to load the esp script file in the Breakpoints view.
o Starting the debugger now calls new 
...jsdt.debug.internal.rhino.jsdi.VirtualMachineImpl() which sends a 
scripts command request [1] to the 
...jsdt.debug.internal.rhino.debugger.RequestHandler on the server side. 
That handler calls 
...jsdt.debug.internal.rhino.debugger.RhinoDebuggerImpl.getScriptIds(). 
The only location that sets the script id's is the 
handleCompilationDone() method of RhinoDebuggerImpl. I only see that 
indirectly called by 
oas.scripting.javascript.helper.SlingGlobal.require() and .execIdCall(). 
As the latter is a method from org.mozilla.javascript.IdFunctionCall 
there are too many possible callers and I cannot easily find out if the 
trigger to load the JavaScript files is already there somewhere.


I guess we only need to trigger the handleCompilationDone() methode 
somewhere in Sling but I don't know enough about Sling to decide where 
that would fit in or what to configure to make it fit. Maybe it could be 
triggered during 
...scripting.javascript.internal.RhinoJavaScriptEngine.eval(). Do you 
have an idea?


Best,

Sandro

[1] - http://wiki.eclipse.org/JSDT/Debug/Rhino_Debug_Wire_Protocol#scripts


Am 18.10.10 02:58, schrieb Sandro Boehme:

Hi Felix,

that was fast. I'm impressed.
Thanks for the tutorial. I can connect too but the debugger also doesn't
stop at my breakpoint like in your case.

Best,

Sandro

PS: Just in case somebody else want to follow: The export in step 5 is
org.mozilla.javascript.debug.


Am 17.10.10 23:00, schrieb Felix Meschberger:

Hi,

On 17.10.2010 20:34, Justin Edelson wrote:

On Sun, Oct 17, 2010 at 2:28 PM, Felix
Meschbergerfmesc...@gmail.com wrote:

Hi,

On 17.10.2010 16:05, Sandro Boehme wrote:

Hi Felix,

thanks for the feedback.
The Swing debugger GUI doesn't seem to work in this case as it cannot
open e.g. the explorer.esp file. It says:
Syntax error (.../explorer.esp#83)
This refers to the line containing only form action=# which is
correct in my opinion.


I would expect the line to be correct, but I must admit to not have
used
this for quite some time, so ... this may really not properly work
(unfortunately).



I also tried the Eclipse IDE for JavaScript Web Developers from
http://www.eclipse.org/downloads/ as it contains debugging support for
Rhino (http://wiki.eclipse.org/JSDT/Debug). But it doesn't work out of
the box. Even though it is based on JPDA I guess there needs to be
something Rhino specific installed on the serverside.


Sounds interesting. Would be exactly what I had in mind ;-) Will
investigate.


It'd be better if this page wasn't blank:
http://wiki.eclipse.org/JSDT/Debug/Embedding_Rhino_Debugger


Yes, well, I got it sort of working with a bit hacking 

1. deploy two JSDT bundles into Sling:
org.eclipse.wst.jsdt.debug.rhino.debugger
org.eclipse.wst.jsdt.debug.transport
(ignore for now that these bundles use Require-Bundle
and export internals ...)
2. upgrade Sling Rhino reference to 1.7R2
3. inside Sling add a dependency to the
org.eclipse.wst.jsdt.debug.rhino.debugger project checked
out from Eclipse CVS
4. In the SlingContextFactory constructor instantiate a RhinoDebugger
with a connector string (e.g.
transport=socket,suspend=n,address=9000), register it as a
listener and start the RhinoDebugger
5. Export org.mozilla.javascript.debugger package and add an
optional import to org.eclipse.wst.jsdt.debug.rhino.debugger in
the pom.xml
6. build and install the Sling Javascript bundle

Now you can connect to this Debugger with Eclipse ... And yes, I can
connect but I cannot yet cope with filenames...

I create a project and a folder linked to a WebDAV mounted Sling folder
and can then set breakpoints. The problem is, that Eclipse seems to
prefix all script names with the project and folder name and thus is not
able to match the names of executed scripts to apply break points ...

Regards
Felix



Justin


Regards
Felix



Best,

Sandro

Am 16.10.10 20:22, schrieb Felix Meschberger:

Hi Sandro,

The best solution (which I once considered working on a long time ago
but never got around to implement) is to have Rhino debugging
support in
Eclipse.

But for now, you may set the
org.apache.sling.scripting.javascript.debug framework property
(e.g.
in the sling.properties file) to true. When this property is set
to true
Rhino will launch the Swing debugger GUI (on the server system)
once the
Rhino ScriptEngineFactory is started.

Regards
Felix


On 16.10.2010 15:36, Sandro Boehme wrote:

Hello,

I'm trying to get into the Sling Explorer and I'm wondering how
(or if)
you guys debug these esp scripts? While the Eclipse debugger
stops in
jsp files it doesn't stop in esp files as they don't contain Java
code.

Re: Debugging JavaScript esp files

2010-10-17 Thread Sandro Boehme

Hi Felix,

thanks for the feedback.
The Swing debugger GUI doesn't seem to work in this case as it cannot 
open e.g. the explorer.esp file. It says:

Syntax error (.../explorer.esp#83)
This refers to the line containing only form action=# which is 
correct in my opinion.


I also tried the Eclipse IDE for JavaScript Web Developers from 
http://www.eclipse.org/downloads/ as it contains debugging support for 
Rhino (http://wiki.eclipse.org/JSDT/Debug). But it doesn't work out of 
the box. Even though it is based on JPDA I guess there needs to be 
something Rhino specific installed on the serverside.


Best,

Sandro

Am 16.10.10 20:22, schrieb Felix Meschberger:

Hi Sandro,

The best solution (which I once considered working on a long time ago
but never got around to implement) is to have Rhino debugging support in
Eclipse.

But for now, you may set the
org.apache.sling.scripting.javascript.debug framework property (e.g.
in the sling.properties file) to true. When this property is set to true
Rhino will launch the Swing debugger GUI (on the server system) once the
Rhino ScriptEngineFactory is started.

Regards
Felix


On 16.10.2010 15:36, Sandro Boehme wrote:

Hello,

I'm trying to get into the Sling Explorer and I'm wondering how (or if)
you guys debug these esp scripts? While the Eclipse debugger stops in
jsp files it doesn't stop in esp files as they don't contain Java code.
Is there a special JSR-223 debugger plugin or some trick I don't know of?

Best,

Sandro







Re: Debugging JavaScript esp files

2010-10-17 Thread Felix Meschberger
Hi,

On 17.10.2010 16:05, Sandro Boehme wrote:
 Hi Felix,
 
 thanks for the feedback.
 The Swing debugger GUI doesn't seem to work in this case as it cannot
 open e.g. the explorer.esp file. It says:
 Syntax error (.../explorer.esp#83)
 This refers to the line containing only form action=# which is
 correct in my opinion.

I would expect the line to be correct, but I must admit to not have used
this for quite some time, so ... this may really not properly work
(unfortunately).

 
 I also tried the Eclipse IDE for JavaScript Web Developers from
 http://www.eclipse.org/downloads/ as it contains debugging support for
 Rhino (http://wiki.eclipse.org/JSDT/Debug). But it doesn't work out of
 the box. Even though it is based on JPDA I guess there needs to be
 something Rhino specific installed on the serverside.

Sounds interesting. Would be exactly what I had in mind ;-) Will
investigate.

Regards
Felix

 
 Best,
 
 Sandro
 
 Am 16.10.10 20:22, schrieb Felix Meschberger:
 Hi Sandro,

 The best solution (which I once considered working on a long time ago
 but never got around to implement) is to have Rhino debugging support in
 Eclipse.

 But for now, you may set the
 org.apache.sling.scripting.javascript.debug framework property (e.g.
 in the sling.properties file) to true. When this property is set to true
 Rhino will launch the Swing debugger GUI (on the server system) once the
 Rhino ScriptEngineFactory is started.

 Regards
 Felix


 On 16.10.2010 15:36, Sandro Boehme wrote:
 Hello,

 I'm trying to get into the Sling Explorer and I'm wondering how (or if)
 you guys debug these esp scripts? While the Eclipse debugger stops in
 jsp files it doesn't stop in esp files as they don't contain Java code.
 Is there a special JSR-223 debugger plugin or some trick I don't know
 of?

 Best,

 Sandro


 
 


Re: Debugging JavaScript esp files

2010-10-17 Thread Justin Edelson
On Sun, Oct 17, 2010 at 2:28 PM, Felix Meschberger fmesc...@gmail.com wrote:
 Hi,

 On 17.10.2010 16:05, Sandro Boehme wrote:
 Hi Felix,

 thanks for the feedback.
 The Swing debugger GUI doesn't seem to work in this case as it cannot
 open e.g. the explorer.esp file. It says:
 Syntax error (.../explorer.esp#83)
 This refers to the line containing only form action=# which is
 correct in my opinion.

 I would expect the line to be correct, but I must admit to not have used
 this for quite some time, so ... this may really not properly work
 (unfortunately).


 I also tried the Eclipse IDE for JavaScript Web Developers from
 http://www.eclipse.org/downloads/ as it contains debugging support for
 Rhino (http://wiki.eclipse.org/JSDT/Debug). But it doesn't work out of
 the box. Even though it is based on JPDA I guess there needs to be
 something Rhino specific installed on the serverside.

 Sounds interesting. Would be exactly what I had in mind ;-) Will
 investigate.

It'd be better if this page wasn't blank:
http://wiki.eclipse.org/JSDT/Debug/Embedding_Rhino_Debugger

Justin

 Regards
 Felix


 Best,

 Sandro

 Am 16.10.10 20:22, schrieb Felix Meschberger:
 Hi Sandro,

 The best solution (which I once considered working on a long time ago
 but never got around to implement) is to have Rhino debugging support in
 Eclipse.

 But for now, you may set the
 org.apache.sling.scripting.javascript.debug framework property (e.g.
 in the sling.properties file) to true. When this property is set to true
 Rhino will launch the Swing debugger GUI (on the server system) once the
 Rhino ScriptEngineFactory is started.

 Regards
 Felix


 On 16.10.2010 15:36, Sandro Boehme wrote:
 Hello,

 I'm trying to get into the Sling Explorer and I'm wondering how (or if)
 you guys debug these esp scripts? While the Eclipse debugger stops in
 jsp files it doesn't stop in esp files as they don't contain Java code.
 Is there a special JSR-223 debugger plugin or some trick I don't know
 of?

 Best,

 Sandro







Re: Debugging JavaScript esp files

2010-10-17 Thread Felix Meschberger
Hi,

On 17.10.2010 20:34, Justin Edelson wrote:
 On Sun, Oct 17, 2010 at 2:28 PM, Felix Meschberger fmesc...@gmail.com wrote:
 Hi,

 On 17.10.2010 16:05, Sandro Boehme wrote:
 Hi Felix,

 thanks for the feedback.
 The Swing debugger GUI doesn't seem to work in this case as it cannot
 open e.g. the explorer.esp file. It says:
 Syntax error (.../explorer.esp#83)
 This refers to the line containing only form action=# which is
 correct in my opinion.

 I would expect the line to be correct, but I must admit to not have used
 this for quite some time, so ... this may really not properly work
 (unfortunately).


 I also tried the Eclipse IDE for JavaScript Web Developers from
 http://www.eclipse.org/downloads/ as it contains debugging support for
 Rhino (http://wiki.eclipse.org/JSDT/Debug). But it doesn't work out of
 the box. Even though it is based on JPDA I guess there needs to be
 something Rhino specific installed on the serverside.

 Sounds interesting. Would be exactly what I had in mind ;-) Will
 investigate.
 
 It'd be better if this page wasn't blank:
 http://wiki.eclipse.org/JSDT/Debug/Embedding_Rhino_Debugger

Yes, well, I got it sort of working with a bit hacking 

1. deploy two JSDT bundles into Sling:
   org.eclipse.wst.jsdt.debug.rhino.debugger
   org.eclipse.wst.jsdt.debug.transport
   (ignore for now that these bundles use Require-Bundle
and export internals ...)
2. upgrade Sling Rhino reference to 1.7R2
3. inside Sling add a dependency to the
org.eclipse.wst.jsdt.debug.rhino.debugger project checked
out from Eclipse CVS
4. In the SlingContextFactory constructor instantiate a RhinoDebugger
with a connector string (e.g.
transport=socket,suspend=n,address=9000), register it as a
listener and start the RhinoDebugger
5. Export org.mozilla.javascript.debugger package and add an
optional import to org.eclipse.wst.jsdt.debug.rhino.debugger in
the pom.xml
6. build and install the Sling Javascript bundle

Now you can connect to this Debugger with Eclipse ... And yes, I can
connect but I cannot yet cope with filenames...

I create a project and a folder linked to a WebDAV mounted Sling folder
and can then set breakpoints. The problem is, that Eclipse seems to
prefix all script names with the project and folder name and thus is not
able to match the names of executed scripts to apply break points ...

Regards
Felix

 
 Justin

 Regards
 Felix


 Best,

 Sandro

 Am 16.10.10 20:22, schrieb Felix Meschberger:
 Hi Sandro,

 The best solution (which I once considered working on a long time ago
 but never got around to implement) is to have Rhino debugging support in
 Eclipse.

 But for now, you may set the
 org.apache.sling.scripting.javascript.debug framework property (e.g.
 in the sling.properties file) to true. When this property is set to true
 Rhino will launch the Swing debugger GUI (on the server system) once the
 Rhino ScriptEngineFactory is started.

 Regards
 Felix


 On 16.10.2010 15:36, Sandro Boehme wrote:
 Hello,

 I'm trying to get into the Sling Explorer and I'm wondering how (or if)
 you guys debug these esp scripts? While the Eclipse debugger stops in
 jsp files it doesn't stop in esp files as they don't contain Java code.
 Is there a special JSR-223 debugger plugin or some trick I don't know
 of?

 Best,

 Sandro





 


Re: Debugging JavaScript esp files

2010-10-17 Thread Sandro Boehme

Hi Felix,

that was fast. I'm impressed.
Thanks for the tutorial. I can connect too but the debugger also doesn't 
stop at my breakpoint like in your case.


Best,

Sandro

PS: Just in case somebody else want to follow: The export in step 5 is 
org.mozilla.javascript.debug.



Am 17.10.10 23:00, schrieb Felix Meschberger:

Hi,

On 17.10.2010 20:34, Justin Edelson wrote:

On Sun, Oct 17, 2010 at 2:28 PM, Felix Meschbergerfmesc...@gmail.com  wrote:

Hi,

On 17.10.2010 16:05, Sandro Boehme wrote:

Hi Felix,

thanks for the feedback.
The Swing debugger GUI doesn't seem to work in this case as it cannot
open e.g. the explorer.esp file. It says:
Syntax error (.../explorer.esp#83)
This refers to the line containing only form action=# which is
correct in my opinion.


I would expect the line to be correct, but I must admit to not have used
this for quite some time, so ... this may really not properly work
(unfortunately).



I also tried the Eclipse IDE for JavaScript Web Developers from
http://www.eclipse.org/downloads/ as it contains debugging support for
Rhino (http://wiki.eclipse.org/JSDT/Debug). But it doesn't work out of
the box. Even though it is based on JPDA I guess there needs to be
something Rhino specific installed on the serverside.


Sounds interesting. Would be exactly what I had in mind ;-) Will
investigate.


It'd be better if this page wasn't blank:
http://wiki.eclipse.org/JSDT/Debug/Embedding_Rhino_Debugger


Yes, well, I got it sort of working with a bit hacking 

1. deploy two JSDT bundles into Sling:
org.eclipse.wst.jsdt.debug.rhino.debugger
org.eclipse.wst.jsdt.debug.transport
(ignore for now that these bundles use Require-Bundle
 and export internals ...)
2. upgrade Sling Rhino reference to 1.7R2
3. inside Sling add a dependency to the
 org.eclipse.wst.jsdt.debug.rhino.debugger project checked
 out from Eclipse CVS
4. In the SlingContextFactory constructor instantiate a RhinoDebugger
 with a connector string (e.g.
 transport=socket,suspend=n,address=9000), register it as a
 listener and start the RhinoDebugger
5. Export org.mozilla.javascript.debugger package and add an
 optional import to org.eclipse.wst.jsdt.debug.rhino.debugger in
 the pom.xml
6. build and install the Sling Javascript bundle

Now you can connect to this Debugger with Eclipse ... And yes, I can
connect but I cannot yet cope with filenames...

I create a project and a folder linked to a WebDAV mounted Sling folder
and can then set breakpoints. The problem is, that Eclipse seems to
prefix all script names with the project and folder name and thus is not
able to match the names of executed scripts to apply break points ...

Regards
Felix



Justin


Regards
Felix



Best,

Sandro

Am 16.10.10 20:22, schrieb Felix Meschberger:

Hi Sandro,

The best solution (which I once considered working on a long time ago
but never got around to implement) is to have Rhino debugging support in
Eclipse.

But for now, you may set the
org.apache.sling.scripting.javascript.debug framework property (e.g.
in the sling.properties file) to true. When this property is set to true
Rhino will launch the Swing debugger GUI (on the server system) once the
Rhino ScriptEngineFactory is started.

Regards
Felix


On 16.10.2010 15:36, Sandro Boehme wrote:

Hello,

I'm trying to get into the Sling Explorer and I'm wondering how (or if)
you guys debug these esp scripts? While the Eclipse debugger stops in
jsp files it doesn't stop in esp files as they don't contain Java code.
Is there a special JSR-223 debugger plugin or some trick I don't know
of?

Best,

Sandro