[jira] Created: (SLING-989) scripts in /apps are read by user session, this leads to security problem

2009-06-02 Thread Michael Marth (JIRA)
scripts in /apps are read by user session, this leads to security problem
-

 Key: SLING-989
 URL: https://issues.apache.org/jira/browse/SLING-989
 Project: Sling
  Issue Type: Bug
Reporter: Michael Marth


At the moment the user session is used to read the scripts stored in /apps. 
Most web apps have some anonymous users as well, therefore the ACLs of /apps 
must allow read access of the /apps directory. Hence, all scripts within /apps 
are readable by anyone.

I suggest to allow the Sling administrator to configure which session to use 
when the scripts are read. He could choose the admin session or stick with the 
default (the user's session).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



Re: (In)Security in Sling

2009-06-02 Thread Michael Marth
Hi,

thanks John, for pointing this out.

Part of the problem you describe is misconfigurations on my part (I did not
realize that the anonymous user is not part of the everyone group). But
as Felix has described the problem with the /apps directory cannot be fixed
by configuration. I just filed bug 989 [1] for this (an in-the-air collision
with Felix' mail).

As a third aspect: I believe there are parts in most sites where the json
representation is not desired. What do you think about making the json
servlet more configurable in terms of black/whitelisting properties it
renders? That would be on top of all other proper security measures, of
course.

Michael

[1] https://issues.apache.org/jira/browse/SLING-989

On Tue, Jun 2, 2009 at 12:33 PM, Felix Meschberger fmesc...@gmail.comwrote:

 Hi,

 John Crawford schrieb:
  I have been working with sling for quite some time and, of course, Day
  products.  One thing that I have been increasingly concerned with is the
 end
  users ability to scrape all of the sites content and code with minimal
  effort using the built in functionality of the SlingPostServlet.

 The Sling Get Servlet to be precise ;-)

 
  For Example:
 
  http://dev.day.com/discussion-groups/users.infinity.json
  http://dev.day.com/discussion-groups/apps.infinity.json

 As Jukka said, you may employ access control to prevent this.

 But there is a glitch for the scripts located in /apps and /libs:
 Currently scripts are read from the repository using the session of the
 current user, that is the request user.

 So preventing access to

  http://dev.day.com/discussion-groups/apps/mailingLists/mailingLists.jsp

 by simply denying read-access for the anonymous user actually prevents
 using the site at all.

 One solution to this problem could be to not load the scripts with the
 session of the current user but to use a special-purpose session (for
 example an admin session) to do this.

 This way, you may lock down /apps and /libs for general consumption but
 may still execute the scripts in there.

 WDYT ?

 Regards
 Felix


 (this
  one really disturbs me)
 
  So far, my solution has been to provide a proxy (namely Apache2) in front
 of
  sling to filter out any undesired requests.  Seems to work.  But, by
 doing
  this, it takes way what is so cool about Sling.  I have reported to Day
  Support numerous times, but they don't seem too concerned about it.  But
 for
  sites where the content is critical or where we require users to pay for
 our
  content, it is very important to us.
 
  Is there a better way to handle this?
 
  Please let me know your thoughts.
 
  Respectfully,
  John
 




-- 
Michael Marth | http://dev.day.com/


Re: [VOTE] Graduate Apache Sling as a top level project

2009-05-19 Thread Michael Marth
 [x] +1 Graduate as a top level project
(non binding)



-- 
Michael Marth | http://dev.day.com/


Re: Integrate Sling with data from another system

2009-03-16 Thread Michael Marth
Hi,

[I believe that large parts of your question are of interest for the Sling
group, so I'll answer here. For the parts that are related to Communique
only you might want to head over to
http://groups.google.com/group/day-communique]

As far as I understand it you try do to the import in a way that is
possible, but not very JCR-like:

As the data is not stored in JCR repository as nodes, but a plain file

I would recommend to actually store each of your products in a JCR node at a
path like /mobile/handset/NokiaN75 or /content/mobile/handset/NokiaN75
Like that the script resolution is handled by Sling and you will not need
the 20+ controllers.

The import itself could be done with a little standalone JCR app.
IIRC Sling can also process POSTed XML files (and produce nodes) so if you
can control the incoming XML format that might be even simpler (but I would
personally go the first route)

hth
Michael

On Sun, Mar 15, 2009 at 7:21 AM, tao wen tao...@gmail.com wrote:

 Integrate Sling with data from another system



 We are working a public website using CQ 5. Some of the data like product
 catalogue comes from another system. The requirement asks us to get the
 data
 and embed them as part of the page hosted by CQ. This is a challenging job
 to us, as we can not find any example out there doing this. The challenges
 we have identified are:



 1. How to get/load the data

 2. How the data being updated and notified

 3. How the data being rendered

 4. How to embed them as part of the page



 Before we sending out this mail to ask for help, we did some consulting
 with
 sales of CQ, and did some homework like reading source code of sling. Here
 are our planned apporaches. We need some advices here about are those
 apporaches following the best practices of sling or simply anti-patterns.



 1.   How to get/load the data

 Some background: we will deploy three CQ instances. One author instance and
 two publish instances. The data will be prepared in author instance using
 JDBC, and doing some transformation in memory. The result will be persisted
 into a xml file and saved in JCR repository. We rely on replication
 functionality to publish the xml file to the publish instance. Then in the
 publish instance we just need to read things in xml back into memory.



 2.   How the data being updated and notified

 We will set up a scheduler in author instance to poll the data every day.
 The update will be notified as event. If the replication process can
 generate event itself, then we will rely on it. Otherwise, we need to set
 up
 new topic and publish event to it when the serialized xml file being
 updated. We assume CQ will distribute the event to publish instance so that
 the publish instance can know they need to refresh the data in memory using
 the updated xml file.



 3.   How the data being rendered

 As the data is not stored in JCR repository as nodes, but a plain file, so
 things like /mobile/handset/NokiaN75 can not be understand by CQ. To make
 those nodes available, we write our own resource provider, and map it to
 /mobile/handset. We will do URL parsing ourself to get the parameters. The
 final resource provided to script engine will contain the necessary data.
 In
 the page, we can reference the handset by reference the current node (a.k.a
 the resource provided). The resource provider is similar to tranditional
 controller in MVC architecture. So there might be 20+ controllers in a
 system, would that be a issue?



 4.   How to embed them as part of the page

 We leverage the CQ component here. The component will be configured with a
 URL, where it can fetch its html. So, the comonent can not render itself,
 instead, it relies on another URL to do it (which is backened by a
 controller). To do this, we either need to implement some sort of server
 side include, or using client side ajax call. The concern of server side
 include is how to do that, and how to pass user session. The concern of
 using client side ajax call is the user experience might be impacted as the
 network could be slow. We were told from the sales of CQ that to be
 effective about page caching, we’d better to use ajax call to retrieve the
 dynamic content.



 Any comments?




-- 
Michael Marth | http://dev.day.com/


Re: documentation for server-side ECMAscript

2009-02-17 Thread Michael Marth
Lars Trieloff's cheat sheet might also help:

http://dev.day.com/microsling/content/blogs/main/cheatsheet.html

Michael

On Tue, Feb 17, 2009 at 9:16 AM, Felix Meschberger fmesc...@gmail.comwrote:

 Hi,

 Valentin Jacquemin schrieb:
  Something that helped me a lot was to have a look at the unit tests
  particularly under
 
 /sling_src_home/scripting/javascript/src/test/java/org/apache/sling/scripting
  (it seems that the Sling svn is not alive anymore.. )

 Yes, the Apache SVN server seems to be out of service at the moment :-(

 Regards
 Felix

 
  My 0.5 cents ;)
 
  On Mon, Feb 16, 2009 at 8:19 PM, Felix Meschberger fmesc...@gmail.com
 wrote:
 
  Hi,
 
  There are a few server side scripts in the sample modules as well as the
  integration tests (look for .esp files).
 
  Additionally [1] might also help.
 
  Regards
  Felix
 
  [1] http://cwiki.apache.org/SLING/scripting-variables.html
 
  vkrejcirik schrieb:
  Hi, can I ask you, if it exists any documentation or examples of
  server-side ECMAscript which is uses for rendering of content?
 
 
 
 




-- 
Michael Marth | http://dev.day.com/


[jira] Created: (SLING-860) OpenId authenticator problem

2009-02-17 Thread Michael Marth (JIRA)
OpenId authenticator problem


 Key: SLING-860
 URL: https://issues.apache.org/jira/browse/SLING-860
 Project: Sling
  Issue Type: Question
  Components: Extensions
Reporter: Michael Marth
Priority: Minor


this is probably a configuration problem, but I do not know how to get around 
this:

Using the OpenId authenticator I cannot write to the repository.

--
How to reproduce:

- install bundle espblog from samples
- install bundle openid from extensions
- in system config switch off allow anon access as described in 
openid-authenticator description
- do openid login (and make sure you have no http basic auth credentials in the 
request)
- try to write to repository - javax.jcr.AccessDeniedException: /: not allowed 
to modify item

--
I believe the openid_user has no write acccess which would explain this 
behaviour. But how do I get around it? Do I have to write my own AccessManager? 
Do I miss something?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (SLING-757) changing default access rights not possible

2008-12-04 Thread Michael Marth (JIRA)
changing default access rights not possible
---

 Key: SLING-757
 URL: https://issues.apache.org/jira/browse/SLING-757
 Project: Sling
  Issue Type: Bug
 Environment: vista
Reporter: Michael Marth


Trying to change the default access rights is not possible in the Sling console.

Go to
http://localhost:/system/console/configMgr/org.apache.sling.engine.impl.auth.SlingAuthenticator

Untick auth.annonymous.name,
hit save

- result: option still ticked

(btw: auth.annonymous.name is a bit cryptic :) )

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Closed: (SLING-673) sample application that demonstartes .esp scripts and osgi bundles

2008-12-04 Thread Michael Marth (JIRA)

 [ 
https://issues.apache.org/jira/browse/SLING-673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Marth closed SLING-673.
---

Resolution: Fixed

works if SLING-757 is also fixed (i.e. had to set anon access to false in the 
source code) 

 sample application that demonstartes .esp scripts and osgi bundles
 --

 Key: SLING-673
 URL: https://issues.apache.org/jira/browse/SLING-673
 Project: Sling
  Issue Type: Improvement
  Components: Samples
Reporter: Michael Marth
 Attachments: myblog.zip


 A little blog sample application that can be included with the Sling samples. 
 It includes some esp scripts and an OSGi bundle that generates thumbnails 
 from uploaded images. A Readme file is provided with further information.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (SLING-757) changing default access rights not possible

2008-12-04 Thread Michael Marth (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12653313#action_12653313
 ] 

Michael Marth commented on SLING-757:
-

did an update and clean build today

 changing default access rights not possible
 ---

 Key: SLING-757
 URL: https://issues.apache.org/jira/browse/SLING-757
 Project: Sling
  Issue Type: Bug
 Environment: vista
Reporter: Michael Marth

 Trying to change the default access rights is not possible in the Sling 
 console.
 Go to
 http://localhost:/system/console/configMgr/org.apache.sling.engine.impl.auth.SlingAuthenticator
 Untick auth.annonymous.name,
 hit save
 - result: option still ticked
 (btw: auth.annonymous.name is a bit cryptic :) )

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (SLING-757) changing default access rights not possible

2008-12-04 Thread Michael Marth (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12653320#action_12653320
 ] 

Michael Marth commented on SLING-757:
-

Yes, I am using the console that comes along when I build Sling. I was not 
aware that this is problematic. Is Sling's version outdated or even obsolete? 
In that case we should maybe remove it altogether - or ensure that a current 
console is built.

(My specific problem was solved by changing the parameter in source. However, 
one of the samples did not work without changing this setting.)

 changing default access rights not possible
 ---

 Key: SLING-757
 URL: https://issues.apache.org/jira/browse/SLING-757
 Project: Sling
  Issue Type: Bug
 Environment: vista
Reporter: Michael Marth

 Trying to change the default access rights is not possible in the Sling 
 console.
 Go to
 http://localhost:/system/console/configMgr/org.apache.sling.engine.impl.auth.SlingAuthenticator
 Untick auth.annonymous.name,
 hit save
 - result: option still ticked
 (btw: auth.annonymous.name is a bit cryptic :) )

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (SLING-757) changing default access rights not possible

2008-12-04 Thread Michael Marth (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12653324#action_12653324
 ] 

Michael Marth commented on SLING-757:
-

OK, can try. If I understand correctly I need to build Apache Felix separately 
and get its console into Sling. Is that correct? If so, are there some 
instructions on how to do that?

 changing default access rights not possible
 ---

 Key: SLING-757
 URL: https://issues.apache.org/jira/browse/SLING-757
 Project: Sling
  Issue Type: Bug
 Environment: vista
Reporter: Michael Marth

 Trying to change the default access rights is not possible in the Sling 
 console.
 Go to
 http://localhost:/system/console/configMgr/org.apache.sling.engine.impl.auth.SlingAuthenticator
 Untick auth.annonymous.name,
 hit save
 - result: option still ticked
 (btw: auth.annonymous.name is a bit cryptic :) )

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (SLING-757) changing default access rights not possible

2008-12-04 Thread Michael Marth (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=1265#action_1265
 ] 

Michael Marth commented on SLING-757:
-

the problem is gone with the latest Felix console.

Leaving this open as a reminder to upgrade the console.

 changing default access rights not possible
 ---

 Key: SLING-757
 URL: https://issues.apache.org/jira/browse/SLING-757
 Project: Sling
  Issue Type: Bug
 Environment: vista
Reporter: Michael Marth

 Trying to change the default access rights is not possible in the Sling 
 console.
 Go to
 http://localhost:/system/console/configMgr/org.apache.sling.engine.impl.auth.SlingAuthenticator
 Untick auth.annonymous.name,
 hit save
 - result: option still ticked
 (btw: auth.annonymous.name is a bit cryptic :) )

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (SLING-749) No renderer for extension='t' (500)

2008-12-02 Thread Michael Marth (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12652357#action_12652357
 ] 

Michael Marth commented on SLING-749:
-

the issue was introduced in rev 722089 it seems. rev 722065 works ok.

 No renderer for extension='t' (500)
 ---

 Key: SLING-749
 URL: https://issues.apache.org/jira/browse/SLING-749
 Project: Sling
  Issue Type: Bug
 Environment: windows
Reporter: Michael Marth
Assignee: Felix Meschberger

 just checked out Sling from trunk and built it (without running the tests), 
 then did
 mvn jetty:run
 curl -Fsling:resourceType=foo/bar -Ftitle=some title http://admin:[EMAIL 
 PROTECTED]:/content/mynode
 Hitting http://localhost:/content/mynode
 gives me:
 No renderer for extension='t' (500)
 The requested URL /content/mynode resulted in an error in 
 org.apache.sling.servlets.get.DefaultGetServlet.
 (cannot see anything in the error.log though)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (SLING-749) No renderer for extension='t' (500)

2008-12-02 Thread Michael Marth (JIRA)
No renderer for extension='t' (500)
---

 Key: SLING-749
 URL: https://issues.apache.org/jira/browse/SLING-749
 Project: Sling
  Issue Type: Bug
 Environment: windows
Reporter: Michael Marth


just checked out Sling from trunk and built it (without running the tests), 
then did

mvn jetty:run
curl -Fsling:resourceType=foo/bar -Ftitle=some title http://admin:[EMAIL 
PROTECTED]:/content/mynode

Hitting http://localhost:/content/mynode
gives me:

No renderer for extension='t' (500)
The requested URL /content/mynode resulted in an error in 
org.apache.sling.servlets.get.DefaultGetServlet.


(cannot see anything in the error.log though)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



json query servlet and excerpt path

2008-12-02 Thread Michael Marth
Hi,

I tried to make sense of the re:excerpt feature in the json query servlet
and hit the same problem as in [1]

After a fresh Sling install this query

http://localhost:/content.query.json?queryType=xpathstatement=//*[jcr:contains(jcr:content,'sling')]/rep:excerpt(
.)

gives the correct but slightly useless result

[{name:index.html,jcr:path:/index.html,rep:excerpt():excerptfragment\/fragment\/excerpt,jcr:score:1000},{name:sling-test.html,jcr:path:/sling-test/sling/sling-test.html,rep:excerpt():excerptfragment\/fragment\/excerpt,jcr:score:904}]

(i.e. the excerpts are correct, but it is desirable to get the excepts of
the jcr:content node below)
However, adding an excerptPath like:

http://localhost:/content.query.json?queryType=xpathstatement=//*[jcr:contains(jcr:content,'sling')]/rep:excerpt(.)excerptPath=jcr:content

gives:

[{name:index.html,jcr:path:/index.html,rep:excerpt():,jcr:score:1000},{name:sling-test.html,jcr:path:/sling-test/sling/sling-test.html,rep:excerpt():,jcr:score:904}]

(i.e. no excerpts at all).
Is this a user error on my part or a bug?


A second issue I have: without excerpts I get the jcr:primaryType in the
results, but I do not get this property when the query contains an excerpt.
i.e.

http://localhost:/content.query.json?queryType=xpathstatement=//*[jcr:contains(jcr:content,'sling')]

yields

[{name:index.html,jcr:path:/index.html,jcr:score:1000,jcr:primaryType:nt:file},{name:sling-test.html,jcr:path:/sling-test/sling/sling-test.html,jcr:score:904,jcr:primaryType:nt:file}]

Shouldn't the primaryType be present even with the excerpt?

Thanks for having a look
best regards
Michael


[1]
http://in-the-sling.blogspot.com/2008/09/how-to-use-json-query-servlet.html

-- 
Michael Marth | http://dev.day.com/


Re: Binary values

2008-11-03 Thread Michael Marth
Hi Christian,

you can use binary properties
(see
http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/PropertyType.html
)

Cheers
Michael

On Fri, Oct 31, 2008 at 9:35 PM, Christian Sprecher
[EMAIL PROTECTED] wrote:

 Hey folks

 What is your take on binary values? I know about the file uploading
 stuff, but what should I do if I want to store binary property values?
 Should I base64-encode the value and decode it on the server side again?

 Is this a valid question anyways?

 Thx in advance

 Christian Sprecher




-- 
Michael Marth | http://dev.day.com/


Re: Half pre-processing a POST

2008-10-15 Thread Michael Marth
Bertrand, I think we discussed the same request here [1] and there were some
good suggestions, but I do not know if there was anything implemented.

Josh, I would also like to see your request be solved in general. However,
for your particular use case (thumbnail generation) there is an OSGi bundle
that uses JCR EventListeners here [2]

Michael

[1] http://dev.day.com/discussion-groups/content/lists.go/mlxxagiz
[2] https://issues.apache.org/jira/browse/SLING-673

On Wed, Oct 15, 2008 at 9:35 AM, Bertrand Delacretaz [EMAIL PROTECTED]
 wrote:

 Hi Josh,

 On Tue, Oct 14, 2008 at 10:07 PM, Joshua Oransky [EMAIL PROTECTED]
 wrote:
  ...what I need is a way of processing those files before they are
 written.
  My use case is that I want users to upload a single large image, and
 process
  it with an image lib to generate thumbnails, etc. But I don't want to
 have
  to write all the code to ALSO persist the text data, like image
 description,
  etc...

 Ok - I think I would rather generate thumbnails and the like
 asynchronously, but in general being able to process files before
 storage makes sense.

 ... So what I want, is a way to handle storing of the files separately,
 but
  leave the text data to the Sling servlet. Of course, one could also
  intercept some of the text data as well. The point is how do I write code
 to
  only worry about the stuff I need, and let Sling persist anything else
  normally

 What would be the unit of stuff I need? Would you want to process
 some request parameters and let Sling process some others, or is that
 something else?

 -Bertrand




-- 
Michael Marth | http://dev.day.com/


Re: Support for Javafx or Openjfx?

2008-10-10 Thread Michael Marth
Hi Paksegu,

I do not know enough about JavaFX, but I have built a Flex app that
retrieves its content from Sling using the Sling js library
(/system/sling.js). If JavaFX allows to interface JS code it should work the
same.

Michael

On Thu, Oct 9, 2008 at 5:07 PM, paksegu [EMAIL PROTECTED] wrote:

 Hi,
 Can Sling support Javafx or Openjfx by using the Sling script extension?
 Thanks







-- 
Michael Marth | http://dev.day.com/


Re: SlingPostServlet: How to handle resource paths when creating content (Re: [jira] Commented: (SLING-588) Sling ignores specified node path when creating content)

2008-09-23 Thread Michael Marth
Hi Felix, Lars,

thanks for the help. I will give it a try.

Yet, I still wonder why we chose to ignore selectors and extensions on
POSTs. It appears inconsistent to me that we have these mechanisms that work
beautifully for GET requests, but on POSTs they don't.
Actually, before looking into the docu and asking here I spent quite some
time just trying to POST to a script with a selector because I naturally
assumed that this would work.
Maybe there is a good reason why POSTs with selectors are a bad idea, but
otherwise I suggest to re-consider them.
WDYT?

Michael



You can help yourself with a servlet which you write for your blog post
 resource type handling POST requests.

 In addition your servlet would implement the OptingServlet interface,
 which has the accepts(SlingHttpServletRequest) method. In this method
 you check whether the POST request is a Trackback request or not. If the
 request is a simple update POST, just return false and your servlet will
 be ignored.

 If the POST request is a Trackback request, return true and your servlet
 will be called to handle the POST request and the default
 SlingPostServlet will not be called.






-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/


prefix :jcr: in json

2008-09-23 Thread Michael Marth
Hi,

for the json presentation of nt:resource nodes I get one property with
prefix :jcr: instead of jcr:. Is this the expected behavior?

  Creek.jpg:{
 jcr:created:Tue Sep 23 2008 10:44:54 GMT+0200,
 jcr:primaryType:nt:file,
 jcr:content:{
jcr:uuid:2cd77618-dae5-4e45-bd91-800da6bf48cf,
*:jcr:data:264409,*
jcr:mimeType:image/jpeg,
jcr:lastModified:Thu Sep 04 2008 14:44:56 GMT+0200,
jcr:primaryType:nt:resource
 }
  }

(using the Sling version that came with CRX Quickstart)

Michael

-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/


[jira] Created: (SLING-673) sample application that demonstartes .esp scripts and osgi bundles

2008-09-23 Thread Michael Marth (JIRA)
sample application that demonstartes .esp scripts and osgi bundles
--

 Key: SLING-673
 URL: https://issues.apache.org/jira/browse/SLING-673
 Project: Sling
  Issue Type: Improvement
  Components: Samples
Reporter: Michael Marth
 Attachments: myblog.zip

A little blog sample application that can be included with the Sling samples. 
It includes some esp scripts and an OSGi bundle that generates thumbnails from 
uploaded images. A Readme file is provided with further information.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



Re: SlingPostServlet: How to handle resource paths when creating content (Re: [jira] Commented: (SLING-588) Sling ignores specified node path when creating content)

2008-09-18 Thread Michael Marth
Hi Felix,

I have a question about that:

URL for the selection of the concrete representation (script). For other
 requests (POST, DELETE, ...) you want to modify the resource (and don't
 care for the representation) and hence _should_ address the resource
 directly without any representational detail such as selectors and
 extensions.


I would like to implement two different POST features on one node. As
always, a blog example :) The nodes are blog posts, one feature is posting
reader comments, the second feature is trackbacks (which come along as POST
requests from other blogs).

For the comments I am OK with the default behavior (I do not want to
overwrite POST.esp). For the trackback feature I need to implement a custom
behavior (as specified or rather agreed upon by the different blog systems).
How could I construct a URL that would make it possible to distinguish the
two POSTs if there are no selectors?

Related to this: trackback POSTs are supposed to return an xml document
containing success or error messages. So in my understanding of Sling's
handling of extensions for GET requests the URL for trackback POSTs should
end in .xml. You might say that there is no problem, because Sling ignores
the extension anyway, so it might as well be .xml, but it seems a bit
inconsistent to me. I think a POST to /foo.xml should return xml and a POST
to /foo.html should return html

Cheers
Michael

-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/


Re: :operation=delete

2008-09-17 Thread Michael Marth
Hi Juerg,

are you using the latest Sling or the version bundled with CRX Quickstart? I
think in the latter :operation=delete does not work, unfortunately.

Michael

On Tue, Sep 16, 2008 at 11:44 PM, Juerg Meier [EMAIL PROTECTED] wrote:

 Hi all,

 I send a POST with :operation=delete as hidden input field to a
 resource, and it returns with http 200 OK. But the node is still there.
 This also happens when using curl according to the doc

$ curl -F:operation=delete http://host/content/sample

 Again, 200, but node remains in its place. Has the syntax changed
 meanwhile?

 Thanks,
 Juerg




-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/


Re: :operation=delete

2008-09-17 Thread Michael Marth
Hi Juerg,

alternatively, you can update your CRX Quickstart (see [1] for a how-to)

hth
Michael

[1] http://dev.day.com/microsling/content/blogs/main/updatecrxqs.html

On Wed, Sep 17, 2008 at 11:50 AM, Bertrand Delacretaz 
[EMAIL PROTECTED] wrote:

 On Wed, Sep 17, 2008 at 8:59 AM, Michael Marth [EMAIL PROTECTED] wrote:
  ...are you using the latest Sling or the version bundled with CRX
 Quickstart? I
  think in the latter :operation=delete does not work, unfortunately...

 I checked the CRX quickstart jar file at [1], and it uses Sling code
 from 2008-05-13.

 At that time the syntax was different, to delete /foo you'd do

  curl -F :delete=/foo http://admin:[EMAIL PROTECTED]:7402/foo

 That works for me against that Sling instance.

 Hope this helps,
 -Bertrand

 [1] http://dev.day.com/microsling/content/blogs/cup/downloads.c.html




-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/


Re: Day Discussion Forum

2008-09-11 Thread Michael Marth
Hi,

I took Jukka Zittings code to retrieve emails and store them as JCR nodes.
It is currently running as a separate process that connects to the
repository via RMI (that could also be done as OSGi bundles). The frontend
is Sling scripts written in JSP.
Here's some info on the email retrieval:
http://dev.day.com/microsling/content/blogs/main/jcrmail.html

Cheers
Michael

On Thu, Sep 11, 2008 at 5:24 PM, paksegu [EMAIL PROTECTED] wrote:

 Hi,
 How was Day Discussion Forum built with sling able to fetch email message
 from apache done? Thx

 Ransford Segu-Baffoe

 [EMAIL PROTECTED]

 https://serenade.dev.java.net/
 http://www.noqmx.com/







-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/


[jira] Commented: (SLING-615) Some jst's do not work on Mac

2008-08-18 Thread Michael Marth (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-615?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12623291#action_12623291
 ] 

Michael Marth commented on SLING-615:
-

I attached the app. Use it like this:

fill in content at .../content/tss/posts/*.post.html
aprrove content at .../content/tss/posts.admin.html
view list at .../content/tss/posts.html

on my Windows machine all these steps work. On a Mac the first and the third 
seem not to work.

 Some jst's do not work on Mac
 -

 Key: SLING-615
 URL: https://issues.apache.org/jira/browse/SLING-615
 Project: Sling
  Issue Type: Bug
  Components: Scripting
Reporter: Felix Meschberger
 Attachments: tss.zip


 Michael Marth reported on some JSTs not working on Mac OS X:
 I saw this problem during a presales training, but thought it is with a
 particular machine only. Now Kathy has sent the mail below where the problem
 with jst's on Macs is described in detail.
 The problem does not occur on Windows
 --
 For some reason, on the mac, Phil and I have had to name some of the files 
 that
 you use as jst to esp. (Bertrand suggested this solution while we were in for
 training.) The two problem files are post.jst/esp and html.jst/esp.  Naming
 these two files with the .jst extension just returns an empty page.   (None of
 our XP buddies are having this problem, only us mac users.) For some reason,
 admin.jst works just fine...(and, yes, I am moving the files up to the tss
 directory as described in the errata)
 Once renamed, post.esp also works just fine. 
 However, html.esp is throwing a 'Sling is not defined' error for the 
 following
 statement:
 posts=Sling.getContent(/content/tss/posts, 2);
 I saw in a PDF file on the wiki that I might have to include sling.js as a
 script in the file.  And the notes say that I also have to sling-551.js.  So I
 included both files in the following fashion, as suggested by the Non CMS Web
 App.pdf document:
 script src=/system/sling.js/script
 script src=/system/sling-551.js/script
 (and yes, both of those files are in /system)
 However, it is throwing the same error.  So I have two questions:
 1) Why is jst working only intermittently on the mac?
 2) If we have to rename the files to esp, how can I get html.esp to recognize
 the sling library? Do I have to put sling.js in a different place?
 I do not have an assessment for this issue. Maybe someone else here ?
 In addition, I also asked for the sample files and logs etc.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (SLING-567) sling.include inclides fragments in the wrong order

2008-08-18 Thread Michael Marth (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12623294#action_12623294
 ] 

Michael Marth commented on SLING-567:
-

Request Dispatcher has the same behaviour. This jsp a.jsp:

aaa
1% sling.include(currentNode.getPath() + .b.html); % 

2%
   javax.servlet.RequestDispatcher rd = 
request.getRequestDispatcher(/content/myapp/mynode.b.html);
   rd.include(request, response); 
%

returns: bbb bbb aaa 1 2
expected: aaa 1bbb 2bbb

(I tested this in CRX Quickstart, maybe the servlet engine matters)

 sling.include inclides fragments in the wrong order
 ---

 Key: SLING-567
 URL: https://issues.apache.org/jira/browse/SLING-567
 Project: Sling
  Issue Type: Bug
Affects Versions: Scripting JSP 2.0.2
Reporter: Michael Marth

 (This is observed in revision 670551)
 consider a jsp /apps/myapp/a.jsp which contains:
 aaa
 % sling.include(currentNode.getPath() + .b.html); %
 and another jsp /apps/myapp/b.jsp which contains
 bbb
 if i execute /content/myapp/mynode.a.html i get
 bbb
 aaa
 expected result is:
 aaa
 bbb

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (SLING-615) Some jst's do not work on Mac

2008-08-18 Thread Michael Marth (JIRA)

 [ 
https://issues.apache.org/jira/browse/SLING-615?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Marth updated SLING-615:


Attachment: tss.zip

the application

 Some jst's do not work on Mac
 -

 Key: SLING-615
 URL: https://issues.apache.org/jira/browse/SLING-615
 Project: Sling
  Issue Type: Bug
  Components: Scripting
Reporter: Felix Meschberger
 Attachments: tss.zip


 Michael Marth reported on some JSTs not working on Mac OS X:
 I saw this problem during a presales training, but thought it is with a
 particular machine only. Now Kathy has sent the mail below where the problem
 with jst's on Macs is described in detail.
 The problem does not occur on Windows
 --
 For some reason, on the mac, Phil and I have had to name some of the files 
 that
 you use as jst to esp. (Bertrand suggested this solution while we were in for
 training.) The two problem files are post.jst/esp and html.jst/esp.  Naming
 these two files with the .jst extension just returns an empty page.   (None of
 our XP buddies are having this problem, only us mac users.) For some reason,
 admin.jst works just fine...(and, yes, I am moving the files up to the tss
 directory as described in the errata)
 Once renamed, post.esp also works just fine. 
 However, html.esp is throwing a 'Sling is not defined' error for the 
 following
 statement:
 posts=Sling.getContent(/content/tss/posts, 2);
 I saw in a PDF file on the wiki that I might have to include sling.js as a
 script in the file.  And the notes say that I also have to sling-551.js.  So I
 included both files in the following fashion, as suggested by the Non CMS Web
 App.pdf document:
 script src=/system/sling.js/script
 script src=/system/sling-551.js/script
 (and yes, both of those files are in /system)
 However, it is throwing the same error.  So I have two questions:
 1) Why is jst working only intermittently on the mac?
 2) If we have to rename the files to esp, how can I get html.esp to recognize
 the sling library? Do I have to put sling.js in a different place?
 I do not have an assessment for this issue. Maybe someone else here ?
 In addition, I also asked for the sample files and logs etc.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



Re: Scripts for Basic Versioning

2008-08-13 Thread Michael Marth
Here's an example script[1] for a POST that creates versions - a JSP,
though. (have a look in the attached zip file)

Michael

[1] http://dev.day.com/microsling/content/blogs/main/anothersampleapp.html

On Tue, Aug 12, 2008 at 7:34 PM, Outta Sight [EMAIL PROTECTED] wrote:

 I'm looking for an example of how to perform versioned POSTs (POST.esp) and
 also how to access a list of these versions (versions.esp) for any node. It
 seems that this sort of capability must be scripted using Sling scripts.
 Does anybody have examples using Javascript? Because Sling is built on top
 of a content repository where one of the primary features is versioning -
 I'd like to know how to do this.

 Outta







-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/


Re: Scripts for Basic Versioning

2008-08-13 Thread Michael Marth
Outta,

just saw only now that you've already referred to that post on this list.
There is also a bit of .esp sample code here[1] - not quite what you are
looking for, but maybe enough to get you started (have a look in apps.zip -
mailingLists/query)

Michael

[1] http://dev.day.com/microsling/content/blogs/main/littleapp.html

On Wed, Aug 13, 2008 at 1:53 PM, Michael Marth [EMAIL PROTECTED] wrote:

 Here's an example script[1] for a POST that creates versions - a JSP,
 though. (have a look in the attached zip file)

 Michael

 [1] http://dev.day.com/microsling/content/blogs/main/anothersampleapp.html

 On Tue, Aug 12, 2008 at 7:34 PM, Outta Sight [EMAIL PROTECTED] wrote:

 I'm looking for an example of how to perform versioned POSTs (POST.esp)
 and also how to access a list of these versions (versions.esp) for any node.
 It seems that this sort of capability must be scripted using Sling scripts.
 Does anybody have examples using Javascript? Because Sling is built on top
 of a content repository where one of the primary features is versioning -
 I'd like to know how to do this.

 Outta







 --
 Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/




-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/


[jira] Commented: (SLING-567) sling.include inclides fragments in the wrong order

2008-07-30 Thread Michael Marth (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12618380#action_12618380
 ] 

Michael Marth commented on SLING-567:
-

Felix, re your last two comments: the reported behavior/bug is regarding % 
sling.include(...) % not sling:include ...
(so the comparison to jsp:include... is invalid IMO)

 sling.include inclides fragments in the wrong order
 ---

 Key: SLING-567
 URL: https://issues.apache.org/jira/browse/SLING-567
 Project: Sling
  Issue Type: Bug
Affects Versions: Scripting JSP 2.0.2
Reporter: Michael Marth

 (This is observed in revision 670551)
 consider a jsp /apps/myapp/a.jsp which contains:
 aaa
 % sling.include(currentNode.getPath() + .b.html); %
 and another jsp /apps/myapp/b.jsp which contains
 bbb
 if i execute /content/myapp/mynode.a.html i get
 bbb
 aaa
 expected result is:
 aaa
 bbb

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (SLING-572) example application

2008-07-28 Thread Michael Marth (JIRA)

 [ 
https://issues.apache.org/jira/browse/SLING-572?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Marth updated SLING-572:


Attachment: notes.xml

the content in sys view format with appropriate rights (granted for inclusion)

 example application
 ---

 Key: SLING-572
 URL: https://issues.apache.org/jira/browse/SLING-572
 Project: Sling
  Issue Type: Improvement
  Components: Documentation
Reporter: Michael Marth
Priority: Minor
 Attachments: notes-sample.patch, notes.xml, notes.xml, notes.zip


 As discussed with Bertrand I have written a Sling example app and suggest to 
 put it into svn so others can benefit. Attached is the code (to be put into 
 /apps/notes) and initial content in sysview format.
 The code has room for improvement (see bottom of blog post 
 http://dev.day.com/microsling/content/blogs/main/anothersampleapp.html)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



Re: How can i add 3rd party OSGi modules to sling.

2008-07-28 Thread Michael Marth
Hi Janandith,

here's a tutorial on deploying OSGi bundles in Sling:

http://dev.day.com/microsling/content/blogs/main/slingosgi.html
http://dev.day.com/microsling/content/blogs/main/slingosgimaven.html

Cheers
Michael

On Wed, Jul 16, 2008 at 5:33 AM, janandith jayawardena
[EMAIL PROTECTED]wrote:

 Hi ,

 how are the current 3rd party libraries accessed in sling. are they all in
 one bundle. ex: javax.jcr , jackrabbit etc.

 janandith.

 On Tue, Jul 15, 2008 at 10:29 PM, David Trott [EMAIL PROTECTED]
 wrote:

  Hi Janandith,
 
  I am still learning sling myself, but
 
 
  Take a look at the jsp-taglib package (sling/scripting/jsp-taglib)
  It makes a nice template to follow for creating (and packaging) your own
  tag
  libs because there are only 5 active files:
 
  ./pom.xml
 
 ./src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTag.java
 
 ./src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTEI.java
 
 
 ./src/main/java/org/apache/sling/scripting/jsp/taglib/IncludeTagHandler.java
  ./src/main/resources/META-INF/taglib.tld
 
  Hence if you are using JSP you can expose any custom code as a tag.
 
  You can simply upload your new package via the sling web console and it
  will
  appear in the list.
  Finally the tld file will also be resolved based on the uri you declare
  inside it.
 
  David
 
 
 
 
  On Tue, Jul 15, 2008 at 9:43 AM, janandith jayawardena 
  [EMAIL PROTECTED]
  wrote:
 
   Hi ,
  
   Is it possible to add pre compiled 3rd party OSGi bundles without doing
  any
   modification to sling.
   Can I directly load them and see it in the sling/console.
  
   janandith.
  
 




-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/


Re: [RT] Post processing of POSTs

2008-07-22 Thread Michael Marth
Carsten,
in your proposal how would available processors be discovered? Would they
explicitly register or be discovered by OSGi mechanisms? I also wonder if
the functionality would be available from scripts?
thanks for explaining
Michael

On Mon, Jul 21, 2008 at 8:07 PM, Alexander Klimetschek [EMAIL PROTECTED]
wrote:

 On Mon, Jul 21, 2008 at 6:00 PM, Carsten Ziegeler [EMAIL PROTECTED]
 wrote:
  Rethinking this :) I could imagine that a post processor befor the save
 but
  after the changes have been applied makes more sense.

 Good idea! This gives the chance for post processors to review a
 bunch of changes before they are actually applied.

  We could add hooks for doing something after the save, but I'm not sure
 if
  we really need them atm.

 JCR observation that can already be used here.

 Regards,
 Alex

 --
 Alexander Klimetschek
 [EMAIL PROTECTED]




-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/


Lars Trieloff's Cheat Sheet for Sling

2008-07-22 Thread Michael Marth
Hi,
I thought this might be of interest for the list: Lars Trieloff has compiled
a very handy cheat sheet for Sling users[1].
Cheers
Michael

[1] http://dev.day.com/microsling/content/blogs/main/cheatsheet.html

-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/


Re: [RT] Post processing of POSTs

2008-07-22 Thread Michael Marth
Hi Carsten,

sorry, I was not very specific about scripting, indeed.
IIUC one needs to supply an OSGi bundle in order to be able to tweak the
POST behavior. What I would like to do is adjust the POST behavior without
having to resort to deploying an OSGi bundle i.e. directly from a JSP. For
example, if one could write a POST.jsp that executes the default behavior
and passes back the change list (additionally to the mechanism proposed by
you):
%
changes = Sling.defaultPOSTBehaviour();
// do some more
%
(this code is an illustration of what I mean rather than an actual
suggestion)
The use cases in the back of my mind are a) adding mixins to newly created
nodes and b) comment spam prevention on a blog.

Cheers
Michael


On Tue, Jul 22, 2008 at 11:12 AM, Carsten Ziegeler [EMAIL PROTECTED]
wrote:

 Michael Marth wrote:

 Carsten,
 in your proposal how would available processors be discovered? Would they
 explicitly register or be discovered by OSGi mechanisms? I also wonder if
 the functionality would be available from scripts?
 thanks for explaining


 The processors are OSGi services that use the osgi service registry, so the
 post servlet would fetch all registered processors and apply them.

 This scripting stuff is mentioned all the time here :) Can you elaborate
 how you would like to use these processors from scripting? Btw, you can get
 all registered processors in a script through the sling object.

 Carsten

 --
 Carsten Ziegeler
 [EMAIL PROTECTED]




-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/


[jira] Commented: (SLING-572) example application

2008-07-21 Thread Michael Marth (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-572?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12615199#action_12615199
 ] 

Michael Marth commented on SLING-572:
-

it occurred to me that I should point out:
the sample app contains a CSS file that I took from here: 
http://www.bluerobot.com/web/layouts/.

Re the license it says:

Please feel free to borrow, steal, abduct, and/or torture the documents 
contained in the Layout Reservoir. Though you need not give credit to 
BlueRobot.com, a comment in your source code would help other developers to 
find this resource.


Naturally, I left the license in the css file, but I just wanted to make sure 
that this is OK for ASF. If not, the css could be removed, of course.

 example application
 ---

 Key: SLING-572
 URL: https://issues.apache.org/jira/browse/SLING-572
 Project: Sling
  Issue Type: Improvement
  Components: Documentation
Reporter: Michael Marth
Priority: Minor
 Attachments: notes-sample.patch, notes.xml, notes.zip


 As discussed with Bertrand I have written a Sling example app and suggest to 
 put it into svn so others can benefit. Attached is the code (to be put into 
 /apps/notes) and initial content in sysview format.
 The code has room for improvement (see bottom of blog post 
 http://dev.day.com/microsling/content/blogs/main/anothersampleapp.html)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Created: (SLING-575) include fully qualified urls in json repsonses from search

2008-07-17 Thread Michael Marth (JIRA)
include fully qualified urls in json repsonses from search
--

 Key: SLING-575
 URL: https://issues.apache.org/jira/browse/SLING-575
 Project: Sling
  Issue Type: Improvement
Reporter: Michael Marth
Priority: Minor


related to https://issues.apache.org/jira/browse/SLING-574 and 
https://issues.apache.org/jira/browse/SLING-573:

the fully qualified urls should also be included in the json rendering of 
search results (which are not nodes, thus the new issue)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (SLING-572) example application

2008-07-16 Thread Michael Marth (JIRA)

 [ 
https://issues.apache.org/jira/browse/SLING-572?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Marth updated SLING-572:


Attachment: notes.zip

app code

 example application
 ---

 Key: SLING-572
 URL: https://issues.apache.org/jira/browse/SLING-572
 Project: Sling
  Issue Type: Improvement
  Components: Documentation
Reporter: Michael Marth
Priority: Minor
 Attachments: notes.zip


 As discussed with Bertrand I have written a Sling example app and suggest to 
 put it into svn so others can benefit. Attached is the code (to be put into 
 /apps/notes) and initial content in sysview format.
 The code has room for improvement (see bottom of blog post 
 http://dev.day.com/microsling/content/blogs/main/anothersampleapp.html)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (SLING-572) example application

2008-07-16 Thread Michael Marth (JIRA)

 [ 
https://issues.apache.org/jira/browse/SLING-572?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Marth updated SLING-572:


Attachment: notes.xml

sample content in sysview.xml format. i suggest the actual content should be 
changed - it is Day marketing material.

 example application
 ---

 Key: SLING-572
 URL: https://issues.apache.org/jira/browse/SLING-572
 Project: Sling
  Issue Type: Improvement
  Components: Documentation
Reporter: Michael Marth
Priority: Minor
 Attachments: notes.xml, notes.zip


 As discussed with Bertrand I have written a Sling example app and suggest to 
 put it into svn so others can benefit. Attached is the code (to be put into 
 /apps/notes) and initial content in sysview format.
 The code has room for improvement (see bottom of blog post 
 http://dev.day.com/microsling/content/blogs/main/anothersampleapp.html)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



Re: [RT] Post processing of POSTs

2008-07-09 Thread Michael Marth
hi,

i like bertrand's proposal to make available the post servlet's methods in
scripts. that way we would not need to add additional script name resolution
logic.  script authors could do whatever they want , but would not have to
reimplement existing functionality.

i also have 2 use cases for this at hand: a) adding mixins to newly created
nodes and b) creating new node versions (in the jcr sense) when changing
existing nodes. (of course, both cases could be handled by adding additional
params to the post servlet, but there will always be more examples for
custom requirements)

michael

On Fri, Jul 4, 2008 at 1:06 PM, Carsten Ziegeler [EMAIL PROTECTED]
wrote:

 Felix Meschberger wrote:

 In addition, if we add post-processing, we should probably also add
 pre-processing for symmetry, right ? But how ?

  Yes, I agree, pre processing makes sense as well. In order to have a
 meaningfull pre and post processing, both phases should get a list of
 changes that are intended to be done (pre) and are done (post). While the
 pre processing can modify this list of changes, the post processing can only
 do additional things.


 I don't think that the list of actions is known upfront. Because this list
 is built as the actions re executed. (Right now).

 Yes, I know - but I think it could be possible to first generate the list
 of changes and then apply them.


 So preprocessing would probably mainly mean looking at the request
 parameters and fiddle around with them before they are handed over to the
 actual processing. Hmm, this sounds like validation, we once were
 discussing (but dismissing).

 :) Yes validation is one of the use cases here :)


 Carsten
 --
 Carsten Ziegeler
 [EMAIL PROTECTED]




-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/


[jira] Created: (SLING-567) sling.include inclides fragments in the wrong order

2008-07-07 Thread Michael Marth (JIRA)
sling.include inclides fragments in the wrong order
---

 Key: SLING-567
 URL: https://issues.apache.org/jira/browse/SLING-567
 Project: Sling
  Issue Type: Bug
Affects Versions: Scripting JSP 2.0.2
Reporter: Michael Marth


(This is observed in revision 670551)

consider a jsp /apps/myapp/a.jsp which contains:

aaa
% sling.include(currentNode.getPath() + .b.html); %

and another jsp /apps/myapp/b.jsp which contains

bbb


if i execute /content/myapp/mynode.a.html i get

bbb
aaa

expected result is:

aaa
bbb

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (SLING-567) sling.include inclides fragments in the wrong order

2008-07-07 Thread Michael Marth (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12611163#action_12611163
 ] 

Michael Marth commented on SLING-567:
-

Tobi's suggested workaround with sling:include ... works OK.

Tobi also suggested:

%
out.flush();
sling.include(currentNode.getPath() + .b.html);
% 

that helps as well

 sling.include inclides fragments in the wrong order
 ---

 Key: SLING-567
 URL: https://issues.apache.org/jira/browse/SLING-567
 Project: Sling
  Issue Type: Bug
Affects Versions: Scripting JSP 2.0.2
Reporter: Michael Marth

 (This is observed in revision 670551)
 consider a jsp /apps/myapp/a.jsp which contains:
 aaa
 % sling.include(currentNode.getPath() + .b.html); %
 and another jsp /apps/myapp/b.jsp which contains
 bbb
 if i execute /content/myapp/mynode.a.html i get
 bbb
 aaa
 expected result is:
 aaa
 bbb

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



Re: Standard Sling Project Template

2008-07-02 Thread Michael Marth
Hi,

not sure if that is really needed for web development in Sling because
unlike in other frameworks one does not need an awful lot of files to get
started. One thing that might make sense though is to take the example app
delivered with CRX Quickstart[1] as a template for CRUD apps (CRX Quickstart
is a repository bundled with Sling).
When it comes to OSGi-based extensions of Sling a template might be quite
useful. I did a blog post[2] on a HelloWorld OSGi bundle for Sling. Maybe
that could be made into a template.

Cheers
Michael

[1] http://dev.day.com/microsling/content/blogs/cup/downloads.c.html
[2] http://dev.day.com/microsling/content/blogs/main/slingosgimaven.html

On Wed, Jul 2, 2008 at 6:18 AM, paksegu [EMAIL PROTECTED] wrote:

 It will be nice if sling has like a standard project template or a blank
 starter kit that can be used as a project template simlar to most modern web
 applaction framework, in effort to satandardise that effort, can someone
 point me a similar project template if exist to serve as a guide, an example
 will be a maven project template or may be ide specifc template such as
 shown in this example.
 http://platform.netbeans.org/tutorials/60/nbm-filetemplates.html

 am I making any sense here? Thanks







-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/


Re: difference between sling micro sling

2008-05-13 Thread Michael Marth
Janandith,

microsling used to be a scaled-down version of Sling, but it is deprecated
now. There is only Sling now.

Michael

On Sun, May 11, 2008 at 8:06 PM, paksegu [EMAIL PROTECTED] wrote:

 take the15min tutorial on Luanchpad to get a notion of sling, it include
 embeded reporsitory and web server

 janandith jayawardena [EMAIL PROTECTED] wrote:  Hi ,

 What is the difference between sling and microsling. Is microsling a
 scaled
 down version of sling ?.

 regards ,
 Janandith.



 Ransford Segu-Baffoe

 [EMAIL PROTECTED]

 https://serenade.dev.java.net/
 http://www.noqturnalmediasystems.com/

 -
 Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it
 now.




-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/


[jira] Commented: (SLING-393) default renderer for .xml

2008-04-25 Thread Michael Marth (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12592360#action_12592360
 ] 

Michael Marth commented on SLING-393:
-

I imagine it to be more like a document view (much like the json renderer).

Not sure, what you mean with round-tripping, but if you refer to the 
export-import functionality of JCR system view: that would not be important to 
me.

However, one thing that might be neat: being able to POST an xml document and  
have it converted to a node (the format would be the same for GET and POST, of 
course). I cannot judge if that clashes with other parts of the architecture, 
though. If it does: let's just do the renderer :)

 default renderer for .xml
 -

 Key: SLING-393
 URL: https://issues.apache.org/jira/browse/SLING-393
 Project: Sling
  Issue Type: Improvement
Reporter: Michael Marth
Priority: Minor

 I would like to suggest a default renderer for .xml requests, similar to the 
 .json renderer that exists already. This would allow zero-config remote 
 access for clients that do not understand json, e.g. desktop apps.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (SLING-386) rules for creating node names should be uniform

2008-04-18 Thread Michael Marth (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12590341#action_12590341
 ] 

Michael Marth commented on SLING-386:
-

I have two examples:

xyz = john.doe
xyz_conversation1 = john_doe
xyz_conversation2 = john


xyz = John_Doe
xyz_conversation1 = john_doe
xyz_conversation2 = John_Doe

I have a workaround for this problem. It is logged as an improvement.

 rules for creating node names should be uniform
 ---

 Key: SLING-386
 URL: https://issues.apache.org/jira/browse/SLING-386
 Project: Sling
  Issue Type: Improvement
Reporter: Michael Marth

 I have an issue when nodes are created through a form post: consider that I 
 have a weird string xyz that is not fit as a JCR node name, e.g. because it 
 contains umlauts or slashes or so.
 If I do a post to /content/mynode/*
 and give this parameter
 name=xyz
 this is used as a name hint and xyz is converted something sane (let's call 
 it xyy_conversion1)
 In the next step I want  to post to /content/mynode/xyz/*
 in order to create a child node of xyz
 It seems that in these two cases xyz is converted differently. Thus, in my 
 example above the second post would not create a child node of the first one, 
 but rather something like:
 -content
   |-mynode
 |- xyy_conversion1
 |- xyz_conversion_2
|- node_from_second_post
 the conversation algorithms should be the same in both cases

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



Re: Simplifying script paths and names?

2008-04-17 Thread Michael Marth
+1

having 10 html.esp tabs open is quite a pain


On Thu, Apr 17, 2008 at 10:48 AM, Alexander Klimetschek
[EMAIL PROTECTED] wrote:

  1) Most scripts, being GET scripts for html content in a typical app,
  are named html.esp (or html.whatever depending on the language). That
  can be confusing when editing them, and lead to errors, developer
  usability suffers.
 

  +1

  I have not much experience with Sling and html.esp in particular, but I
 know this problem from Cocoon's sitemap.xmap across various modules (later
 renamed them, which was luckily possible, but you don't think about that in
 the beginning...).

  And sometimes the tools make it even more difficult: Eclipse = 3.2 on Mac
 for example, displaying only standard sitemap.xmap in the tabs, had *no
 way* of determing the full name of the currently viewed file - not in the
 application title, not via a tooltip, nowhere - you could only press sync in
 the typically huge package explorer tree, which is the exact opposite of
 fast switching between files...

  The it's too late argument should be turned around: if you won't do it
 now, you'll never do it!



  Alex

  --
  Alexander Klimetschek
  [EMAIL PROTECTED]

   Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/ 








-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/


[jira] Created: (SLING-386) rules for creating node names should be uniform

2008-04-17 Thread Michael Marth (JIRA)
rules for creating node names should be uniform
---

 Key: SLING-386
 URL: https://issues.apache.org/jira/browse/SLING-386
 Project: Sling
  Issue Type: Improvement
Reporter: Michael Marth


I have an issue when nodes are created through a form post: consider that I 
have a weird string xyz that is not fit as a JCR node name, e.g. because it 
contains umlauts or slashes or so.

If I do a post to /content/mynode/*
and give this parameter
name=xyz
this is used as a name hint and xyz is converted something sane (let's call it 
xyy_conversion1)

In the next step I want  to post to /content/mynode/xyz/*
in order to create a child node of xyz

It seems that in these two cases xyz is converted differently. Thus, in my 
example above the second post would not create a child node of the first one, 
but rather something like:

-content
  |-mynode
|- xyy_conversion1
|- xyz_conversion_2
   |- node_from_second_post

the conversation algorithms should be the same in both cases

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



comment on addressing the binary property jcr:data of an nt:file

2008-02-28 Thread Michael Marth
Hi,

I am fiddling around with nt:file and Sling and came across something which
seems to be a bit inconsistent or maybe a bug.
In the browser I can access the (binary) jcr:data property of an nt:file
directly, like:
http://myserver/path_to_ntfile/content/jcr%3acontent
This returns the content of the file.

But if I try to include the file contents through sling.include I get a
resource not found in the log ( o.a.s.j.r.i.JcrResourceResolver: Could not
resolve URL xxx to a Resource). That's OK, because it is not a node, but a
property. However, I can access it in the browser, so it struck me as a bit
inconsistent.

Related to this: a while ago we had a discussion if there is a use case for
addressing properties in urls (rather than just nodes). I think at that time
there was no use case found. Well, addressing jcr:data is a use case for me
at least.

(if this behaviour is really a bug let me know, I'll file it)

Cheers
Michael

-- 
Michael Marth, http://dev.day.com


Re: comment on addressing the binary property jcr:data of an nt:file

2008-02-28 Thread Michael Marth
it's an email, so the content is plain text
Michael

On 2/28/08, Bertrand Delacretaz [EMAIL PROTECTED] wrote:

 On Thu, Feb 28, 2008 at 12:02 PM, Michael Marth [EMAIL PROTECTED] wrote:

  ...if I try to include the file contents through sling.include I get a

   resource not found in the log ( o.a.s.j.r.i.JcrResourceResolver:
 Could not
   resolve URL xxx to a Resource). That's OK, because it is not a node,
 but a
   property. However, I can access it in the browser, so it struck me as a
 bit

   inconsistent

 Not sure why you'd want include a (binary I assume) file with
 sling.include?

 That's mean for including markup, not binary data.


 -Bertrand




-- 
Michael Marth, http://dev.day.com


Re: comment on addressing the binary property jcr:data of an nt:file

2008-02-28 Thread Michael Marth
Hi Felix,


 I am not sure, whether I can help you, because you just say, you try to
 include ... through sling.include without telling which path you use to
 include.

 This should of course work, except if you mangle with the path. So if
 you use /path_to_ntfile/content/jcr%3acontent as the resource path it
 is expected to get an error. You would actually have to included
 path_to_ntfile/content/jcr:content


You are right. I had unescaped the colon, but there was actually another
url-escaped character in the path. Thanks (and sorry)



Michael


-- 
Michael Marth, http://dev.day.com


[jira] Commented: (SLING-282) missing node functions in node wrapper

2008-02-27 Thread Michael Marth (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12572949#action_12572949
 ] 

Michael Marth commented on SLING-282:
-

I am not sure if (or how much of) currentNode is implemented in the version I 
work with, but:

currentNode.getName() works whereas 
currentNode.getNodes() gives TypeError: getNodes is not a function
(and same for getProperty())

 missing node functions in node wrapper
 --

 Key: SLING-282
 URL: https://issues.apache.org/jira/browse/SLING-282
 Project: Sling
  Issue Type: Bug
  Components: Launchpad
Reporter: Michael Marth
Assignee: Bertrand Delacretaz

 (this is on Launchpad revision 629151 running on top of crx)
 got an esp template that looks like:
 h1%= resource.node %: %= resource.node.getName() %/h1
 
 %
var child = resource.node.getNode(2008-02)
if (child.getProperty(sling:resourceType) == emailListMonth) {
   %yay%
   }
 %
 .getName() and .getNode(...) works OK, but .getProperty throws an exception:
 TypeError: getProperty is not a function
 same for .getNodes()

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (SLING-282) missing node functions in node wrapper

2008-02-27 Thread Michael Marth (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12572958#action_12572958
 ] 

Michael Marth commented on SLING-282:
-

this might be related (regarding collections handling):

the property to is multivalued.

in the script I do something like:
 %= currentNode[to][0] %

if the value of to has only one value I seem to get back this value as one 
string so [0] gives me the first character. if to has 2 values I get back a 
collection so [0] gives me the first element. this is consistent with what 
[to].length gives me.

I am not 100% sure if this is a bug (might be my lack of understanding for 
javascript), if so a comment on how to determine the result length of a 
multi-valued property would be appreciated.

 missing node functions in node wrapper
 --

 Key: SLING-282
 URL: https://issues.apache.org/jira/browse/SLING-282
 Project: Sling
  Issue Type: Bug
  Components: Launchpad
Reporter: Michael Marth
Assignee: Bertrand Delacretaz

 (this is on Launchpad revision 629151 running on top of crx)
 got an esp template that looks like:
 h1%= resource.node %: %= resource.node.getName() %/h1
 
 %
var child = resource.node.getNode(2008-02)
if (child.getProperty(sling:resourceType) == emailListMonth) {
   %yay%
   }
 %
 .getName() and .getNode(...) works OK, but .getProperty throws an exception:
 TypeError: getProperty is not a function
 same for .getNodes()

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



Re: various questions regarding alternative scripting engines

2008-02-15 Thread Michael Marth
Hi Felix,


  But if I try to access something like $resource.node (which I would have
  expected) Velocity does not recognize the expression. How do I get to
 the
  node? Do I have the wrong syntax? I looked at the src of JcrNodeResource
 and
  expected to be able to use something like .node, .getNode() or similar.


 I do not exactly know, how velocity maps Java objects. But a resource is
 definitely a Resource and by conincidence a JcrNodeResource. In
 addition, the JcrNodeResource.getNode() method is not public and not
 part of the API.

 When you want to access the node of a resource you will have to adapt
 the Resource to the Node class, something like:

  $resource.adaptTo(Node.class);

 But I am not exactly sure about the exact syntax.


I am not exactly a velocity expert, but I tried this and had no success so
far. But I also think that having to cast (sort of) a resource into a node
in a script is a bit weird. Especially, if you consider that
resource.nodeworks in esp's. Could we not just get the node as an
object right away?

I am aware that this has been discussed before, but I do not see any
advantages of abstraction lost if the node object is available to the
scripts if the resource in question is actually a node. The script needs to
know it handles nodes anyway.

WDYT?
Michael


help, my content model looks un-Slingable

2008-02-15 Thread Michael Marth
Hi,

I have an existing content model and want to build a sling app on top. The
model is Jukka Zitting's mail model he coded for James (see [1]). One mail
is stored as:

nt:file
|-jcr:content (unstructured)
  |- from (string)
  |- to (string)
  |- jcr:data (binary)
...

In order to display a mail via Sling I added a property sling:resourceType
to the jcr:content sub node (because I could not add it to nt:file). My URL
now looks something like:

http://localhost:/content/.../emailtitle/jcr:content
or
http://localhost:/content/.../emailtitle

but in both cases the binary jcr:data is returned directly.

Do I have to change my content model or do you guys see a way that I can
access my mail resources and have a script being executed?

Thanks for hints
Cheers
Michael


[1] http://dev.day.com/microsling/content/blogs/main/jcrmail.html

-- 
Michael Marth, http://dev.day.com


Re: help, my content model looks un-Slingable

2008-02-15 Thread Michael Marth
Hi Felix,

thanks a lot - I'll give it a try.

Maybe it would be helpful if we had some additional script resolution based
on URLs or paths. In my example I could map a script to nt:resource if the
resource is below /content/mails or so. Such a mechanism could really be
helpful for users that have no possibility to modify existing content.

Cheers
Michael

On 2/15/08, Felix Meschberger [EMAIL PROTECTED] wrote:

 Hi Michael,

 I just updated the jcr/resource module to create a sling:Resource mixin
 node type, which defines a sling:resourceType property as a String. You
 may attach this mixin node type to your mail node and set resource type
 accordingly. This gives you the full flexibility to render your mail
 specifically.

 Alternatively, of course, you may create a servlet or script for the
 nt:file resource type. But this has the advantage that all nt:file nodes
 regardless of whether they are actually mail or not will be rendered by
 that servlet or script. The first option is probably better.

 Regards
 Felix

 Am Freitag, den 15.02.2008, 11:52 +0100 schrieb Michael Marth:

  Hi,
 
  I have an existing content model and want to build a sling app on top.
 The
  model is Jukka Zitting's mail model he coded for James (see [1]). One
 mail
  is stored as:
 
  nt:file
  |-jcr:content (unstructured)
|- from (string)
|- to (string)
|- jcr:data (binary)
  ...
 
  In order to display a mail via Sling I added a property
 sling:resourceType
  to the jcr:content sub node (because I could not add it to nt:file). My
 URL
  now looks something like:
 
  http://localhost:/content/.../emailtitle/jcr:content
  or
  http://localhost:/content/.../emailtitle
 
  but in both cases the binary jcr:data is returned directly.
 
  Do I have to change my content model or do you guys see a way that I can
  access my mail resources and have a script being executed?
 
  Thanks for hints
  Cheers
  Michael
 
 
  [1] http://dev.day.com/microsling/content/blogs/main/jcrmail.html
 




-- 
Michael Marth, http://dev.day.com


Re: various questions regarding alternative scripting engines

2008-02-15 Thread Michael Marth
Hi Felix,

when I use
var node = resource.adaptTo(Packages.javax.jcr.Node)
I get an exception
Cannot find function adaptTo.
(I guess this is a temporary problem. Or does it work for you?)



 Which is probably an error as it introduces an API in JavaScript which
 is not paralelled by the other APIs, we should probably remove that 



Rather than removing the very useful resource.node from esps for consistency
reasons I would kindly ask to introduce resource.node into other scripting
engines as well (would be consistent again :) ).

I believe that this can be done by injecting a node object within the
scripting engine implementation so that the Resource interface does not have
to be changed again.

I think that this would be really helpful for Sling adoption because it
would make things easier for newbies.

Cheers
Michael

-- 
Michael Marth, http://dev.day.com


Re: Sling Site, aka Documentation

2008-02-14 Thread Michael Marth
Hi Felix,

maybe you have mentally included these topics somewhere, but what comes to
my mind:
- setting up a dev environment
- debugging Sling applications

Michael

On 2/13/08, Felix Meschberger [EMAIL PROTECTED] wrote:

 Hi all,

 We have a long standing issue around our documentation which is sort-of
 messy and to a big extent outdated and mostly incomplete. I have been
 thinking about this an propose a rigorous reorganization of our site
 along these general lines:


   * Home Page - general introduction to Sling and its goals in terms of
 JCR, OSGi, etc.
  * Documentation - descriptive documentation style of major
 constituents
* First Steps - from Betrand's 15 minutes to Sling entry
* JCR - How Sling uses and integrates with JCR (embedded,
 remote, Session pooling)
* Resources - Extended from current Guides/Resources
* Servlets  Scripts - Extended from current Guides/Servlet
 Resolution
* Request Processing - Merge existing Request Processing and
 Guides/Request Parmeters
* Filters - What about request filtering (new)
* Eventing  Jobs
  * Advanced Topics - if you want to know more and dig deeper
* Sling API - complete description of the API
* Architecture
* Logging in general and Request logging
* Initial Provisioning and Startup
* Configuration
* JCR Content loading and Node Type Management
* Object Content Mapping support (OCM)
* Dispatching Requests
* Installing and Updating Bundles
* Implementing a ResourceProvider (new)
* Using ScriptEngines from scripting.dev.java.net (new)
  * Development
* Getting and buidling Sling
* JCR-based: WebDAV, JCR plugin for Eclipse, Bunkai (?)
* Bundles - How to create bundles and provide services and
 scripts
* Maven Sling Plugin
* Maven JspC Plugin
  * Links
  * Wiki - links to SLING wiki
  * FAQ  - links to FAQ on SLING wiki
  * Project
* Project Team
* Roles and Processes
* License

 Most of this documentation already exists but is outdated. Some of this
 needs to be created (mostly marked with new).

 I will start to reorganize the source of our site in the SLINGxWIKI and
 disable the synchronization with the real site for now. As soon as the
 main page reorganization is done, I will reenable the site
 synchronization to get the site updated again.

 Feedback as always welcome and nothing is cast in stone ;-)

 Regards

 Felix




-- 
Michael Marth, http://dev.day.com


various questions regarding alternative scripting engines

2008-02-14 Thread Michael Marth
Hi,

I am just looking at the various scripting engines and ran into some probs.
Maybe someone can help?

Velocity
---
I have installed the velocity bundle and want to do the first test in
Bertrand's 15min tutorial with a velocity script. Saving this as
html.vltworks OK:
html
body
$resource.getResourceType() br
$resource.getPath()
/body
/html
I get something like:
foo/bar
/content/mynode

But if I try to access something like $resource.node (which I would have
expected) Velocity does not recognize the expression. How do I get to the
node? Do I have the wrong syntax? I looked at the src of JcrNodeResource and
expected to be able to use something like .node, .getNode() or similar.

Freemarker

Almost the same as velocity. If I save this as html.ftl
htmlbody
${resource.resourceType} br
${resource.path}
/body/html

This works, but this

htmlbody
${resource.node}
/body/html

Gives an exception: Expression resource.node is undefined on line 3, column
3 in /apps/foo/bar/html.ftl. The problematic instruction: -- == ${
resource.node} [on line 3, column 1 in /apps/foo/bar/html.ftl] --
Java backtrace for programmers: --
freemarker.core.InvalidReferenceException: Expression resource.node is
undefined on line 3, column 3 in /apps/foo/bar/html.ftl

Ruby
---
Saving anything as html.erb gives me an exception when I do a request like
above. I installed the scripting bundle just like for velocity and
freemarker. The console says things are fine. The exception is:

org/jruby/runtime/callback/InvocationCallback (500)
The requested URL /content/mynode.html resulted in an error in Sling Default
Error Handler Servlet.
Exception:
java.lang.NoClassDefFoundError:
org/jruby/runtime/callback/InvocationCallback

Is there additional installation work to be done for Ruby?


Thanks a lot for hints
Michael

-- 
Michael Marth, http://dev.day.com


Re: Discover Sling in 15 minutes

2008-02-01 Thread Michael Marth
: 0, Skipped: 0, Time elapsed: 0.032 sec
 FA
ILURE!
Running org.apache.sling.launchpad.webapp.integrationtest.ValueFromTest
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Tests run: 3, Failures: 3, Errors: 0, Skipped: 0, Time elapsed: 0.047 sec
 FA
ILURE!
Running
org.apache.sling.launchpad.webapp.integrationtest.GeneratedNodeNameTest
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Tests run: 4, Failures: 4, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
 FA
ILURE!
Running org.apache.sling.launchpad.webapp.integrationtest.PostRedirectTest
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Tests run: 4, Failures: 4, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
 FA
ILURE!
Running
org.apache.sling.launchpad.webapp.integrationtest.ScriptBuiltinObjectsTe
st
Checking if the required Sling services are started...
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0 sec 
FAILUR
E!
Running
org.apache.sling.launchpad.webapp.integrationtest.ujax.UjaxSessionInfoTe
st
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.062 sec
 FA
ILURE!
Running
org.apache.sling.launchpad.webapp.integrationtest.SyntheticResourceTest
Checking if the required Sling services are started...
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0 sec 
FAILUR
E!
Running org.apache.sling.launchpad.webapp.integrationtest.HttpPingTest
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.125 sec
 FA
ILURE!
Running org.apache.sling.launchpad.webapp.integrationtest.FileUploadTest
Checking if the required Sling services are started...
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
 FA
ILURE!
Running org.apache.sling.launchpad.webapp.integrationtest.CreateNodeTest
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.078 sec
 FA
ILURE!
Running
org.apache.sling.launchpad.webapp.integrationtest.ujax.UjaxDefaultValues
Test
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Tests run: 4, Failures: 4, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
 FA
ILURE!
Running org.apache.sling.launchpad.webapp.integrationtest.StaticContentTest
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
 FA
ILURE!
Running org.apache.sling.launchpad.webapp.integrationtest.StreamServletTest
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Tests run: 4, Failures: 4, Errors: 0, Skipped: 0, Time elapsed: 0 sec 
FAILUR
E!
Running
org.apache.sling.launchpad.webapp.integrationtest.ujax.PostServletUpdate
Test
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Checking if the required Sling services are started...
Tests run: 4, Failures: 4, Errors: 0, Skipped: 0, Time elapsed: 0.141 sec
 FA
ILURE!

On 2/1/08, Carsten Ziegeler [EMAIL PROTECTED] wrote:

 Just update from svn and try again :) It works now...

 Carsten

 Michael Marth wrote:
  Guys,
 
  just tried to do the 15 minutes tutorial, but I get a compilation error
 (mvn
  clean install) - see below. I use
  C:\dev\launchpadmvn -version
  Maven version: 2.0.7
  Java version: 1.5.0_13
 
  Does anybody have an idea? The error looks strange to me. Also tried to
  delete my mvn repo, but no success either.
 
  thanks for pointers
  Cheers
  Michael
 
 
 
  [INFO]
 
 -
  ---
  [INFO] Building Sling - ScriptResolver implementation
  [INFO]task-segment: [clean, install]
  [INFO]
 
 -
  ---
  [INFO] [clean:clean]
  [INFO] Deleting directory C:\dev\launchpad\scripting\resolver\target
  [INFO] [enforcer:enforce {execution: enforce-java}]
  [INFO

Re: Discover Sling in 15 minutes

2008-02-01 Thread Michael Marth
Guys,

just tried to do the 15 minutes tutorial, but I get a compilation error (mvn
clean install) - see below. I use
C:\dev\launchpadmvn -version
Maven version: 2.0.7
Java version: 1.5.0_13

Does anybody have an idea? The error looks strange to me. Also tried to
delete my mvn repo, but no success either.

thanks for pointers
Cheers
Michael



[INFO]
-
---
[INFO] Building Sling - ScriptResolver implementation
[INFO]task-segment: [clean, install]
[INFO]
-
---
[INFO] [clean:clean]
[INFO] Deleting directory C:\dev\launchpad\scripting\resolver\target
[INFO] [enforcer:enforce {execution: enforce-java}]
[INFO] [dependency:copy {execution: get-bsf3-api}]
[INFO] Configured Artifact: org.apache.bsf:bsf-api:3.0-beta2:jar
[INFO] Copying bsf-api-3.0-beta2.jar to
C:\dev\launchpad\scripting\resolver\targ
et\dependency\bsf-api.jar
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Compiling 8 source files to
C:\dev\launchpad\scripting\resolver\target\cl
asses
[INFO]

[ERROR] BUILD FAILURE
[INFO]

[INFO] Compilation failure

C:\dev\launchpad\scripting\resolver\src\main\java\org\apache\sling\scripting\res
olver\impl\DefaultSlingScript.java:[76,22] type java.util.Dictionary does
not ta
ke parameters

C:\dev\launchpad\scripting\resolver\src\main\java\org\apache\sling\scripting\res
olver\impl\DefaultSlingScript.java:[192,22] type java.util.Enumeration does
not
take parameters

C:\dev\launchpad\scripting\resolver\src\main\java\org\apache\sling\scripting\res
olver\impl\helper\OnDemandReader.java:[23,16] package java.nio does not
exist

C:\dev\launchpad\scripting\resolver\src\main\java\org\apache\sling\scripting\res
olver\impl\helper\OnDemandReader.java:[70,20] cannot find symbol
symbol  : class CharBuffer
location: class
org.apache.sling.scripting.resolver.impl.helper.OnDemandReader

C:\dev\launchpad\scripting\resolver\src\main\java\org\apache\sling\scripting\res
olver\impl\helper\OnDemandReader.java:[70,15] read(char[]) is already
defined in
 org.apache.sling.scripting.resolver.impl.helper.OnDemandReader

C:\dev\launchpad\scripting\resolver\src\main\java\org\apache\sling\scripting\res
olver\impl\SlingScriptAdapterFactory.java:[75,16] type java.util.List does
not t
ake parameters

C:\dev\launchpad\scripting\resolver\src\main\java\org\apache\sling\scripting\res
olver\impl\SlingScriptAdapterFactory.java:[77,16] type java.util.List does
not t
ake parameters

C:\dev\launchpad\scripting\resolver\src\main\java\org\apache\sling\scripting\res
olver\impl\SlingScriptAdapterFactory.java:[83,17] type java.lang.Class does
not
take parameters

C:\dev\launchpad\scripting\resolver\src\main\java\org\apache\sling\scripting\res
olver\impl\helper\OnDemandWriter.java:[44,5] cannot find symbol
symbol  : class Override
location: class
org.apache.sling.scripting.resolver.impl.helper.OnDemandWriter

C:\dev\launchpad\scripting\resolver\src\main\java\org\apache\sling\scripting\res
olver\impl\helper\OnDemandWriter.java:[51,5] cannot find symbol
symbol  : class Override
location: class
org.apache.sling.scripting.resolver.impl.helper.OnDemandWriter

On 1/29/08, Gert Vanthienen [EMAIL PROTECTED] wrote:

 Bernard,

 An 'svn up;mvn clean install' fixed the issue.

 Thank you for the fast reponse,

 Gert

 Bertrand Delacretaz wrote:
  On Jan 29, 2008 3:16 PM, Gert Vanthienen [EMAIL PROTECTED]
 wrote:
 
 
  ...I ran
  into a problem when executing the 'curl ...' command to add a first
 node
  of content:
 
  Method POST not supported (405)...
 
 
  When running this?
 
  curl -Fsling:resourceType=foo/bar -Ftitle=some title
  http://admin:[EMAIL PROTECTED]:8080/content/mynode
 
  As the Sling modules start asynchronously, what might happen is that
  they're not ready yet. But startup shouldn't take more than a few
  seconds on a decent system.
 
  If retrying doesn't help, have a look at the log created under
  launchpad-webapp/target/logs/error.log, and if any errors are
  reported. I've just added the info about that log file to the wiki
  page.
 
  -Bertrand
 
 




-- 
Michael Marth, http://dev.day.com


Re: Discover Sling in 15 minutes

2008-02-01 Thread Michael Marth
no joy either :(

Michael

Downloading:
http://repo1.maven.org/maven2/org/mortbay/jetty/mvn-jetty-plugin/6.
1.5/mvn-jetty-plugin-6.1.5.pom
Downloading:
http://repo.dev.day.com/central/org/mortbay/jetty/mvn-jetty-plugin/
6.1.5/mvn-jetty-plugin-6.1.5.pom
[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Failed to resolve artifact.

GroupId: org.mortbay.jetty
ArtifactId: mvn-jetty-plugin
Version: 6.1.5

Reason: Unable to download the artifact from any repository

  org.mortbay.jetty:mvn-jetty-plugin:pom:6.1.5

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)

On 2/1/08, Carsten Ziegeler [EMAIL PROTECTED] wrote:

 Hmm, that's strange, it seems mvn can't find the jetty plugin.
 You could try
 mvn org.mortbay.jetty:mvn-jetty-plugin:6.1.5:run instead

 Carsten

 Michael Marth wrote:
  Hi Carsten,
 
  thanks, but there's a different problem now (see below). I thought that
  maybe just the tests fail, but mvn jetty:run does not work either:
 
  [INFO] Searching repository for plugin with prefix: 'jetty'.
  [INFO] org.apache.maven.plugins: checking for updates from central
  [INFO] org.codehaus.mojo: checking for updates from central
  [INFO] artifact org.apache.maven.plugins:maven-jetty-plugin: checking
 for
  update
  s from central
  [INFO]
  
  [ERROR] BUILD ERROR
  [INFO]
  
  [INFO] The plugin 'org.apache.maven.plugins:maven-jetty-plugin' does not
  exist o
  r no valid version could be found
 
 
  Can I try anything else?
  Thanks a lot
  Michael
 
 
 
  2008-02-01 15:44:12.609::INFO:  Logging to STDERR via
  org.mortbay.log.StdErrLog
  2008-02-01 15:44:12.656::INFO:  jetty-6.1.1rc1
  2008-02-01 15:44:12.812::INFO:  Extract
  jar:file:/C:/dev/launchpad/launchpad/lau
  nchpad-webapp/target/org.apache.sling.launchpad.webapp-
  2.0.0-incubator-SNAPSHOT.
  war!/ to
  C:\DOCUME~1\mmarth\LOCALS~1\Temp\Jetty_0_0_0_0_8080_org.apache.sling.la
 
 unchpad.webapp-2.0.0-incubator-SNAPSHOT.war__org_apache_sling_launchpad_webapp-2
  _0_0-incubator-SNAPSHOT__ybspfb\webapp
  2008-02-01 15:44:
  21.921:/org.apache.sling.launchpad.webapp-2.0.0-incubator-SNAPS
  HOT:INFO:  sling: Servlet sling initialized
  2008-02-01 15:44:21.921::INFO:  Extract
  jar:file:/C:/dev/launchpad/launchpad/lau
  nchpad-webapp/target/jetty6x/cargocpc.war!/ to
  C:\DOCUME~1\mmarth\LOCALS~1\Temp\
  Jetty_0_0_0_0_8080_cargocpc.war__cargocpc__xflgf3\webapp
  2008-02-01 15:44:22.515::INFO:  Started SelectChannelConnector @
  0.0.0.0:8080
  [INFO] [beddedLocalContainer] Jetty 6.x Embedded started on port [8080]
  [INFO] [surefire:test {execution: surefire-integration-test}]
  [INFO] Surefire report directory:
  C:\dev\launchpad\launchpad\launchpad-webapp\ta
  rget\surefire-reports
 
  ---
   T E S T S
  ---
  Running
  org.apache.sling.launchpad.webapp.integrationtest.PropertyRenderingTest
  log4j:WARN No appenders could be found for logger (
  org.apache.commons.httpclient
  ..HttpClient).
  log4j:WARN Please initialize the log4j system properly.
  Checking if the required Sling services are started...
  Checking if the required Sling services are started...
  Checking if the required Sling services are started...
  Checking if the required Sling services are started...
  Checking if the required Sling services are started...
  Checking if the required Sling services are started...
  Tests run: 6, Failures: 6, Errors: 0, Skipped: 0, Time elapsed: 10.078sec
   F
  AILURE!
  Running
 org.apache.sling.launchpad.webapp.integrationtest.JsonRenderingTest
  Checking if the required Sling services are started...
  Checking if the required Sling services are started...
  Checking if the required Sling services are started...
  Checking if the required Sling services are started...
  Checking if the required Sling services are started...
  Checking if the required Sling services are started...
  Checking if the required Sling services are started...
  Tests run: 7, Failures: 7, Errors: 0, Skipped: 0, Time elapsed: 0.125sec
   FA
  ILURE!
  Running org.apache.sling.launchpad.webapp.integrationtest.IncludeTest
  Checking if the required Sling services are started...
  Checking if the required Sling services are started...
  Checking if the required Sling services are started...
  Tests run: 3, Failures: 3, Errors: 0, Skipped: 0, Time elapsed: 0.016sec
   FA
  ILURE!
  Running
 org.apache.sling.launchpad.webapp.integrationtest.GetWithSuffixTest
  Checking if the required Sling services are started...
  Checking if the required Sling services are started...
  Checking if the required Sling services are started...
  Tests run: 3, Failures: 3, Errors: 0

Re: Filter Scripting (was: POSTs and microjax)

2007-12-21 Thread Michael Marth
Alex,


I can understand both sides of the discussion because both are needed.
 It just depends on the user's or customer's requirements.


I agree. Maybe it'd be good if we treated scripting and Java development as
equal citizens, i.e. if we tried to make available all features to both
approaches if that is possible (I am not sure if it is, though).

Cheers
Michael

-- 
Michael Marth, http://dev.day.com


Re: µsling 2.0 requirements (was: [RT] Shall we merge microsling into Sling?)

2007-12-20 Thread Michael Marth
Sounds great.


 This WebDAV module currently supports the Jackrabbit JCR repository,
 but Sling is meant to run with any JCR repository.



OK, but can I add: switching the repository to another JCR repository is
comparatively easy (i.e. does not require a recompile)

(I like CRX's Repository Explorer)




-- 
Michael Marth, http://dev.day.com


Re: Error Handling in Sling

2007-12-20 Thread Michael Marth
Guys,

you might have lost me in this discussion, but may I ask anyway:

We now have three orthogonal pieces in resolving a script: http method,
requested mime type and response status code (plus script language). How do
they get mixed in the script resolution process? Which script will be
executed when there is a request for a *.pdf that results in a 404? Is it
404.pdf.esp or 404.esp or sthg else?

thanks for clarifying
Michael

On 12/20/07, Felix Meschberger [EMAIL PROTECTED] wrote:

 Hi,

 Am Dienstag, den 18.12.2007, 17:44 -0800 schrieb Padraic Hannon:
  +1
   From what I understand of your proposal this sounds great. I like the
  idea of handling the 404 (or whatever) via the same request mechanism
  as it would give you the same ability for script resolution you
  currently have. However, I still like the idea of hierarchical
  resolution, perhaps this should be worked into the basic microsling
  system? Or is this an overly complicated concept? (I can see how it
  could cause problems in determining exactly what should be called!)

 I do not understand what you mean by hierarchical resolution: Is this
 the Throwable class hiearchy ?

 If so, this is how it is currently implemented in the servlet-resolver
 project.

 Regards
 Felix

 
  -paddy
 
  On Dec 17, 2007, at 11:53 PM, Felix Meschberger wrote:
 
   Hi all,
  
   Prompted by a proposal in the Chickens, eggs and stars thread [1], I
   propose a revised error handling concept for Sling. First, though, I
   present the current implementation.
  
  
   Current implementation
   --
  
   Currently Sling (the core project) defines a ErrorHandlerServlet. This
   interface may be implemented by error handlers and registered as OSGi
   services just like any plain Servlet. In case of an error
   (HttpServletResponse.sendError or an uncaught Throwable), Sling core
   kicks in an error handler which calls the canHandle method of each
   registered servlet in turn.
  
   For an error with status code a series of status values is checked
   against the servlets until a servlet can handle. The series is defined
   as ( sc, (sc/10)*10, (sc/100)*100, 0 ) e.g. for the status 413 the
   series would be ( 413, 410, 400, 0 ). Sling core contains a default
   error handler servlet which replies true for the last entry (0).
  
   For an exception to be handled the class hierarchy of the exception is
   checked. For a FileNotFoundException, the classes
   FileNotFoundException,
   IOException, Exception, and Throwable are checked. The Sling core
   default error handler replies true for the Throwable class.
  
  
   Proposal
   
  
   This implementation is working but it is rather limited as all 404
   stati
   are handled by the same handler regardless of the actual request.
   Starting from the proposal on the dev list, we could resolve the error
   handler servlet or script just like any request handling servlet or
   script.
  
   The error handler creates a temporary SlingHttpServletRequest wrapper
   whose getMethod() implementation returns the status code or Throwable
   thrown. With this wrapper object the same resolution process takes
   place
   as for a normal HTTP method. If no servlet or script can be resolved
   the
   default error handler is used (instead of the normal default servlet).
  
   The call to the error handler script or servlet is done using the
   unwrapped SlingHttpServletRequest, that is the getMethod returns
   actual
   request method. Also the usual request attributes are set as defined
   in
   the Servlet Specification.
  
   A handler for a status code is only searched for the exact status
   code.
   A handler for a Throwable is still searched through the class
   hierarchy,
   which is line with catch clauses, which also support the class
   hierarchy.
  
   WDYT ?
  
   Regards
   Felix
  
   [1]
  
 http://www.mail-archive.com/sling-dev@incubator.apache.org/msg01320.html
 
 




-- 
Michael Marth, http://dev.day.com


POSTs and microjax

2007-12-20 Thread Michael Marth
Hi,

this has been discussed before, but without conclusion afaik, so I would
like to start this discussion again:

at the moment one can only use the microjax post servlet in an
all-or-nothing way. This means that my app needs to decide: I either send
POSTs to the microjax servlet and that's all there is. Or I implement
POST.esp which means I can do all I wish to do, but I have to replicate all
of microjax's servlet functionality (in terms of writing to the repository).

I would really like to have a mechanism to mix this, i.e. to extend the
microjax servlet with custom logic. And there is actually a real-world use
case for it: Spam filtering. Right now I had to revert to a Java servlet to
do this (because I did not want to implement POST.esp). IMO it would be
great if we had something like filters or pipelines or whatever you want
to call it in microsling.

WDYT?

Cheers
Michael

-- 
Michael Marth, http://dev.day.com


Re: use case: resolving a resource based on a node´s version

2007-12-12 Thread Michael Marth

 Do people think we need a syntax for selectors that are handled by the
 Sling/microsling framework and not by applications?


Yes.

(out-of-box handling of versions is one of the big selling points of JCRs
IMHO. It should be easy to select node versions in microsling)




-- 
Michael Marth, http://dev.day.com


Re: Request Data Validation

2007-12-06 Thread Michael Marth
Hi David,

re the use case I still got this one I brought up a while ago: catching spam
comments on a blog.

However, for this use case I do not think I need the validator functionality
typically offered in web frameworks (like checking for empty strings or
stuff like that). I would like to intercept POSTs to the microjax servlet
with some custom logic (in a script).

If that is possible all the simpler validation stuff (like checking for
required values) can be implemented (by an application writer) as well if
someone wishes to do so.

When this was first discussed I think the result was to  implement the POST
script. But I would like to extend the behavior of the PostServlet without
having to reimplement everything it does. That would be something like
implement the POST script (do some validation there) and pass on the
request to the POST servlet or not (depending on the validation).

Cheers
Michael

On 12/6/07, David Nuescheler [EMAIL PROTECTED] wrote:

 hi carsten,


 hehe ;)
  He, you're taking all the fun out of this discussion :)


  Now, I think it makes sense to have an additional validation mechanism
  on top of JCR. I guess with the node type definitions you can't handle
  all validation cases (like validating one field depends on the value of
  another one etc.). So we need these hooks.
 i am all for a general validate() hook.
 (... to take care of the dream-case. ;) )

  It makes sense to leverage the validation information from the
  nodetypes, of course. And I also think that it makes sense to validate
  the input based on this information before a commit. So some sort of
  general service doing this would be great...
 excellent. then all the general cases from xss to integer validation
 can easily be taken care of via regular nodetype definition.

 regards,
 david




-- 
Michael Marth, http://dev.day.com


Re: [jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

2007-11-29 Thread Michael Marth
Bertrand,

2 things I wonder about:

1. would it be better to produce output like:
p class=
document.write(item.color);
\
document.write(item.text);
/p
So that e.g. search engines could index the static parts?

2. Having the same templating language on client and server is nice, but
maybe different delimiters would be a good idea. If the same ones are used
we cannot combine server-side and client-side parts in one script. This
seems like an unnecessary limitation to me.

btw: reminded me of the TrimPath stuff now at
http://code.google.com/p/trimpath/wiki/JavaScriptTemplates

Cheers
Michael

On 11/29/07, Bertrand Delacretaz (JIRA) [EMAIL PROTECTED] wrote:


 [
 https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546652]

 Bertrand Delacretaz commented on SLING-114:
 ---

 Thanks for the hint, didn't know about that. I guess it's cool to have the
 same templating language on both sides, we'll see how this works.

  ECT - Ecmascript Client Templates
  -
 
  Key: SLING-114
  URL: https://issues.apache.org/jira/browse/SLING-114
  Project: Sling
   Issue Type: Improvement
   Components: microsling
 Reporter: Bertrand Delacretaz
 
  To complete the javascript scripting features for microsling, I'd like
 to implement a client-side version of the ESP templates.
  A template such as
p class=%= item.color %%= item.text %/p
  Will be processed server-side to generate javascript client code such as
document.write(p class=);
document.write(item.color);
document.write(\);
document.write(item.text);
document.write(/p\n);
  which executes on the client to render the content.
  Combined with a richer XHTML default rendering of data than what we have
 now, this creates interesting possibilities for ajaxish apps based on
 microsling/microjax (SLING-92).

 --
 This message is automatically generated by JIRA.
 -
 You can reply to this email to add a comment to the issue online.




Re: microsling scripting for POSTs

2007-11-21 Thread Michael Marth
Hi Felix,

implementing a servlet or a servlet filter takes me back to coding Java. It
is my understanding that at least microsling (not necessarily Sling) should
allow me to code JCR-based web apps in scripting languages (ie. that my
scripts are able to write into the repository).

WDYT? What should microsling include?
Michael


On 11/16/07, Felix Meschberger [EMAIL PROTECTED] wrote:

 Hi Michael,

 This is of course feasible: Just extend the MicrojaxPostServlet and
 overwrite the doPost method with your own extensions and register it for
 the node type you are working on. Another solution would be to implement
 a servlet Filter to analyze the request input before it even hits the
 default servlet.

 Regards
 Felix

 Am Freitag, den 16.11.2007, 11:14 +0100 schrieb Michael Marth:
  Hi Felix,
 
  thanks for your reply. I agree with you that hacking special cases into
 the
  servlet is a no-no. But the servlet is already handling a number of
 generic,
  often required things. How about if the application writer could
 implement a
  POST script that does whatever bizarre logic he wishesAfter execution
 the
  request could be passed on to the MicrojaxPostServlet for further
 execution
  of the generic stuff. As such, application writers would not have to
  reinvent the basics but could extend the behaviour. This approach would
 not
  change the microjax protocol either, because the servlet could still
 receive
  the same request.
 
  WDYT?
 
  Michael
 
  On 11/15/07, Felix Meschberger [EMAIL PROTECTED] wrote:
  
   Hi Micheal,
  
   Your are touching a series of points. The main point, if I understand
   correclty, is about scripting any HTTP method not just the GET method.
   This of course part of microsling and has already been. So, as David
   wrote, you could write a POST.xxx script, which handles your post in
   your own format, which you completely define yourself depending on
 your
   application's need.
  
   As for extending the MicrojaxPostSerlvet: I would not extend it
 without
   reconsidering the microjax client side. microjax defines a protocol,
   where the MicrojaxPostServlet implements the server side. It would now
   be a very bad idea to hack something into that servlet, which is not
   part of the microjax protocol, just for a very specific use case.
  
   So, I suggest you implement a POST script and handle the post there.
  
   Hope this helps.
  
   Regards
   Felix
  
   Am Mittwoch, den 14.11.2007, 10:16 +0100 schrieb Michael Marth:
Hi,
   
I played a bit with microsling's new microjax stuff and would like
 to
   offer
some comments on the MicrojaxPostServlet. As far as I understand
 this is
where my app's POST requests get processed (i.e. this is basically
 where
   my
app can modify the repository).
   
My app got quite far with the request parameters that are currently
   parsed
and implemented, but I also hit a wall pretty soon (some use cases
 that
   are
not possible are listed below (*)). Initially, I was planning to
 raise
   some
feature requests for additional request parameters, but I realized
 that
   the
whole architecture in terms of repository writing/modification feels
   wrong
to me. Why should my app's repository operations be confined by the
currently implemented parameter set? That's what I would like to
 bring
   up
here.
   
I think that the processing of POSTs, i.e. writing into the
 repository
should be scriptable just like the processing of GETs is. This means
   that
the MicrojaxPostServlet should not parse hard-coded parameters and
 do
   some
hard-coded stuff with them. It should invoke a script. That script
   should be
able to write, delete, modify, etc (e.g. by getting the request and
 the
repository as scriptable objects).
   
AFAIK there is still some filters to be implemented, but IMO that
 will
   not
cut it. I think that the core functionality of repository writing
 needs
   to
be open for the app developer (even if you think of Sling as a
presentation framework - my simple blogging app has already hit
 this
wall). We could still keep the mechanism right now for very simple
 cases
   or
as a fall-back.
   
WDYT?
   
Cheers
Michael
   
   
(*) In order to not get too esoteric, here's some use cases that
 bugged
   me
(I am aware that there are workarounds for these):
My example app is a blogging application and I would like blog
 readers
   to be
able to leave comments. The problems are:
- the comments shall have a date. Currently, I need to set the date
 in
   the
browser and pass it along as a request parameter. What I would
 really
   like
is to set this date on the server, i.e. add a custom property before
 the
node gets written
(I am aware that I could use Repository Observers to get this done
 but
   do
not I want to write Java code for this)
- the comments shall be checked for Spam before

Re: microsling scripting for POSTs

2007-11-16 Thread Michael Marth
Hi Felix,

thanks for your reply. I agree with you that hacking special cases into the
servlet is a no-no. But the servlet is already handling a number of generic,
often required things. How about if the application writer could implement a
POST script that does whatever bizarre logic he wishesAfter execution the
request could be passed on to the MicrojaxPostServlet for further execution
of the generic stuff. As such, application writers would not have to
reinvent the basics but could extend the behaviour. This approach would not
change the microjax protocol either, because the servlet could still receive
the same request.

WDYT?

Michael

On 11/15/07, Felix Meschberger [EMAIL PROTECTED] wrote:

 Hi Micheal,

 Your are touching a series of points. The main point, if I understand
 correclty, is about scripting any HTTP method not just the GET method.
 This of course part of microsling and has already been. So, as David
 wrote, you could write a POST.xxx script, which handles your post in
 your own format, which you completely define yourself depending on your
 application's need.

 As for extending the MicrojaxPostSerlvet: I would not extend it without
 reconsidering the microjax client side. microjax defines a protocol,
 where the MicrojaxPostServlet implements the server side. It would now
 be a very bad idea to hack something into that servlet, which is not
 part of the microjax protocol, just for a very specific use case.

 So, I suggest you implement a POST script and handle the post there.

 Hope this helps.

 Regards
 Felix

 Am Mittwoch, den 14.11.2007, 10:16 +0100 schrieb Michael Marth:
  Hi,
 
  I played a bit with microsling's new microjax stuff and would like to
 offer
  some comments on the MicrojaxPostServlet. As far as I understand this is
  where my app's POST requests get processed (i.e. this is basically where
 my
  app can modify the repository).
 
  My app got quite far with the request parameters that are currently
 parsed
  and implemented, but I also hit a wall pretty soon (some use cases that
 are
  not possible are listed below (*)). Initially, I was planning to raise
 some
  feature requests for additional request parameters, but I realized that
 the
  whole architecture in terms of repository writing/modification feels
 wrong
  to me. Why should my app's repository operations be confined by the
  currently implemented parameter set? That's what I would like to bring
 up
  here.
 
  I think that the processing of POSTs, i.e. writing into the repository
  should be scriptable just like the processing of GETs is. This means
 that
  the MicrojaxPostServlet should not parse hard-coded parameters and do
 some
  hard-coded stuff with them. It should invoke a script. That script
 should be
  able to write, delete, modify, etc (e.g. by getting the request and the
  repository as scriptable objects).
 
  AFAIK there is still some filters to be implemented, but IMO that will
 not
  cut it. I think that the core functionality of repository writing needs
 to
  be open for the app developer (even if you think of Sling as a
  presentation framework - my simple blogging app has already hit this
  wall). We could still keep the mechanism right now for very simple cases
 or
  as a fall-back.
 
  WDYT?
 
  Cheers
  Michael
 
 
  (*) In order to not get too esoteric, here's some use cases that bugged
 me
  (I am aware that there are workarounds for these):
  My example app is a blogging application and I would like blog readers
 to be
  able to leave comments. The problems are:
  - the comments shall have a date. Currently, I need to set the date in
 the
  browser and pass it along as a request parameter. What I would really
 like
  is to set this date on the server, i.e. add a custom property before the
  node gets written
  (I am aware that I could use Repository Observers to get this done but
 do
  not I want to write Java code for this)
  - the comments shall be checked for Spam before they are written.
  Especially, comments that contain links shall be get a special property
  suspicious
  - I would like to moderate or delete comments in a batch, i.e. modify
  multiple nodes in one request




[jira] Created: (SLING-105) JCR logon should be configurable

2007-11-14 Thread Michael Marth (JIRA)
JCR logon should be configurable


 Key: SLING-105
 URL: https://issues.apache.org/jira/browse/SLING-105
 Project: Sling
  Issue Type: Improvement
  Components: Repository
Reporter: Michael Marth
Priority: Minor


Currently, the account (userid/password) with which microsling creates a JCR 
session can only be changed by a recompile. It would be nice if that was 
configurable instead. That would make the deployment easier.

(Obviously, the password usually needs to be changed, but this is especially 
true when the JCR WebDAV drive needs to be exposed to the outside - which is 
the case the web application has static assets)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



microsling scripting for POSTs

2007-11-14 Thread Michael Marth
Hi,

I played a bit with microsling's new microjax stuff and would like to offer
some comments on the MicrojaxPostServlet. As far as I understand this is
where my app's POST requests get processed (i.e. this is basically where my
app can modify the repository).

My app got quite far with the request parameters that are currently parsed
and implemented, but I also hit a wall pretty soon (some use cases that are
not possible are listed below (*)). Initially, I was planning to raise some
feature requests for additional request parameters, but I realized that the
whole architecture in terms of repository writing/modification feels wrong
to me. Why should my app's repository operations be confined by the
currently implemented parameter set? That's what I would like to bring up
here.

I think that the processing of POSTs, i.e. writing into the repository
should be scriptable just like the processing of GETs is. This means that
the MicrojaxPostServlet should not parse hard-coded parameters and do some
hard-coded stuff with them. It should invoke a script. That script should be
able to write, delete, modify, etc (e.g. by getting the request and the
repository as scriptable objects).

AFAIK there is still some filters to be implemented, but IMO that will not
cut it. I think that the core functionality of repository writing needs to
be open for the app developer (even if you think of Sling as a
presentation framework - my simple blogging app has already hit this
wall). We could still keep the mechanism right now for very simple cases or
as a fall-back.

WDYT?

Cheers
Michael


(*) In order to not get too esoteric, here's some use cases that bugged me
(I am aware that there are workarounds for these):
My example app is a blogging application and I would like blog readers to be
able to leave comments. The problems are:
- the comments shall have a date. Currently, I need to set the date in the
browser and pass it along as a request parameter. What I would really like
is to set this date on the server, i.e. add a custom property before the
node gets written
(I am aware that I could use Repository Observers to get this done but do
not I want to write Java code for this)
- the comments shall be checked for Spam before they are written.
Especially, comments that contain links shall be get a special property
suspicious
- I would like to moderate or delete comments in a batch, i.e. modify
multiple nodes in one request


Re: [RT] microsling ajax client

2007-11-01 Thread Michael Marth
Nice idea.

One comment: if we package microsling Ajax client (can we find another
name, please?) with microsling it makes even more sense to have esp as the
default scripting language (the app developer needs to think in only one
language - be it on the server or on the client)

Michael

On 11/1/07, Christophe Lombart [EMAIL PROTECTED] wrote:

 +1. Great idea.

 On 10/31/07, Lars Trieloff [EMAIL PROTECTED] wrote:
 
 
  What about adding this as a default handler for the json extension,
  compared to an XML serialization as a default handler for the xml
  extension. (I am still thinking about adding a certain XML-processing
  framework as a very powerful script engine to Sling)


 or use the current behaviour for a debug extension.

 Christophe



Re: Script engines as plugins?

2007-10-31 Thread Michael Marth


 If you mean plugins written in Java, that would be Sling OSGi I
 guess...it might seem like a big beast now, but once refactored to the
 new sling-api, Sling OSGi shouldn't be much harder to use than
 microsling for simple things. So we could assume that people with that
 kind of needs would graduate to Sling OSGi,

 OTOH if by plugins you mean scripts that can be reused as software
 components in other scripts, that's a different topic, that might be
 interesting to explore...a bit later maybe ;-)


Well, I deliberately stayed away from the question how an application-level
plugin mechanism should be implemented. But, yes, I meant scripts that can
be reused (but not necessarily just visual components).

I agree, this discussion is probably a bit too early.


Re: microsling user feedback

2007-10-19 Thread Michael Marth
Hi,

I gave it a shot to put the static resources in the repository and access
them through WebDAV. It worked, but there is one issue that I would like to
mention in this discussion about the correct implementation:

Even for resources that are readable for for anonymous users I get the basic
authentication popup of the browser. Surely, this can be suppressed (maybe
by wrapping the WebDAV servlet?). But this also made me wonder how the
single-sign-on would work between a (raw, unwrapped) WebDAV-based part (that
uses basic authent) and microsling (that uses the jsessionid cookie/Java
appserver mechanisms)? microsling could of course accept the basic
authentication headers if a WebDAV login occurred first, but how would it
work the other way round?

Cheers
Michael


On 10/19/07, Felix Meschberger [EMAIL PROTECTED] wrote:

 Hi,

 Am Freitag, den 19.10.2007, 15:09 +0200 schrieb David Nuescheler:
  Therefore I think that a GET to the exact repository path should
  generally be handled the same way as the WebDAV GET.
  I think this is very easy to understand for everybody and
  means that microsling generally works just like every
  other WebDAV enabled webserver for everything that is
  static.

 This sounds very plausible, but has some implications, which turn out to
 be somewhat problematic. Therefore, I just added a StreamServlet which
 streams a resource of type nt:file (which is most likely what is
 required by Michael) and in addition support If-Modified-Since header
 such that a 304 may be sent back just in case.

 This more or less should match, what WebDAV does in this respect, and I
 think we are done without any special handling.

  Personally, I think that this is a very simple and
  straightforward solution that leverages a lot of features
  implemented in WebDAV entirely correctly.
  Think of etag or modified since behaviour on GET
  or PUT and DELETE which all would have to be
  re-implemented in microsling.

 Streaming out of a Sling Application currently only discusses reading
 (GET) not updating, which is done as described by Betrand using access
 to the WebDAV servlet included with microsling.

  Generally I think WebDAV is very Restful and a very
  good basis to start and sort of decorate microsling
  on top of a webdav enabled server.

 This sounds like an interesting point, though: Running Sling/microsling
 ontop of a WebDAV server instead of a repository  :-)

  I think assuming assuming that people add an extension
  to let's say /content/mypage when GETting /content/mypage.html
  though microsling is good practice anyway.

 Definitely, it also helps determine the default response content type.

 Regards
 Felix