Re: JackRabbit 2

2009-10-13 Thread Felix Meschberger
Hi Ben,

Ben Short schrieb:
> Hi,
> 
> Will sling be updated to use JackRabbit 2 when its released?

Yes, I would definitely think so.

Any help and patches are of course highly welcome !

RegardsFelix

> 
> Regards
> 
> Ben Short
> 


Re: Adding a filter

2009-10-14 Thread Felix Meschberger
Hi Ben, I fear you are missing the maven-scr-plugin which converts the
JavaDoc tags into the Declarative Services descriptor used to register
the filter.

Also setting 'enabled="no"' actually per default disables the filter.
You should remove this setting unless you plan to manually enable the
filter.

I think that using the 'immediate="true"' flag makes sense since the
service will anyway immediately be picked up by the SlingMainServlet.

HTH

Regards
Felix

Ben Short schrieb:
> Hi,
> 
> I'm trying to add a filter to my bundle I have the following at the
> top of my class
> 
> /**
> * @scr.component metatype="no" enabled="no"
> * @scr.property name="service.description" value="Request Filter"
> * @scr.property name="filter.scope" value="request" private="true"
> * @scr.property name="filter.order" value="-2147483648" type="Integer"
> private="true"
> * @scr.service
> */
> 
> And my maven config is as follows
> 
> 
> org.apache.felix
> maven-bundle-plugin
> true
> 
> 
> 
> initial-content;overwrite:=true;uninstall=true
> 
> com.daisytechnologies.*;version=${pom.version}
> 
> 
> 
> 
> 
> I deploy the bundle but can't see that the filter is added or being used.
> 
> I have also set
> 
> * @scr.component metatype="no" enabled="no"
> 
> to
> 
> * @scr.component metatype="no" immediate="true"
> 
> but no joy.
> 
> Can anyone help me out?
> 
> Ben
> 


Re: Adding a filter

2009-10-14 Thread Felix Meschberger
Hi,

Ben Short schrieb:
> I have the following in my pom now and removed enabled='no' and added
> immediate='true' but no luck
> 
> 
> org.apache.felix
> maven-scr-plugin
> 

This seems to be missing the  element to actually run a
goal. I generally have this in the pluginmanagement section of the
parent pom



org.apache.felix
maven-scr-plugin
1.4.0


generate-scr-scrdescriptor

scr





And in the project extending from the parent POM I just refer to the
plugin inheriting the executions from the parent pom.

When running the maven build you should see something like

[scr:scr]

Regards
Felix


> 
> 
> org.apache.felix
> maven-bundle-plugin
> true
> 
> 
> 
> initial-content;overwrite:=true;uninstall=true
> 
> com.daisytechnologies.*;version=${pom.version}
> 
> 
> 
> /classes/com/daisytechnologies
>     
> 
> 
> 
> 
> 
> 2009/10/14 Felix Meschberger :
>> Hi Ben, I fear you are missing the maven-scr-plugin which converts the
>> JavaDoc tags into the Declarative Services descriptor used to register
>> the filter.
>>
>> Also setting 'enabled="no"' actually per default disables the filter.
>> You should remove this setting unless you plan to manually enable the
>> filter.
>>
>> I think that using the 'immediate="true"' flag makes sense since the
>> service will anyway immediately be picked up by the SlingMainServlet.
>>
>> HTH
>>
>> Regards
>> Felix
>>
>> Ben Short schrieb:
>>> Hi,
>>>
>>> I'm trying to add a filter to my bundle I have the following at the
>>> top of my class
>>>
>>> /**
>>> * @scr.component metatype="no" enabled="no"
>>> * @scr.property name="service.description" value="Request Filter"
>>> * @scr.property name="filter.scope" value="request" private="true"
>>> * @scr.property name="filter.order" value="-2147483648" type="Integer"
>>> private="true"
>>> * @scr.service
>>> */
>>>
>>> And my maven config is as follows
>>>
>>> 
>>> org.apache.felix
>>> maven-bundle-plugin
>>> true
>>> 
>>> 
>>>
>>> initial-content;overwrite:=true;uninstall=true
>>> 
>>> com.daisytechnologies.*;version=${pom.version}
>>> 
>>> 
>>> 
>>> 
>>>
>>> I deploy the bundle but can't see that the filter is added or being used.
>>>
>>> I have also set
>>>
>>> * @scr.component metatype="no" enabled="no"
>>>
>>> to
>>>
>>> * @scr.component metatype="no" immediate="true"
>>>
>>> but no joy.
>>>
>>> Can anyone help me out?
>>>
>>> Ben
>>>
> 


Re: Sling and JSF

2009-10-14 Thread Felix Meschberger
Hi,

Andreas Kuckartz schrieb:
> I am considering to use Sling as a backend for RIAs / portals / WCMS.
> 
> Would it be reasonable to combine Sling and JSF?

What is the goal you are trying to achieve with JSF ?

> 
> Any other hints or suggestions?

If you are looking for some client side GUI support stuff, you might
also consider something like JQuery or ExtJS or Dojo. All three are easy
to use with Sling and we even have some bundles using these.

Another approach would be to use Google Web Toolkit (GWT) for which we
also have some sample bundles.

Regards
Felix


Re: Using Jackrabbit 1.6 or any other jackrabbit version

2009-11-04 Thread Felix Meschberger
Hi Michael,

Michael Yin schrieb:
> Is there an easy way to do this?
> 
> Currently I am running into this issue
> https://issues.apache.org/jira/browse/JCR-1902
> 
> I wanted to switch out the jackrabbit being used to a version where this
> is fixed, but it appears the only way was for me to edit the pom.xml of
> the sling jackrabbit-server and rebuild it. is there no other way than
> this?

Yes, that is currently the only option you have. Of course you are
welcome to report a JIRA issue and attach a patch for us to upgrade the
jacrkabbit server bundle in the SVN repository.

As Jackrabbit is currently running towards its 2.0 release, we are
exploring other options, one (this is my personal opinion right now)
would be that the Jackrabbit project would be providing an OSGi bundle
of the repository

Regards
Felix


Re: Using Jackrabbit 1.6 or any other jackrabbit version

2009-11-05 Thread Felix Meschberger
Hi,

Michael Yin schrieb:
> That would be useful. Is there a timeline for 2.0?

Honestly, I don't know. This should probably be asked on any of the
Jackrabbit lists. Sorry.

Regards
Felix

> 
> -Original Message-
> From: Felix Meschberger 
> Reply-To: users@sling.apache.org
> To: users@sling.apache.org
> Subject: Re: Using Jackrabbit 1.6 or any other jackrabbit version
> Date: Wed, 04 Nov 2009 13:46:01 -0800
> 
> Hi Michael,
> 
> Michael Yin schrieb:
>> Is there an easy way to do this?
>>
>> Currently I am running into this issue
>> https://issues.apache.org/jira/browse/JCR-1902
>>
>> I wanted to switch out the jackrabbit being used to a version where this
>> is fixed, but it appears the only way was for me to edit the pom.xml of
>> the sling jackrabbit-server and rebuild it. is there no other way than
>> this?
> 
> Yes, that is currently the only option you have. Of course you are
> welcome to report a JIRA issue and attach a patch for us to upgrade the
> jacrkabbit server bundle in the SVN repository.
> 
> As Jackrabbit is currently running towards its 2.0 release, we are
> exploring other options, one (this is my personal opinion right now)
> would be that the Jackrabbit project would be providing an OSGi bundle
> of the repository
> 
> Regards
> Felix
> 
> 


Re: Installing a bundle

2009-11-11 Thread Felix Meschberger
Hi Audrey,

Sorry for being late, but this post grabbed my attention, since you say
you include org.apache.jackrabbit.core.

Why do you want to do that ?
What is the goal of your bundle ?
Do you want to access an existing repository ?

You might want to use the Sling jackrabbit-server bundle, which comes
with an embedded repository. Then in your components you might grab the
SlingRepository (or javax.jcr.Repository) service from the service
registry and access the repository directly.

And most importantly: do not export jackrabbit.core bundles, this is
most probably not correct.

Regards
Felix


Audrey Colbrant schrieb:
> Fixed  ;)
> The solution comes with the , it was needed to export all 
> packages mentionned "!! name_package,version=0.0.0 from -- Cannot be resolved"
> I have also deleted the * and 
> modified the Import-Package adding resolution:=optional
> 
> If it can help, here the pom.xml to see differences between the last one and 
> those that works:
> 
> http://maven.apache.org/POM/4.0.0";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
> http://maven.apache.org/maven-v4_0_0.xsd";>
> 4.0.0
> org.tb
> postHandler
> bundle
> 1.0-SNAPSHOT
> Tibtec TB Post Handler
> http://www.tibtec.org
> 
> 
> true
> utf-8
> 
> 
> 
> 
> 
> org.apache.maven.plugins
> maven-enforcer-plugin
> 1.0-alpha-3
> 
> 
> enforce-java
> 
> enforce
> 
> 
> 
> 
> 
> Project must be built with Maven 
> 2.0.7 or higher
> 
> 2.0.7
> 
> 
> 
> Project must be compiled with Java 5 
> or higher
> 
> 1.5.0
> 
> 
> 
> 
> 
> 
> 
> org.apache.maven.plugins
> maven-compiler-plugin
> 
> 1.5
> 1.5
> 
> 
> 
> 
> org.apache.felix
> maven-scr-plugin
> 1.0.4
> 
> 
> generate-scr-scrdescriptor
> 
> scr
> 
> 
> 
> 
> 
> 
> org.apache.felix
> maven-bundle-plugin
> true
> 
> 
> 
> org.tb.postHandler.*
> 
> org.apache.jackrabbit.*,
> 
> org.apache.xerces.parsers,org.apache.xerces.xni,org.apache.xerces.xni.parser,
> org.cyberneko.html,
> 
> org.pdfbox.pdfparser,org.pdfbox.pdmodel,org.pdfbox.util,
> 
> org.apache.lucene.analysis,org.apache.lucene.analysis.standard,org.apache.lucene.document,
>  
> org.apache.lucene.index,org.apache.lucene.queryParser,org.apache.lucene.search,
>  org.apache.lucene.store,org.apache.lucene.util,
> 
> org.apache.poi.hslf.extractor,org.apache.poi.hssf.extractor,org.apache.poi.hwpf.extractor,
>  
> org.apache.poi.hsmf,org.apache.poi.poifs.eventfilesystem,org.apache.poi.poifs.filesystem,
> EDU.oswego.cs.dl.util.concurrent
> 
> 
> *;resolution:=optional
> 
> 
> 
> 
> 
> org.apache.sling
> maven-sling-plugin
> 2.0.3-incubator-SNAPSHOT
> 
> 
> install-bundle
> 
> install
> 
> 
> ...
> 
> 
> 
> 
> 
> 
> 
> 
> 
> javax.jcr
> jcr
> 1.0
> provided
> 
> 
> javax.servlet
> servlet-api
> 2.5
> provided
> 
> 
> org.apache.sling
> org.apache.sling.api
> 

Re: Installing a bundle

2009-11-13 Thread Felix Meschberger
Hi,

Audrey Colbrant schrieb:
>> What is the goal of your bundle ?
> The bundle manage specific post handlers for my application so I extend for 
> each of them the SlingPostOperation.

Makes perfect sense.

> 
>> Why do you want to do that ?
>> Do you want to access an existing repository ?
> On the website, I have a login form that I send to one of the previous 
> handlers when submission button is pressed. Once I reach the handler, I log 
> in the repository, create a session with specific access, and I can allow or 
> deny access to some parts of my application.
> 
> Ad example, if my repository is like that:
> -- /content/tb_monitoring
>  hospitals
>  idents
>  ...
> I want that an admin can access all nodes, but a doctor should not access to 
> the node idents. So I have defined ACL on nodes and now I need a login system 
> into the repository.
> 
> I use the following code:
> Repository repository = new TransientRepository();
> 
> Session session = repository.login(new SimpleCredentials(login, 
> password));
> (same as here http://jackrabbit.apache.org/first-hops.html)
> 
> Why isn't it suitable in my case?
> 
> Which other piece of code should I use instead?

Hmm, let me see:

 * You want your users (non-admins) to be able to login using a
   login form

 * You want then process the requests on behalf of the users and
   failing the requests if they don't have enough access rights

Well, I suggest you go a completely different route then.

First you don't have to care to get the repository session. Sling can
take care of that for you. If you have special login requirements, which
are not yet supported by Sling (we standard HTTP BASIC authentication
and OpenID authentication support) you might want to implement the
org.apache.sling.engine.auth.AuthenticationHandler interface. This
allows for providing your own handler to extract credentials from a
request. See the httpauth [1] project for a sample implementation.

Next in your SlingPostOperation you already have the request connected
to the repository and can directly access it:

   ResourceResolver rr = request.getResourceResolver();
   Session s = rr.adaptTo(Session.class);

You also don't have to logout, this is taken care of by Sling.

HTH

Regards
Felix

[1] https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/httpauth

> 
> 
>> And most importantly: do not export jackrabbit.core bundles, this is
>> most probably not correct.
> If I don't export that, it's no more working properly... Do you have any idea 
> what could be wrong in my pom.xml
> 
> Thanks in advance,
> 
> Audrey
> 
> 
> _
> Vivez Noël avant l'heure avec Hotmail Magic Moment !
> http://www.hotmailmagicmoment.com



Re: Right place to put jdbc drivers..

2009-11-13 Thread Felix Meschberger
Hi Fabrizio

Fabrizio Scarcello schrieb:
> Hi to all,
> a quick question: where i have to put jdbc drivers, if i use an external db
> (not just the embedded derby)?
> I downloaded the Sling war distribution, extracted and configured it with
> PostegreSQL and then deployed it in a Tomcat instance under the context
> /sling. It works fine, as i can see the system/console page...
> But, trying to execute my scripts, i found that Sling searchs the
> PostegreSQL drivers, but can't find them (even if i put the jar in the /lib
> tomcat directory, where other webapps find and use it)...
> I have the following exception:
> 13.11.2009 12:11:04.858 *ERROR* [SCR Component Actor]
> org.apache.jackrabbit.core.RepositoryImpl failed to start Repository: Cannot
> instantiate persistence manager
> org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager:
> Could not load class org.postgresql.Driver: org.postgresql.Driver
> 
> I think Sling has a different class loading engine and then different
> settings...

Yes, Sling is running inside an OSGi framework which is all about
encapsulation (amongst other things of course). So there is no global
class loader to which all class laoder delegate automagically as is
custom in a regular java application.

Otherwise all these nices things of dynamic bundle upgrades would not be
possible.

> Where i have to put the PostgreSQL driver jar to make it visible to Sling?

Point is, how do you make them available to the Jackrabbit-Server
bundle. I would suggest you create a Fragment bundle of the PostgreSQL
driver jar which you attach to the Jackrabbit-Server bundle.

The postgresql bundle contains the required drivers as private packages
(no need to Export-Package them) and the framework will take care to add
them to the class loader of the jackrabbit server bundle for the
Jackrabbit Core to see the classes.

Hope this helps.

Regards
Felix


Re: Right place to put jdbc drivers..

2009-11-13 Thread Felix Meschberger
Hi,

Fabrizio Scarcello schrieb:
>> Hi Fabrizio
>>
> 
> Hi Felix!
> What's a pleaure to talk with you.. 

Thanks ;-)

> i'm surfing the sling mail archive and
> i'm convinced that you are the real Apache Felix! ;-)

Well, I am a member of the Apache Felix PMC but the project and me got
their names completely independently of each other ;-)

> I'm totally new to OSGI, but i'm enjoying a lot while discovering it...
> The solution you suggested is very nice (the fragment bundle itself is a
> very nice concept.. :-)), but perhpas i wasn't able to do all the right
> things...
> I have a directory postgres_fragment with:
> - the postgresql.jar jdbc drivers
> - the META-INF directory, containing a blank DEPENDENCIES file, NOTICE and
> LICENSE files and the MANIFEST.MF file as follow:
> 
> Manifest-Version: 1.0
> Bundle-Name: PostgreSQL Fragment
> Bundle-Description: Attach PostgreSQL connectors to the embedded Jackrabbit
> server bundle
> Private-Package: org.postgresql
> Fragment-Host: org.apache.sling.jcr.jackrabbit.server
> Built-By: fabris
> Bundle-Category: db_driver
> Created-By: Fabris
> Bundle-Vendor: HicTech s.r.l.
> Build-Jdk: 1.6.0_16
> Bundle-Version: 0.1
> Bnd-LastModified: 1258108309167
> Bundle-ManifestVersion: 2
> Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
> Bundle-SymbolicName: com.hictech.bundle.postgresql
> 
> 
> I make the jar of the directory content and install it using the
> system/console webapp, but the bundle is only installed and not started (if
> i understood, it can just depend from the different fragment bundles
> lifecycle...) and the repository periodically tries to start but fails with
> the following message:
> 13.11.2009 16:31:34.058 *ERROR* [Repository Pinger]
> org.apache.jackrabbit.core.RepositoryImpl failed to start Repository: Cannot
> instantiate persistence manager
> org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager:
> Could not load class org.postgresql.Driver
> 
> I'm not understanding where is the error... can you help me or give the
> right link to read? ;-)

Maybe the solution is very simple: If you start the fragment after the
host bundle, the host bundle is (probably) not aware of the fragment
yet. So you might want to refresh the jackrabbit-server bundle from
within the web console.

This should attacht the fragment and then add the contents of the bundle
to the jackrabbit-server bundle's class loader.

Please, note that fragments attached to a host bundle are only in
resolve state and not in started state.

Hope this helps.

Regards
Felix

PS: Only the MANIFEST.MF file is important for OSGi, the DISCLAIMER,
LICENSE and NOTICE.txt files are required by Apache for our artifacts
for licensing reasons.

> Thanks in advance,
> greetings,
> Fabris.
> 
> 
> 
> 
>> Fabrizio Scarcello schrieb:
>>> Hi to all,
>>> a quick question: where i have to put jdbc drivers, if i use an external
>> db
>>> (not just the embedded derby)?
>>> I downloaded the Sling war distribution, extracted and configured it with
>>> PostegreSQL and then deployed it in a Tomcat instance under the context
>>> /sling. It works fine, as i can see the system/console page...
>>> But, trying to execute my scripts, i found that Sling searchs the
>>> PostegreSQL drivers, but can't find them (even if i put the jar in the
>> /lib
>>> tomcat directory, where other webapps find and use it)...
>>> I have the following exception:
>>> 13.11.2009 12:11:04.858 *ERROR* [SCR Component Actor]
>>> org.apache.jackrabbit.core.RepositoryImpl failed to start Repository:
>> Cannot
>>> instantiate persistence manager
>>>
>> org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager:
>>> Could not load class org.postgresql.Driver: org.postgresql.Driver
>>>
>>> I think Sling has a different class loading engine and then different
>>> settings...
>> Yes, Sling is running inside an OSGi framework which is all about
>> encapsulation (amongst other things of course). So there is no global
>> class loader to which all class laoder delegate automagically as is
>> custom in a regular java application.
>>
>> Otherwise all these nices things of dynamic bundle upgrades would not be
>> possible.
>>
>>> Where i have to put the PostgreSQL driver jar to make it visible to
>> Sling?
>>
>> Point is, how do you make them available to the Jackrabbit-Server
>> bundle. I would suggest you create a Fragment bundle of the PostgreSQL
>> driver jar which you attach to the Jackrabbit-Server bundle.
>>
>> The postgresql bundle contains the required drivers as private packages
>> (no need to Export-Package them) and the framework will take care to add
>> them to the class loader of the jackrabbit server bundle for the
>> Jackrabbit Core to see the classes.
>>
>> Hope this helps.
>>
>> Regards
>> Felix
>>
> 


Re: Servlet Filter and File References in Sling

2009-11-18 Thread Felix Meschberger
Hi,

Christian Sprecher schrieb:
> Hi all
> 
> Been trying to integrate a Servlet Filter into Sling, which relies on
> "...
> String realLogSettingsFilename =
> fc.getServletContext().getRealPath(logSettingsFilename);
> ..."
> to retrieve a file out of the servlet context.
> 
> Now, without knowing too much (well, nothing) about all the PAX stuff, I
> cannot figure out how to define logSettingsFilename to point to a
> phyiscal, real file.

This is a bit tricky and we did not pay much attention to this method
really (other than calling into the servlet container's
ServletContext.getRealPath method.

Now, it depends on how this container is implementing this call.

Generally, I think in the context of Sling you should not do this but
rather use the ResourceResolver to access and maintain any files (and
content or data in general).

For example, if you know exactly where you expect files, you might
install the Filesystem Resource Provider [1] and configure to provider
to hook into the resource tree.

Regards
Felix

[1]
http://sling.apache.org/site/accessing-filesystem-resources-extensionsfsresource.html

> 
> "...
> 17.11.2009 21:37:50.867 *INFO* [SCR Component Actor]
> org.ops4j.pax.web.service.internal.HttpServiceContext getting real path:
> [test.txt]
> 17.11.2009 21:37:50.867 *INFO* [SCR Component Actor]
> org.ops4j.pax.web.service.internal.HttpServiceContext getting resource:
> [test.txt]
> 17.11.2009 21:37:50.867 *INFO* [SCR Component Actor]
> org.ops4j.pax.web.service.internal.HttpServiceContext found resource: null
> ..."
> 
> ==> where does a Servlet Filter, deployed as a service in a OSGI bundle
> look for files with the "getRealPath" method?
> 
> Thx for clarifications
> 
> 


Re: Usage of "legacy" OSGi services as resource providers

2009-11-18 Thread Felix Meschberger
Hi,

Daniel Bimschas schrieb:
> I wonder if there's a possibility to re-use existing OSGi services as 
> resource providers for Sling? These services could be of arbitrary type, i.e. 
> some could be a facade for a database, some would do data mining, providing 
> their results as resources and so on. Which interfaces would I have to 
> implement and how would I have to configure Sling to find the service-based 
> resource provider?

Yes, I this should certainly be possible.

Resource providers are hooked into the resource tree by means of
ResourceProvider services (see the ResourceProvider[1] service interface).

If you have an existing OSGi service you would probably have to
implement a bridge: The bridge would be the ResourceProvider service
making the data of the existing OSGi service available as Resource
instances.

For an example of a simple resource provider, you might want to look at
the Filesystem Resource Provider [2], which provides plattform files and
folders as resources.

For an example of a bridging ResourceProvider you might want to look at
the Servlet Resolver bundle [3], which has a
ServletResourceProviderFactory which takes registered Servlet services
and wraps them into ServletResourceProvider instances which are
registered as ResourceProvider services.

> 
> Another question that arose is if I can use existing JAX-RS (Jersey)-based 
> code in Sling? This would fit perfectly regarding the REST architecture, even 
> if the philosophies of the frameworks seem different.
> 
> Searching the archives I didn't find any answer to my question even if I'm 
> sure somebody must have asked before ;-) So I'm sorry if there was a thread 
> about the topic before...

There has been a question or two about integrating JAX-RS (JSR-311) with
Sling. I can only repeat, what I said back then: I think that it would
probably be a good thing, if we could integrate JSR-311 into Sling. In
fact, I have the impression, that Sling could perfectly well provide an
implementation of JAX-RS for JAX-RS applications to be deployed into Sling.

But, well, noone really picked up this idea as of yet... So you would be
very welcome to contribute such a thing ;-)

Regards
Felix

[1]
http://sling.apache.org/apidocs/sling5/org/apache/sling/api/resource/ResourceProvider.html
[2]
http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/fsresource
[3]
http://svn.apache.org/repos/asf/sling/trunk/bundles/servlets/resolver


Re: 46 line blog example

2009-11-18 Thread Felix Meschberger
Hi Greg,

You may either comment on the page in the wiki or file a JIRA issue for
component "Documentation".

Thanks and Regards
Felix

Greg Akins schrieb:
> On Wed, Nov 18, 2009 at 5:01 PM, Brett Porter  wrote:
>> From the espblog README, this might help:
>>
>> Start by logging in at http://localhost:8080/?sling:authRequestLogin=true,
>> using username=admin and password=admin
>>
> 
> I accidentally only replied to Brett that that worked.  Thanks!
> 
> What can I do to help update the documentation?  That wasn't the only
> thing I had to do to make the example work.. I also had to install the
> Path based resolution plugin
> 


Re: Usage of "legacy" OSGi services as resource providers

2009-11-19 Thread Felix Meschberger
Hi,

Daniel Bimschas schrieb:
> Am 18.11.2009 um 12:57 schrieb Felix Meschberger:
> 
>> Hi,
>>
>> Daniel Bimschas schrieb:
>>> I wonder if there's a possibility to re-use existing OSGi services as 
>>> resource providers for Sling? These services could be of arbitrary type, 
>>> i.e. some could be a facade for a database, some would do data mining, 
>>> providing their results as resources and so on. Which interfaces would I 
>>> have to implement and how would I have to configure Sling to find the 
>>> service-based resource provider?
>> Yes, I this should certainly be possible.
>>
>> Resource providers are hooked into the resource tree by means of
>> ResourceProvider services (see the ResourceProvider[1] service interface).
>>
>> If you have an existing OSGi service you would probably have to
>> implement a bridge: The bridge would be the ResourceProvider service
>> making the data of the existing OSGi service available as Resource
>> instances.
>>
>> For an example of a simple resource provider, you might want to look at
>> the Filesystem Resource Provider [2], which provides plattform files and
>> folders as resources.
>>
>> For an example of a bridging ResourceProvider you might want to look at
>> the Servlet Resolver bundle [3], which has a
>> ServletResourceProviderFactory which takes registered Servlet services
>> and wraps them into ServletResourceProvider instances which are
>> registered as ResourceProvider services.
> 
> Thanks for the information! I'll try out soon. It now seems perfectly clear 
> to me what I have to do :-)
> 
>>> Another question that arose is if I can use existing JAX-RS (Jersey)-based 
>>> code in Sling? This would fit perfectly regarding the REST architecture, 
>>> even if the philosophies of the frameworks seem different.
>>>
>>> Searching the archives I didn't find any answer to my question even if I'm 
>>> sure somebody must have asked before ;-) So I'm sorry if there was a thread 
>>> about the topic before...
>> There has been a question or two about integrating JAX-RS (JSR-311) with
>> Sling. I can only repeat, what I said back then: I think that it would
>> probably be a good thing, if we could integrate JSR-311 into Sling. In
>> fact, I have the impression, that Sling could perfectly well provide an
>> implementation of JAX-RS for JAX-RS applications to be deployed into Sling.
>>
>> But, well, noone really picked up this idea as of yet... So you would be
>> very welcome to contribute such a thing ;-)
> 
> In fact, I'm thinking about "paying back" something to one of the Apache 
> projects by contributing as I've already had so much profit through using 
> them :-) This contribution will be on the very top of my list of choices!

Great ! Looking forward to it.


Regards
Felix

> 
>> Regards
>> Felix
>>
>> [1]
>> http://sling.apache.org/apidocs/sling5/org/apache/sling/api/resource/ResourceProvider.html
>> [2]
>> http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/fsresource
>> [3]
>> http://svn.apache.org/repos/asf/sling/trunk/bundles/servlets/resolver
> 


Re: Upgrading the Resource Resolver

2009-12-20 Thread Felix Meschberger
Hi,

Jukka Zitting schrieb:
> Hi,
> 
> I'm wondering if this operation is supposed to work (tested on
> org.apache.sling.launchpad.app-5-incubator and a CRX development
> version at work):
> 
> 1. I have org.apache.sling.jcr.resource-2.0.4-incubator.jar installed
> and want to upgrade it to the latest version from Sling trunk.
> 
> 2. I use the web console to install 2.0.7-SNAPSHOT, and get dependency
> version issues with API and Adapter and Classloader.
> 
> 3. I use the web console to install the latest SNAPSHOT versions of
> those dependencies.
> 
> 4. Now the dependency issues are solved, and I can start the Resource
> Resolver bundle.
> 
> Unfortunately now all my HTTP requests fail with a 404 error. The
> problem gets solved when I do a full restart of Sling.
> 
> Questions:
> 
> * Why did the upgrade break the HTTP requests? I would have expected
> that after the upgrade the system should have been back to an
> operational state without requiring a restart.

Maybe this is related to bugs in the Apache Felix SCR used. But you are
basically right, the concept is, that it should continue to work.

Yet, if you upgrade through the web console manually uploading the
artifacts (as opposed to using the maven plugin), you have refresh the
packages manually pressing the "Refresh Packages" button on the bundles
page.

> 
> * Why does the "patch version" upgrade from 2.0.4 to 2.0.7 require
> changes in dependencies? I would have expected that a patch version
> upgrade would have worked as a drop-in replacement.

Well, yes and no, maybe.

But actually 2.0.7-SNAPSHOT is a snapshot version towards the next
release which may well be 2.1 (probably).

And yes, you are right, we should pay more attention to versions, which
is what we will be doing for the next releases of core bundles like
engine and jcr/resource.

Regards
Felix

> 
> BR,
> 
> Jukka Zitting
> 


Happy New Year

2009-12-31 Thread Felix Meschberger
I wish you all and your families a happy and prosperous new year è

It has been a pleasure working with (and for) you all guys and I look
forward to an interesting 2010.

Regards
Felix



Re: A greeting and a feedback from a Sling lover...

2010-01-11 Thread Felix Meschberger
Hi Fabris,

On 11.01.2010 18:03, Fabrizio Scarcello wrote:
> Hi to all, and a great new (not so much now... :-) ) year to all Sling-ers
> in the world! :-D

Thanks ;-)

> Note: after writing the mail i noted that it was too long, so i divided it
> in two parts: the first is just an introduction (ok, a loong introduction...
> but i had to write it!): jump it if you are not interested in my general
> propositions for a Slinged 2010... :-D
> 
> 
> -- 1 --
> 
> I'm developing a fully-modifiable site (a sort of customized cms..) and i'm
> obviously enjoying a lot the beautiful features of Sling...
> I'm a Java (M-S-EE) programmer, but when i started to discover Sling (two
> months ago) i had absolutely no experience with Sling and its background
> technologies (jcr, osgi, maven), so i think to be a good "target" to test
> documentation-related aspects from a "totally beginner" point of view...
> I really love Sling and i would like to give all contributes i can, so i
> would like to share all my sling-related work, mainly:

You are very welcome !
> 
> - give feedback, collect and share common problems, from a beginner point of
> view (that is, the point of view of a developer who wants to build it's
> first web-site using Sling but is still in a pre-jcr state... :-)). I worked
> around some little difficult, and i still have several questions to ask,

Feel free to ask.

> just because most of the documentation (obviously) assumes that the
> developer already knows the thecnologies Sling uses: i would like to collect
> them and write a tutorial targeted to developers like me, without experience
> with the Sling technologies, just to help the widespreed Sling MUST have...
> (this tutorial would concern commmon aspects a beginner must address, like
> dbms configuration, services registration and so on...).

Good idea.

> 
> - clean and release sources of my little cms: it has the power to build a
> whole localized, fully-modular site by simply defining two html files (view
> and edit mode) for the site-structure and for every module one wants to use
> in the site (ex: an image gallery, a text paragraph with an image, ecc.).
> All the site is then completely buildable and editable from the web
> interface (pages and menu items can be added and managed thanks to a sitemap
> page, modules in each page can be managed with their own edit-mode file)...
> The project can localize each content (not just the scripts) and uses ajax
> to inject modules in pages; it also includes some javascript (pure native
> js, no js framework required) and java (& esp..) utility code to access main
> sling functions.
> I know it's not immediate to describe it in a few lines, but i think it can
> be a good starting point to understand Sling features (coupled with the
> tutorial, i hope it can help Sling beginners to rapidly understand and use
> the main Sling concepts...); and obviously it's also a start-point to build
> a full Sling site with a very small learning curve, just to enter the Sling
> world (knowing html and the few helper ECMA functions is enough to build a
> complete custom site)...

Are you saying, you want to contribute this to Sling ? You are, without
question, very welcome to do so ;-)

> 
> The project is now functional and ready to use, but i would like to clean it
> (the code is now a bit confused...) and to complete it with several useful
> Sling features i just skipped at the moment (because i'm still a Sling
> beginner too, and i had some difficulty to use them)
> 
> 
> -- 2 --
> 
> In reference to the FAQ "How do I render a script for a star "*" resource?":
>  i modified just a bit the path-based-rtp, to provide the resource type ONLY
> in the case of star resources: from my point of view, it's a natural
> behaviour to infer the type of a star resource from the request path, so
> that the problem accessed by the FAQ simply disappears... i used this
> modified version in my project and all works fine (without interferences
> with resources that already have their resource-type)...

Ok. I am not readily familiar with the potential consequences. But I
invite you to provide the patch in a JIRA issue, such that we can
consider it for inclusion (or otherwise explain, why we might reject it).

> So this is only a feedback: i think this approach can be generally useful
> (maybe in the most general form to provide a resource path ALWAYS, if the
> addressed resource hasn't its own...), as the default Sling behaviour or as
> a bundle ready to activate (in the Sling bundle repository)... is it right?
> Or there is a conceptual error in my vision?

I do not understand this part... Are you talking of the path-based-rtp?

Its goal is exactly to provide a resource type for resources, which do
not have a sling:resourceType property and the primary node type is not
appropriate to be used as a resource type.

> 
> I would like to ask several questions to the mailing list in the next days
> (i collected and tried to resolve them 

Re: Client JSon Calls

2010-01-27 Thread Felix Meschberger
Hi,

On 27.01.2010 09:22, Bertrand Delacretaz wrote:
> Hi Andy,
> 
> On Tue, Jan 26, 2010 at 6:07 PM, Andreas Schaefer  wrote:
>> To see if Sling would fit our project I would need to be able to handle 
>> calls from a client (Ext/JS)
>> sending JSon to server and expecting a JSon response back


Actually, there is a FAQ entry for this problem [1].

> 
> Ok - as standard the SlingPostServlet expects incoming values as
> request parameters, see
> http://sling.apache.org/site/manipulating-content-the-slingpostservlet-servletspost.html
> for docs.
> 
>> ... In the samples I read that it is possible to register a servlet inside 
>> Sling but I am not quite sure
>> how to do it
> 
> That would be a way, you could register a servlet to handle POST
> methods which contain JSON data, and use a JSON parser in there to get
> to the data. We have a simple parser in the commons/json bundle, [1].
> 
> To register servlets see http://sling.apache.org/site/servlets.html
> 
>> ...Could that be done with an ESP file instead?..

I would suggest for this to be an extension to the SlingPostServlet (if
at all possible). There is an issue for this: SLING-1172 [2]

Any patches welcome ...

Regards
Felix

> 
> Yes, scripts and servlets are equivalent.
> 
> -Bertrand
> 
> [1] 
> https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/json/src/main/java/org/apache/sling/commons/json/JSONObject.java
> 

[1]
http://cwiki.apache.org/SLING/faq.html#FAQ-HowdoIcreateanodebypostingajsondocumenttoaURL%3F
[2] https://issues.apache.org/jira/browse/SLING-1172


Re: Multi-value sling:alias

2010-01-27 Thread Felix Meschberger
Hi,

yes the intent is to support multiple aliases - at least for resolution.
But this is not implemented like this (yet) ...

Regards
Felix

On 27.01.2010 10:32, Vidar Ramdal wrote:
> The sling:alias property is defined as both a single-value and a
> multi-value String property [1], which, in my imagination, is a hint
> that you should be able to set multiple aliases for a resource.
> 
> This does not seem to work, and the code of the JcrResourceResolver
> seems to assume only single values [2].
> 
> So, is this a bug, or can a resource only have a single alias?
> 
> [1] 
> http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/resources/SLING-INF/nodetypes/mapping.cnd?view=markup#l32
> [2] 
> http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java?view=markup#l695
> 


Re: Rhino Javascript Debugger

2010-01-28 Thread Felix Meschberger
Hi,

On 28.01.2010 20:30, Vidar Ramdal wrote:
> Is anyone using this with Sling?
> There seems to have been some interest in it, e.g. SLING-678 [1] but
> I'm not finding any real usage examples.
> If anyone has experience in using the debugger with ESP scripts, I'd
> be interested in learning about it.

SLING-678 introduced a framework property to launch the debugger on the
server as soon as the Rhino ScriptEngineFactory is started. This is a
quick hack solution to be able to debug scripts.

Yet, this is of course not very scalable. A few years back we had an
implementation of a remote debugging support for Rhino, but this was for
the old Rhino Debugging API and is probably not compatible any more.

I think, it would be nice addition to have some support for remote Rhino
debugging. I once dreamed of an Eclipse plugin which hooks into the
launching infrastructure to be able to remote debug Rhino just like Java
can be remotely debugged.

Regards
Felix


Re: Rhino Javascript Debugger

2010-01-29 Thread Felix Meschberger


On 29.01.2010 09:45, Vidar Ramdal wrote:
> On Thu, Jan 28, 2010 at 8:56 PM, Felix Meschberger  wrote:
>> Hi,
>>
>> On 28.01.2010 20:30, Vidar Ramdal wrote:
>>> Is anyone using this with Sling?
>>> There seems to have been some interest in it, e.g. SLING-678 [1] but
>>> I'm not finding any real usage examples.
>>> If anyone has experience in using the debugger with ESP scripts, I'd
>>> be interested in learning about it.
>>
>> SLING-678 introduced a framework property to launch the debugger on the
>> server as soon as the Rhino ScriptEngineFactory is started. This is a
>> quick hack solution to be able to debug scripts.
> 
> Yes, I got the debugger console running, but now what?
> When I try to open any ESP file with it, it always fails with a syntax
> error - I guess the debug console don't support the script delimiters
> (<% %>)?
> 
>> Yet, this is of course not very scalable. A few years back we had an
>> implementation of a remote debugging support for Rhino, but this was for
>> the old Rhino Debugging API and is probably not compatible any more.
>>
>> I think, it would be nice addition to have some support for remote Rhino
>> debugging. I once dreamed of an Eclipse plugin which hooks into the
>> launching infrastructure to be able to remote debug Rhino just like Java
>> can be remotely debugged.
> 
> Sounds like a nice dream :)
> 


Re: Rhino Javascript Debugger

2010-01-29 Thread Felix Meschberger
Hi,

oops, clicked send to fast, sorry.

On 29.01.2010 09:45, Vidar Ramdal wrote:
> On Thu, Jan 28, 2010 at 8:56 PM, Felix Meschberger  wrote:
>> Hi,
>>
>> On 28.01.2010 20:30, Vidar Ramdal wrote:
>>> Is anyone using this with Sling?
>>> There seems to have been some interest in it, e.g. SLING-678 [1] but
>>> I'm not finding any real usage examples.
>>> If anyone has experience in using the debugger with ESP scripts, I'd
>>> be interested in learning about it.
>>
>> SLING-678 introduced a framework property to launch the debugger on the
>> server as soon as the Rhino ScriptEngineFactory is started. This is a
>> quick hack solution to be able to debug scripts.
> 
> Yes, I got the debugger console running, but now what?
> When I try to open any ESP file with it, it always fails with a syntax
> error - I guess the debug console don't support the script delimiters
> (<% %>)?

Yes, probably ... (didn't use it for ages)...

Regards
Felix

> 
>> Yet, this is of course not very scalable. A few years back we had an
>> implementation of a remote debugging support for Rhino, but this was for
>> the old Rhino Debugging API and is probably not compatible any more.
>>
>> I think, it would be nice addition to have some support for remote Rhino
>> debugging. I once dreamed of an Eclipse plugin which hooks into the
>> launching infrastructure to be able to remote debug Rhino just like Java
>> can be remotely debugged.
> 
> Sounds like a nice dream :)
> 


Re: Sling Bundle Project together with Integration Tests

2010-02-09 Thread Felix Meschberger
Hi,

I don't have such a POM set up.

A first approach I would test would be:

  * create your integration test classes in src/test/java
  * exclude the it classes from unit testing
  * package the it classes using the test-jar goal
excluding the regular unit test classes

In the integration test you would then include the generated test
package for the tests to run ...

Regards
Felix

On 09.02.2010 03:24, Andreas Schaefer wrote:
> Hi
> 
> After getting my first Sling bundle deployed and tested with an integration 
> test (more or less taken from what I found in the launchpad testing project) 
> I was wondering if it would be possible to have the bundle code and its test 
> code inside the same project / POM. Currently I need a second project in 
> order to build the web test environment and to run it. For now I am stuck 
> that the target/launchpad-bundles is not created.
> 
> Does anybody has a example POM to set that up if possible ?
> 
> Thanks - Andy Schaefer
> 


Re: Adding Multiple Nodes with the Same Name to the Same Parent

2010-02-15 Thread Felix Meschberger
Hi,

On 13.02.2010 23:59, Andreas Schaefer wrote:
> Hi
> 
> It might just me being stupid but I cannot figure out how someone would 
> create nodes with the same name for the same parent using POST (curl -F ...).
> 
> Curl does not accept [] and using the same name means updating the same node.
> 
> Thanks - Andy
> 

The SlingPostServlet does not support SNS (same name sibblings) at the
moment. While you might request an explicit name using something like

   curl -F:name=thename http://localhost:/the/parent/

to create nodes named /the/parent/thename, internally the collision will
be detected and for further calls indices will be generated, so using
the above command 5 times in a row will generate these nodes:

   /the/parent/thename
   /the/parent/thename_0
   /the/parent/thename_1
   /the/parent/thename_2
   /the/parent/thename_3

This is much like SNS with the "enhancement" that index numbers do not
change when a node is removed (like it is the case for SNS).

Regards
Felix


Re: FYI: MarkMail now indexes users@sling.apache.org

2010-02-16 Thread Felix Meschberger
Thanks for catching this !

Regards
Felix

On 16.02.2010 23:11, Vidar Ramdal wrote:
> The excellent MarkMail service has now started indexing this list.
> Both new and archive emails are searchable at
> http://sling.markmail.org.
> 
> -- Forwarded message --
> From: Eric Bloch 
> Date: Tue, Feb 16, 2010 at 8:09 PM
> Subject: Re: [MarkMail Feedback] Index users@sling.apache.org list
> 
> Hi there,
> 
> Our robots are catching new emails for this list and we've loaded up
> the existing archives for this list.
> I'd appreciate your letting the list and any other relevant places
> know - and a link is always appreciated.
> 
> See http://sling.markmail.org/
> 
> which will get you all 3 sling lists we index.
> 
> Best,
> Eric
> 
> 


Re: Provide initial configuration without using JCR Installer

2010-02-18 Thread Felix Meschberger
Hi,

If the repository is embedded, I would assume SLING-1282 [1] could be
your friend in this concrete case.

WDYT ?

Regards
Felix

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

On 18.02.2010 15:56, Vidar Ramdal wrote:
> Hi,
> 
> I need to provide som basic configuration properties for Sling
> bundles, most notably the admin username/password for the
> SlingServerRepository.
> 
> Since these configurations need to be available *before* the
> repository starts, I cannot rely on loading configuration files from
> JCR (as described at [1]).
> 
> Any suggestions?
> 
> [1] 
> http://sling.apache.org/site/jcr-installer-jcrjcrinstall-and-osgiinstaller.html
> 


Re: Provide initial configuration without using JCR Installer

2010-02-18 Thread Felix Meschberger
Hi,

On 18.02.2010 16:27, Justin Edelson wrote:
> On 2/18/10 9:56 AM, Vidar Ramdal wrote:
>> Hi,
>>
>> I need to provide som basic configuration properties for Sling
>> bundles, most notably the admin username/password for the
>> SlingServerRepository.
>>
>> Since these configurations need to be available *before* the
>> repository starts, I cannot rely on loading configuration files from
>> JCR (as described at [1]).
>>
>> Any suggestions?
>>
>> [1] 
>> http://sling.apache.org/site/jcr-installer-jcrjcrinstall-and-osgiinstaller.html
>>
> How about Felix's FileInstall:
> http://felix.apache.org/site/apache-felix-file-install.html

As an alternative we might want to provide (basic) Configuration Admin
support in the launcher ?? [Absolutely not sure about this, though !]

Regards
Felix


Re: Provide initial configuration without using JCR Installer

2010-02-19 Thread Felix Meschberger
Hi,

On 19.02.2010 10:17, Vidar Ramdal wrote:
>> On 18.02.2010 16:27, Justin Edelson wrote:
>>> On 2/18/10 9:56 AM, Vidar Ramdal wrote:
>>>> Hi,
>>>>
>>>> I need to provide som basic configuration properties for Sling
>>>> bundles, most notably the admin username/password for the
>>>> SlingServerRepository.
>>>>
>>>> Since these configurations need to be available *before* the
>>>> repository starts, I cannot rely on loading configuration files from
>>>> JCR (as described at [1]).
>>>>
>>>> Any suggestions?
>>>>
>>>> [1] 
>>>> http://sling.apache.org/site/jcr-installer-jcrjcrinstall-and-osgiinstaller.html
>>>>
>>> How about Felix's FileInstall:
>>> http://felix.apache.org/site/apache-felix-file-install.html
> 
> On Thu, Feb 18, 2010 at 4:38 PM, Felix Meschberger  wrote:
>> As an alternative we might want to provide (basic) Configuration Admin
>> support in the launcher ?? [Absolutely not sure about this, though !]
> 
> That sounds useful. Do you then imagine providing configurations as
> .properties files, which are picked up by the launcher?

That would be my idea, yes. Similar to the Apache Felix FileInstall
format ...

Regards
Felix

> 
> 


Re: Provide initial configuration without using JCR Installer

2010-02-19 Thread Felix Meschberger
Hi,

On 19.02.2010 10:41, Carsten Ziegeler wrote:
> Felix Meschberger wrote:
>> Hi,
>>
>> On 19.02.2010 10:17, Vidar Ramdal wrote:
>>>> On 18.02.2010 16:27, Justin Edelson wrote:
>>>>> On 2/18/10 9:56 AM, Vidar Ramdal wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I need to provide som basic configuration properties for Sling
>>>>>> bundles, most notably the admin username/password for the
>>>>>> SlingServerRepository.
>>>>>>
>>>>>> Since these configurations need to be available *before* the
>>>>>> repository starts, I cannot rely on loading configuration files from
>>>>>> JCR (as described at [1]).
>>>>>>
>>>>>> Any suggestions?
>>>>>>
>>>>>> [1] 
>>>>>> http://sling.apache.org/site/jcr-installer-jcrjcrinstall-and-osgiinstaller.html
>>>>>>
>>>>> How about Felix's FileInstall:
>>>>> http://felix.apache.org/site/apache-felix-file-install.html
>>> On Thu, Feb 18, 2010 at 4:38 PM, Felix Meschberger  
>>> wrote:
>>>> As an alternative we might want to provide (basic) Configuration Admin
>>>> support in the launcher ?? [Absolutely not sure about this, though !]
>>> That sounds useful. Do you then imagine providing configurations as
>>> .properties files, which are picked up by the launcher?
>>
>> That would be my idea, yes. Similar to the Apache Felix FileInstall
>> format ...
>>
> Hmm, this more and more sounds like redeveloping the file install stuff :)
> Isn't it possible to just use that?

I was thinking much the same, the second I clicked the send button ;-)

Maybe this is an option in the form of: launchpad unpacks its resources
in the file system already -- and instead of implementing our own bundle
installation/configuration we just configure a "private FileInstall
instance" to watch over this territory...

Thus dynamic update is then possible by dropping files there (in
addition to using JCR Install)...

But this might require some more work to be applied to File Install to
support our SNAPSHOT bundle update and start level support .. (or we
adapt to similar support of File Install, provided it exists already).

Regards
Felix
> 
> Carsten


Re: Modifying multi-value property with Ecmascript

2010-03-04 Thread Felix Meschberger
Hi,

On 04.03.2010 11:05, Erik Buene wrote:
> Hi
> 
> What is the best way to modify a multi-value property using ecmascript (.esp
> files)?
> 
> Was expecting something like this to work:
> 
> var arr = node.property;

This returns a JCR Property representiation (implemented internally by
ScriptableProperty). This is not an array in the EcmaScript sense.

> arr.push("added value");

Therefore this does not work.

> node.property = arr;

Not sure, whether this works at all at the moment.

Regards
Felix


> node.save();



> 
> And it doesn't produce errors, but the value does not seem to be modified in
> the repository.
> 
> The only way I have been able to do it is:
> 
> var arr = node.property;
> arr.push("added value");
> var valueMap =
> (resource.adaptTo(Packages.org.apache.sling.api.resource.PersistableValueMap));
> var stringArray = java.lang.reflect.Array.newInstance(java.lang.String,
> arr.length);
> for(var i =0; i stringArray[i] = new Packages.java.lang.String(arr[i]);
> }
> vm.put("property", stringArray);
> vm.save();
> 
> Surely, there must be a more practical way of doing this.
> 
> Best regards,
> Erik Buene
> 


Re: Modifying multi-value property with Ecmascript

2010-03-04 Thread Felix Meschberger
Hi,

On 04.03.2010 15:16, Erik Buene wrote:
> So the method I described as working is the best way to update multi-value
> properties using ecmascript?

Yes, for now this is so.

But in [1] on the dev@ list I reasoned about "fixing" this use case.

Regards
Felix

[1] http://markmail.org/message/nacovry3p5l3a2jx

> 
> Regards,
> Erik Buene
> 
> 2010/3/4 Felix Meschberger 
> 
>> Hi,
>>
>> On 04.03.2010 11:05, Erik Buene wrote:
>>> Hi
>>>
>>> What is the best way to modify a multi-value property using ecmascript
>> (.esp
>>> files)?
>>>
>>> Was expecting something like this to work:
>>>
>>> var arr = node.property;
>>
>> This returns a JCR Property representiation (implemented internally by
>> ScriptableProperty). This is not an array in the EcmaScript sense.
>>
>>> arr.push("added value");
>>
>> Therefore this does not work.
>>
>>> node.property = arr;
>>
>> Not sure, whether this works at all at the moment.
>>
>> Regards
>> Felix
>>
>>
>>> node.save();
>>
>>
>>
>>>
>>> And it doesn't produce errors, but the value does not seem to be modified
>> in
>>> the repository.
>>>
>>> The only way I have been able to do it is:
>>>
>>> var arr = node.property;
>>> arr.push("added value");
>>> var valueMap =
>>>
>> (resource.adaptTo(Packages.org.apache.sling.api.resource.PersistableValueMap));
>>> var stringArray = java.lang.reflect.Array.newInstance(java.lang.String,
>>> arr.length);
>>> for(var i =0; i>> stringArray[i] = new Packages.java.lang.String(arr[i]);
>>> }
>>> vm.put("property", stringArray);
>>> vm.save();
>>>
>>> Surely, there must be a more practical way of doing this.
>>>
>>> Best regards,
>>> Erik Buene
>>>
>>
> 


Re: sling release jars

2010-03-13 Thread Felix Meschberger
Hi,

On 13.03.2010 11:13, Bertrand Delacretaz wrote:
> Hi,
> 
> On Fri, Mar 12, 2010 at 5:42 PM, Andreas Kollegger
>  wrote:
>> What's the closest known-good list of jars that could constitute a current 
>> stable build of Sling?
> 
> The OBR at http://sling.apache.org/obr/sling.xml should be up to date
> with all latest versions.
> 
> Or the download page at http://sling.apache.org/site/downloads.cgi but
> it's currently broken (SLING-1425) - the static version at
> http://sling.apache.org/site/downloads.html shows current releases but
> you can't use it for downloading until we fix SLING-1425. Use
> http://apache.org/dyn/closer.cgi/sling in the meantime.

The downloads page should now be (finally) fixed.

Regards
Felix

> 
>>
>> I'm considering using the list.xml contained in the launchpad/builder 
>> project, but it uses many
>> snapshots. Despite that, it may be the best reference.
> 
> Yes, if you go back just one version from a snapshot that should point
> to the latest release. Releases have even version numbers, so the last
> release of foo-1.0.5-SNAPSHOT should be foo-1.0.4, unless for some
> reason we skipped that version number.
> 
> -Bertrand
> 


Re: Sling download page is down

2010-03-13 Thread Felix Meschberger
Hi

The downloads page should now be (finally) fixed.

Regards
Felix


On 12.03.2010 17:39, Bertrand Delacretaz wrote:
> Hi,
> 
> On Fri, Mar 12, 2010 at 5:09 PM, Michael Yin  wrote:
>> "You don't have permission to access /site/downloads.cgi on this server."
> 
> This was supposed to be fixed (SLING-1425) but apparently it's not.
> 
>>
>> Where should I download it from?
> 
> You can use http://apache.org/dyn/closer.cgi/sling in the meantime,
> and http://archive.apache.org/dist/sling/ for older releases.
> Those are the same releases than you'd get from the downloads page,
> just not as neatly presented.
> 
> -Bertrand
> 


Re: Sling DB ResourceProvider

2010-03-25 Thread Felix Meschberger
Hi,

On 25.03.2010 22:31, Luca Masini wrote:
> Hi, I wrote my thought about writing a ResourceProvider that let access
> Sling Resources on DB in a RESTful way:
> 
> http://www.lucamasini.net/Home/sling-and-cq5/accessing-relational-data-as-sling-restful-urls
> 
> Your feedback would be really appreciated.

Cool stuff. This is exactly one use case we had in mind when thinking
about the Resource stuff.

If have added a link to your blog on our links page [3] (if you don't mind).

And by the way, Sling actually already has a "BundleResourceProvider" [1].


In addtion we also have a FileSystemResourceProvider (provide files and
directories as resources) [2].

Regards
Felix

[1]
http://sling.apache.org/site/resources.html#Resources-BundlebasedResources
[2]
http://sling.apache.org/site/accessing-filesystem-resources-extensionsfsresource.html
[3] http://sling.apache.org/site/links.html


Re: Keeping Data Between Deployments

2010-03-30 Thread Felix Meschberger
Hi,

If you store everything in the repository, the repository is enough. If
you have special configuration created for and during the test which is
not recreated during the test run, you might also want to keep the
config directory.

Regards
Felix

On 30.03.2010 16:57, Carl Hall wrote:
> I've set up a nightly build environment that pushes out all of our team's
> changes for the day to our QA environment.  I would like to keep previous
> day's data from testing when this new deployment goes out.  Is it enough to
> keep just the jackrabbit/ dir inside of sling/ or is there more I need to be
> interested in?
> 


Re: JSONP Renderer implementation Pattern

2010-04-09 Thread Felix Meschberger
Hi,

On 09.04.2010 21:32, Justin Edelson wrote:
> Hmmm. You're right - I conflated extension with suffix.
> 
> On 4/9/10 3:10 PM, Luca Masini wrote:
>> Great, I never considered RequestDispatcherOptions and I think it's a
>> good idea.
>>
>> But with replaceSuffix I go into an infinity cycle, because the servlet
>> is choosen by the "jsonp" extension and not as a suffix:
>>
>> req.getRequestDispatcher(req.getResource().getPath(), new
>> RequestDispatcherOptions("replaceSuffix=json")).include(req, resp);
>>
>>
>> What is wrong with me ???
>>
>> Also, how can I associate a script like the one you showed to an
>> extension ??
> Create it at /apps/sling/servlet/default/jsonp.esp
> 
> It doesn't look like there's a way to override the extension via
> RequestDispatcherOptions. I guess what you can do is just hack the last
> letter off the path (assuming you're using jsonp as the extension). But
> now I have a bad taste...
> 
> I can't think of a good reason why this is the case. It seems like there
> should be a replaceExtension=json option.

You could to

   req.getRequestDispatcher(req.getResource.getPath()+".jsonp")

to overwrite the request extension.

But: we didn't do this by intent: Since we assume an expected content
type from the request extension changing the extension for request
processing might interfere with these expectations.

Now, what would hinder use to add support for JSONP in our JSON servlets
? We could, for example add JSONP servlets to the Default GET Servlet
bundle which internally use the existing servlets but add the padding.

Regards
Felix

> 
> Justin
> 
> 
> 
>>
>> Thank you for your help.
>>
>> On Fri, Apr 9, 2010 at 8:05 PM, Justin Edelson > > wrote:
>>
>> These two servlets are used in different contexts, so it makes sense
>> that you'd use different patterns for each of them. Your approach to the
>> JsonQueryServlet looks fine to me. For the renderer servlet, I would be
>> more inclined to create a script registered with the "jsonp" extension
>> which is basically this:
>>
>> <%= request.getParameter("jsonp") %>(<%
>> sling.include(resource.getPath(), "replaceSuffix=json") %>)
>>
>> Justin
>>
>> On 4/7/10 4:52 PM, Luca Masini wrote:
>> > Yes, that can be great, but I don't want to change Sling sources, only
>> > reuse them, that's why I asked about best practices.
>> >
>> > On Wed, Apr 7, 2010 at 9:58 PM, Justin Edelson
>> mailto:justinedel...@gmail.com>
>> > >>
>> wrote:
>> >
>> > We should probably just support jsonp natively in these servlets.
>> >
>> >
>> > On 4/7/10 2:05 PM, Luca Masini wrote:
>> > > Hi guys, I need an advice from Sling experts.
>> > >
>> > > I need a JSONP renderer for Sling, initially I thought I had to
>> > develop only
>> > > one, but after I discovered that in effect Sling has two
>> renderer
>> > for JSON,
>> > > one for plain resources and one for query.
>> > >
>> > > These two renderer are in private packages in a Sling
>> Bundle, and
>> > because
>> > > JSONP and JSON are quite equals and I wanted to reuse as much as
>> > possible, I
>> > > started thinking about strategies to call them.
>> > >
>> > > The JsonQueryServlet is deployed as an OSGi Component, so I was
>> > able to
>> > > inject it using Felix SCR Annotation (querying for his
>> > properties), and then
>> > > I called his service() method inside my doGet:
>> > >
>> > >  servlet.service(req, resp);
>> > >
>> > > For the JsonRendererServlet instead I used another strategy.
>> > >
>> > > I extracted the RequestPathInfo from the SlingHttpServletRequest
>> > and the I
>> > > included it using RequestDispatcher:
>> > >
>> > >  String jsonPath = calculateIt(req);
>> > >
>> > >  req.getRequestDispatcher(jsonPath).include(req, resp);
>> > >
>> > > Now both of these two are working, but I have a bad taste.
>> > >
>> > > Which of this is the best approach ?? The first ?? The second ??
>> > None of
>> > > them ???
>> > >
>> > >
>> >
>> >
>> >
>> >
>> > --
>> > 
>> > http://www.lucamasini.net
>> > http://twitter.com/lmasini
>> > http://www.linkedin.com/pub/luca-masini/7/10/2b9
>> > 
>>
>>
>>
>>
>> -- 
>> 
>> http://www.lucamasini.net
>> http://twitter.com/lmasini
>> http://www.linkedin.com/pub/luca-masini/7/10/2b9
>> 
> 
> 


Re: JSONP Renderer implementation Pattern

2010-04-09 Thread Felix Meschberger
Hi,

On 09.04.2010 22:45, Justin Edelson wrote:
> On 4/9/10 3:58 PM, Felix Meschberger wrote:
>> Hi,
>>
>> On 09.04.2010 21:32, Justin Edelson wrote:
>>> Hmmm. You're right - I conflated extension with suffix.
>>>
>>> On 4/9/10 3:10 PM, Luca Masini wrote:
>>>> Great, I never considered RequestDispatcherOptions and I think it's a
>>>> good idea.
>>>>
>>>> But with replaceSuffix I go into an infinity cycle, because the servlet
>>>> is choosen by the "jsonp" extension and not as a suffix:
>>>>
>>>> req.getRequestDispatcher(req.getResource().getPath(), new
>>>> RequestDispatcherOptions("replaceSuffix=json")).include(req, resp);
>>>>
>>>>
>>>> What is wrong with me ???
>>>>
>>>> Also, how can I associate a script like the one you showed to an
>>>> extension ??
>>> Create it at /apps/sling/servlet/default/jsonp.esp
>>>
>>> It doesn't look like there's a way to override the extension via
>>> RequestDispatcherOptions. I guess what you can do is just hack the last
>>> letter off the path (assuming you're using jsonp as the extension). But
>>> now I have a bad taste...
>>>
>>> I can't think of a good reason why this is the case. It seems like there
>>> should be a replaceExtension=json option.
>>
>> You could to
>>
>>req.getRequestDispatcher(req.getResource.getPath()+".jsonp")
> AFAICT, this won't work (and would need to be ".json" anyway) because
> you lose all the selectors. i.e.

Sure, this was just a no-brainer example ;-)

> 
> /foo/bar/res.tidy.jsonp (resource path = /foo/bar)
> should be a padded version of
> /foo/bar/res.tidy.json
> 
> but if you just replace tack on the extension to the resource path, it
> would be /foo/bar/res.json.
> 
> Obviously you could recreate the selectors if you needed to, but this is
> why it seems to me that replaceExtension would be useful. I see a typo
> in what I wrote... it should be:
> <%= request.getParameter("jsonp") %>(<% sling.include(resource,
> "replaceExtension=json") %>)
> 
>>
>> to overwrite the request extension.
>>
>> But: we didn't do this by intent: Since we assume an expected content
>> type from the request extension changing the extension for request
>> processing might interfere with these expectations.
> 
> Maybe I'm missing something, but how could it interfere?
> 
> If I have html.esp, what is the harm in being able to include the result
> of txt.esp or json.esp? The response content type is still text/html. I
> agree that this probably wouldn't be very common, but I don't see the harm.
> 
>>
>> Now, what would hinder use to add support for JSONP in our JSON servlets
>> ? We could, for example add JSONP servlets to the Default GET Servlet
>> bundle which internally use the existing servlets but add the padding.
> 
> Time ;)

Hehe.

Well, for the JsonQueryServlet it is probably even simpler (and amounts
to a four-some liner:

   if (request.getParameter("padding") != null) {
  response.write("padding(");
   }
   ... do the rest
   if (request.getParameter("padding") != null) {
  response.write(");");
   }

For the JsonRenderer, we might consider using a suffix or also a request
parameter.

Regards
Felix

> 
> Justin
> 
>>
>> Regards
>> Felix
>>
>>>
>>> Justin
>>>
>>>
>>>
>>>>
>>>> Thank you for your help.
>>>>
>>>> On Fri, Apr 9, 2010 at 8:05 PM, Justin Edelson >>> <mailto:justinedel...@gmail.com>> wrote:
>>>>
>>>> These two servlets are used in different contexts, so it makes sense
>>>> that you'd use different patterns for each of them. Your approach to 
>>>> the
>>>> JsonQueryServlet looks fine to me. For the renderer servlet, I would be
>>>> more inclined to create a script registered with the "jsonp" extension
>>>> which is basically this:
>>>>
>>>> <%= request.getParameter("jsonp") %>(<%
>>>> sling.include(resource.getPath(), "replaceSuffix=json") %>)
>>>>
>>>> Justin
>>>>
>>>> On 4/7/10 4:52 PM, Luca Masini wrote:
>>>> > Yes, that can be great, but I don't want to change Sling sources, 
>>>&g

Re: Changing extension with RequestDispatcherOptions

2010-04-09 Thread Felix Meschberger
Hi,

On 09.04.2010 23:09, Luca Masini wrote:
> Hi, I'm asking why the RequestDispatcherOptions is designed not to allow the
> changing of the extension.

The idea was, that the extension conveys intents of the requester
regarding the content type of the response. We thought that we should
not allow for overwriting this intent while handling the request.

(yet using the request dispatcher in creative ways, we cannot prevent
this from happening)

> 
> I also saw in the merge method of the SlingRequestPathInfo that the
> extension is taken from the instance variable and I can't merge with a
> changing extension.
> 
> What would be wrong in a request that change extension ??
> 

We also found that it might be helpful to have this extension on one or
two occasions, but never actually did it.

Might be a good point in time to reconsider ...

Regards
Felix


Fwd: [NOTICE] compromised jira passwords

2010-04-10 Thread Felix Meschberger
Hi all Sling contributors and users,

If you've used our issue tracker during this past week, please reset
your password! See details below.

Regards
Felix


 Original Message 
Subject: [NOTICE] compromised jira passwords
Date: Sat, 10 Apr 2010 10:24:14 -0700 (PDT)
From: Joe Schaefer 
Reply-To: commun...@apache.org
To: commun...@apache.org

Hello Apache community@ [1],

As you are probably aware we have been working to restore services
that have been compromised by a very targetted attack against Apache's
jira installation.  The good news is that jira is back online, with
bugzilla and confluence soon to follow [2].  The bad news is that the
hacker was able to rejigger jira's code to sniff any cookies and
passwords sent to the server between April 6 and April 9.  If you
used jira at all this week, including via IDE's that interface via
SOAP, it is IMPERATIVE that you take time to immediately reset your
jira password, and possibly your ldap password if those match up.
If you have admin privs in jira your password was reset by us, so
you'll need to use the password reset form in jira to regain access.

To have a reset password mailed to your contact information in jira,
visit

https://issues.apache.org/jira/secure/ForgotPassword!default.jspa

When you do login to jira be sure to double-check your contact info.

To change your ldap password login to people.apache.org and run
/usr/sbin/passwd, or else visit https://svn.apache.org/change-password
.

Thanks for your patience and diligence in this matter.  A blog post
will be forthcoming which will provide details of the attack and
what we have done to mitigate future hack attempts.


[1] feel free to forward this note to any other apache mailing list,
public or private.

[2] at this time we do not believe the hacker compromised the confluence
and bugzilla installs, but we are awaiting confirmation from our admins
before bringing those back online.





-
To unsubscribe, e-mail: community-unsubscr...@apache.org
For additional commands, e-mail: community-h...@apache.org




Re: Sling on GAE

2010-04-14 Thread Felix Meschberger
Hi,

On 14.04.2010 22:34, Luca Masini wrote:
> I think there are no chances to run JackRabbit on GAE, for now, and less
> that I can persuade them to let application create thread or files :)
> 
> But I'm happy to read that for you too can be a way to use Sling directly,
> may be using a ResourceResolver on top of the DataStore or implementing a
> simple Level 1 JCR Repository.
> 
> That can be a way ???

Well, unless Google removes the Thread creation restriction, there is no
way of running Sling (or Jackrabbit by that matter) on GAE. Sad, but true.

Now for accessing google store: It may well be possible (and depending
on use cases) simpler to implement a ResourceProvider for DataStore than
it is to implement a Repository backend.

In fact, hard requirements on JCR is very limited (though important) in
Sling. One is the Sling POST Servlet and another one is the class writer
which is used to write back JSP class files.

But there are discussions around completing support for basic CRUD. What
we currently have is read support (of course ;-) ) and update support by
means of the PersistableValueMap. We are missing support to create
resources and to remove resources.

Regards
Felix

> 
> On Wed, Apr 14, 2010 at 9:51 PM, Alexander Klimetschek 
> wrote:
> 
>> On Wed, Apr 14, 2010 at 20:00, Luca Masini  wrote:
>>> I would love to use Sling to access the Google Data Store and program
>> user
>>> interface in an easy way. Now I know that, due to limitations on the GAE
>>> environment this will be really hard (I don't know how to make Felix run
>> on
>>> there without writing files or launching threads), so I want to discuss
>> this
>>> with Sling experts and know what do you think about the idea and if is
>>> something doable.
>>
>> So you would want to use Sling directly on top of the Google Data
>> Store and not use JCR? In theory this should be possible, but might
>> require additional work besides the basic issues like multiple
>> threads, running an OSGi framework etc. Many things in Sling work
>> based on a JCR repository. You can build a resource tree based on
>> other backends, but this is a bit like reinventing the wheel.
>>
>> If JCR should be used as well on GAE below Sling, this also requires
>> changes to Jackrabbit: first a datastore/persistence manager using the
>> google data store as backend and secondly removing all background
>> threads in Jackrabbit. See also
>> http://wiki.apache.org/jackrabbit/JackrabbitOnCloud or the discussion
>> at http://markmail.org/thread/n4redkdzyxaval7r
>>
>> I think it would be easier if the GAE guys would remove some of the
>> constraints to allow for infrastructure apps. Maybe you can persuade
>> them ;-)
>>
>> Regards,
>> Alex
>>
>> --
>> Alexander Klimetschek
>> alexander.klimetsc...@day.com
>>
> 
> 
> 


Re: Document "no property changes on move or copy"?

2010-04-20 Thread Felix Meschberger
Hi,

On 30.03.2010 22:15, Ray Davis wrote:
> All operations performed by the SlingPostServlet are mutually exclusive.
> In particular, a request which moves a node or copies a node cannot
> change or add a property of that node.
> 
> For example:
> 
> curl -u admin:admin -F ":operation"=move \
>   -F ":dest"="/content/anotherpath" \
>   -F myprop=newval \
>   http://localhost:8080/content/mynode

The question here is: where do you want to the myprop property be set ?
on the /content/mynode node (which is being moved away, but is the
official target) or the new /content/anotherpath node ?

But, the default operation supports your use case:

  curl -u admin:admin \
   -F "anotherp...@movefrom=mynode" \
   -F "anotherpath/myprop=newval" \
   http://localhost:8080/content

Regards
Felix

> curl -u admin:admin http://localhost:8080/content/anotherpath.json
> # {"myprop":"oldval","jcr:primaryType":"nt:unstructured"}
> 
> When I stop to think about it, this seems OK. But since it's not
> completely obvious at first glance and since ignored properties aren't
> called out in log messages, would someone with site edit access mind
> documenting the restriction at
> "http://sling.apache.org/site/manipulating-content-the-slingpostservlet.html";?

I added this to the site:

Please note that operations are mutually exclusive. For a single
POST request only one operation may be executed. Operations also
only consume the request parameters as described below. Any excess
parameters are silently ignored.

Regards
Felix

> 
> 
> Thanks,
> Ray
> 


Re: NPE with Auth Handler

2010-04-20 Thread Felix Meschberger
Hi,

I would say, this is a highly unlikely and unexpected situation: The
handler field of the EngineAuthenticationHandlerHolder should not be null.

There is a slight chance of this happen anyway: If the service cannot be
retrieved from the framework (because it has already been unregistered
at the time the service is asked for which may happen in a highly
dynamic situation).

Added a guard to not register the handler if the service cannot be
retrieved. [1]

Regards
Felix

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

On 19.04.2010 18:05, Carl Hall wrote:
> I get the following stacktrace when I try to go through an authentication
> handler I have setup.  Any suggestions to the cause?
> 
> 19.04.2010 11:42:47.604 *WARN* [116647...@qtp-1246618622-16]
> org.mortbay.jetty EXCEPTION  java.lang.NullPointerException
> at
> org.apache.sling.commons.auth.impl.engine.EngineAuthenticationHandlerHolder.doExtractCredentials(EngineAuthenticationHandlerHolder.java:63)
> at
> org.apache.sling.commons.auth.impl.AbstractAuthenticationHandlerHolder.extractCredentials(AbstractAuthenticationHandlerHolder.java:60)
> at
> org.apache.sling.commons.auth.impl.SlingAuthenticator.getAuthenticationInfo(SlingAuthenticator.java:560)
> at
> org.apache.sling.commons.auth.impl.SlingAuthenticator.handleSecurity(SlingAuthenticator.java:374)
> at
> org.apache.sling.engine.impl.SlingMainServlet.handleSecurity(SlingMainServlet.java:832)
> at
> org.ops4j.pax.web.service.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:62)
> at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
> at
> org.ops4j.pax.web.service.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
> at
> org.ops4j.pax.web.service.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
> at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> at org.mortbay.jetty.Server.handle(Server.java:324)
> at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535)
> at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:865)
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
> at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> at
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
> 


Re: Getting Resolved files

2010-04-26 Thread Felix Meschberger
Hi,

On 23.04.2010 21:20, Jason Chen wrote:
> Hi everyone,
> 
> I just recently started using Sling so I have a few questions that I have to
> ask.
> 
> Is it possible for curl to specify a MIME type and have Sling resolve the
> file for me when I choose to GET it?
> 
> For example,
> I have a html page at http://localhost:8080/content/mynode/testing.html
> 
> If I were to ask curl to get a file of mime type text/html, and specify the
> url to be at http://localhost:8080/content/mynode/testing, will Sling know
> that I am talking about testing.html?

I assume you specify the text/html requested MIME type in the Accept
request header ?

No, support for the Accept header to resolve a request's resource is not
implemented at the moment.

Regards
Felix

> 
> Thanks,
> Jason Chen
> 


Re: Concurrency-Problem in jackrabbit-server AccessManagerFactoryTracker

2010-04-26 Thread Felix Meschberger
Hi,

You are perfectly right.

Do you mind creating an issue at [1]

Thanks and Regards
Felix

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

On 26.04.2010 15:25, Markus Blaurock wrote:
> Hello,
> 
> if i have read the source-code correctly then
> there is a concurrency-problem in the "consumer"-HashSet property
> of class AccessManagerFactoryTracker.
> 
> Racing-conditions now exits when jcr-sessions get created simultaneusly.
> 
> Am i right and did somebody experience the same problem? Threads will
> hang in the
> getFactory() method of this class, as observed with jconsole.
> 
> I fixed it by commenting out the PluggableDefaultAccessManager in
> repository.xml, and
> it seems to work.
> 
> Will i have problems with this fix, besides not being able to plugin my
> own AccessManager into JR?
> 
> 
> thanks,
> Markus
> 
> 


Re: Concurrency-Problem in jackrabbit-server AccessManagerFactoryTracker

2010-04-26 Thread Felix Meschberger
Thanks.
Felix

On 26.04.2010 16:16, Markus Blaurock wrote:
> Hi,
> 
> issue created. [1]
> 
> thx,
> markus
> 
> [1] https://issues.apache.org/jira/browse/SLING-1502
> 
> 
> Felix Meschberger schrieb:
>> Hi,
>>
>> You are perfectly right.
>>
>> Do you mind creating an issue at [1]
>>
>> Thanks and Regards
>> Felix
>>
>> [1] https://issues.apache.org/jira/browse/SLING ?
>>
>> On 26.04.2010 15:25, Markus Blaurock wrote:
>>   
>>> Hello,
>>>
>>> if i have read the source-code correctly then
>>> there is a concurrency-problem in the "consumer"-HashSet property
>>> of class AccessManagerFactoryTracker.
>>>
>>> Racing-conditions now exits when jcr-sessions get created simultaneusly.
>>>
>>> Am i right and did somebody experience the same problem? Threads will
>>> hang in the
>>> getFactory() method of this class, as observed with jconsole.
>>>
>>> I fixed it by commenting out the PluggableDefaultAccessManager in
>>> repository.xml, and
>>> it seems to work.
>>>
>>> Will i have problems with this fix, besides not being able to plugin my
>>> own AccessManager into JR?
>>>
>>>
>>> thanks,
>>> Markus
>>>
>>>
>>> 
> 
> 
> mit freundlichen Grüßen
> Markus Blaurock
> 



Re: RMM: Rest Maturity Model

2010-04-26 Thread Felix Meschberger
Hi,

On 26.04.2010 15:22, Justin Edelson wrote:
> On 4/26/10 5:27 AM, Luca Masini wrote:
>> I read a month ago a post by Martin Fowler regarding the maturity levels of
>> REST (http://martinfowler.com/articles/richardsonMaturityModel.html).
>>
>> I thougth a lot about Sling and I think that Sling is a Level 3 Maturity
>> Model because
>> 1) Use resources (level 1)
>> 2) Use HTTP verbs (apart from some piggybacking in PostServlet) (level 2)
>> 3) Has HyperMedia control (level 3)
> Frankly, I'm not sure we do enough with respect to Level 3/Hypermedia.
> For example, adding link support in the JSON renderer.

How would we do that ? Can we at all ?

Regards
Felix

> 
> Justin
> 
>>
>> Do you agree ??
>>
>>
> 
> 


Re: A little confused..

2010-05-06 Thread Felix Meschberger
Hi Tony,

On 06.05.2010 21:25, Tony Giaccone wrote:
> 
> 
> I'm trying to understand the differences between sling and jackrabbit.  I 
> understand that Jackrabbit is the underlying content repository that sling 
> uses. 

Yes, Sling is a (Web) Application Framework for Java Content
Repositories (JCR).

Jackrabbit is an implementation of the Java Content Repository API
specification.

As such, Sling uses Jackrabbit as its repository for storage.

> 
> As I read through the jackrabbit wiki, it seems clear that there's a database 
> behind jackrabbit, that holds information about the documents that are being 
> stored in the repository.

Well, since Jackrabbit stores data, it must store the data somewhere. To
this avail Jackrabbit uses persistence managers. There exist various
persistence managers, most actually store the data in a database,
actually only one or two tables in such a database.

> 
> However, as I read through the sling docs, there's not much that discusses 
> the need for this database, is the because the sling distribution assumes 
> there is a jackrabbit server installed somewhere and that part of the 
> configuration of sling is to connect it to a JSR 170 Repository? 

Sling just writes to the repository using the JCR API and does not care,
what actual backend storage is used. Out of the box, Sling comes with an
embedded Jackrabbit repository which happens to use Derby as its
persistence database.

But since this is an implementation (or even an administrative) detail
of Jackrabbit, Sling does not care, does not know and does not document
this. Sling just cares for a proper implementation of the JCR API available.

Hope this helps.

Regards
Felix
> 
> Or is sling using some other kind of persistent store to hold document 
> information? 
> 
> 
> 
> Tony


Re: Integration of Vaadin and Sling

2010-05-06 Thread Felix Meschberger
Hi,

On 06.05.2010 22:56, Christian Sprecher wrote:
> Hey guys
> 
> Is anybody interested in integrating Vaadin (http://vaadin.com/home)
> with Sling?

That would be very interesting, indeed. So if you have any information
to share, you are welcome to update the Wiki.

> Vaadin itself is already an OSGI bundle, but what I am stuck
> now is how to integrate the Vaadin Servlet with Sling, to be able to
> handle Vaadin applications. Next step would of course be to have those
> Vaadin apps in Groovy, but first things first

IIRC Vaadin is in fact based on GWT and for GWT there are a few sample
projects in our SVN.

Re the Vaadin Servlet: What you probably essentially have to do is
register the Vaadin Servlet as a Sling Servlet Service such that Sling
can call into it to handle Vaadin requests.

Sorry, to not be of a better help.

Regards
Felix

> 
> Thx for some hints


> 
> CSp
> 
> 
> 


Re: A little confused..

2010-05-11 Thread Felix Meschberger
Hi,

On 11.05.2010 09:47, Bertrand Delacretaz wrote:
> On Fri, May 7, 2010 at 1:59 AM, Justin Edelson  
> wrote:
>> ...There's documentation on the JR site about clustering configuration.
>> We don't have anything specific to this on the Sling site AFAIK, but this 
>> isn't to
>> say we shouldn't
> 
> What we have in Sling is the contrib/jcr/jackrabbit-client module,
> which can be used to access a separately configured Jackrabbit
> repository via JNDI or RMI. I wouldn't recommend the latter for
> performance reasons, but with JNDI you can configure/scale Jackrabbit
> independently of Sling, and use it from Sling applications.

Agreed for not connecting Sling to a repository over RMI. This just will
make you cry ;-)

Yet, I do not agree about using JNDI: You will most probably be best off
in terms of maintenance and management if you would run Jackrabbit
embedded in the same OSGi Framework as Sling.

You still can tune Jackrabbit "independent" of Sling, actually, your are
force to tune Jackrabbit out-of-band because Jackrabbit is configured by
its own configuration files found in the jackrabbit folder.


Regards
Felix


> 
> That bundle is meant to be used instead of the
> bundles/jcr/jackrabbit-server one which embeds a Jackrabbit repository
> with a basic configuration.
> 
> -Bertrand
> 


Re: authenticationHandler.activate

2010-05-21 Thread Felix Meschberger
Hi,

On 21.05.2010 10:41, Jos Snellings wrote:
> Hi!
> 
> When does SCR call an authentication handler that has been added as a
> bundle?
> 
> I added:
>  * @scr.component immediate="false" label="%auth.slave.name"
>  *description="%auth.slave.description"
> 
> in analogy with the formauth example, but activate never gets called :-(
> What is supposed to trigger it?

SCR will activate this component when a user of the service requests the
service. For this to work, your component must be declared as a service,
in this case probably with something like:

  @scr.service
interface="org.apache.sling.commons.auth.spi.AuthenticationHandler"

Otherwise the Sling authenticator will not recognize the handler and the
component will never be authenticated.

BTW: the setting immediate="false" is only valid if at least one
@scr.service tag is declared.

Hope this helps.

Regards
Felix

> 
> Cheers,
> Jos
> 
> 


Re: authenticationHandler.activate

2010-05-21 Thread Felix Meschberger
Hi,

On 21.05.2010 16:55, Jos Snellings wrote:
> 
> In fact I had a src.service...
> In addition I chose a service ranking of 100 and "/" as path.

A positive value has actual less priority. Thus if there is a handlr for
"/" with negative or zero (aka default) ranking, your authentication
handler will never be considered and thus never be used and thus never
be activated.

I assume you want to assign higher priority, thus I would suggest to set
the service.ranking service property to a negative value.

Regards
Felix

> But this authenticationHandler just never seems to be activated.
> What else could be missing?
> 
> * @scr.component immediate="false" label="%auth.slave.name"
>  *description="%auth.slave.description"
>  *
>  * @scr.property name="service.description"
>  *   value="Slave Authentication Handler"
>  * @scr.property name="service.vendor" value="Upperware GmbH"
>  * @scr.property nameRef="AuthenticationHandler.PATH_PROPERTY" value="/"
>  * @scr.service
> interface="org.apache.sling.commons.auth.spi.AuthenticationHandler"
> 
> On Fri, 2010-05-21 at 14:31 +0200, Felix Meschberger wrote:
>> SCR will activate this component when a user of the service requests the
>> service. For this to work, your component must be declared as a service,
>> in this case probably with something like:
>>
>>   @scr.service
>> interface="org.apache.sling.commons.auth.spi.AuthenticationHandler"
>>
>> Otherwise the Sling authenticator will not recognize the handler and the
>> component will never be authenticated.
>>
>> BTW: the setting immediate="false" is only valid if at least one
>> @scr.service tag is declared.
>>
>> Hope this helps.
>>
>> Regards
>> Felix
>>
>>>
>>> Cheers,
>>> Jos
>>>
>>>
>>
> 
> 
> 


Re: Vaadin Script Resolution

2010-05-28 Thread Felix Meschberger
Hi Christian,

> How can I enforce to have *everything* starting with '/VAADIN'
> beeing handled by a specific servlet?

This is not possible at the moment. The resource resolver does not split
the path at slashes, but at dots. The idea is, that each request has at
least an extension.

So if you set your request prefix to, say, VAADIN.vaadin and register
your servlet to handle requests with the extension "vaadin", the servlet
resource would be resolved.

Hope this helps.

Regards
Felix


On 26.05.2010 17:00, Christian Sprecher wrote:
> Hi all
> 
> Vaadin (vaadin.org) request its client side stuff via for example via
> URLs like e.g.
> 
> http://localhost:8080/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js?1274885408542
> 
> 
> I would like to serve those resources via a separate servlet.
> Configuring the servlet with @scr.property name="sling.servlet.paths"
> value="/VAADIN" works ok for e.g. GETing URLs starting with /VAADIN. But
> above URL is not resolved to this servlet, see Exception Info:
> 
> 0 (2010-05-26 16:51:18) TIMER_START{Request Processing}
>  0 (2010-05-26 16:51:18) COMMENT timer_end format is { msec>,} 
>  0 (2010-05-26 16:51:18) LOG Method=GET,
> PathInfo=/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js
> 
>  0 (2010-05-26 16:51:18) TIMER_START{ResourceResolution}
>193 (2010-05-26 16:51:19) TIMER_END{193,ResourceResolution}
> URI=/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js
> resolves to Resource=NonExistingResource,
> path=/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js
> 
>193 (2010-05-26 16:51:19) LOG Resource Path Info:
> SlingRequestPathInfo:
> path='/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js',
> selectorString='vaadin.terminal.gwt', extension='DefaultWidgetSet',
> suffix='/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js'
>193 (2010-05-26 16:51:19) TIMER_START{ServletResolution}
>193 (2010-05-26 16:51:19)
> TIMER_START{resolveServlet(NonExistingResource,
> path=/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js)}
> 
>193 (2010-05-26 16:51:19)
> TIMER_END{0,resolveServlet(NonExistingResource,
> path=/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js)}
> Using servlet org.apache.sling.servlets.get.DefaultGetServlet
>193 (2010-05-26 16:51:19) TIMER_END{0,ServletResolution}
> URI=/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js
> handled by Servlet=org.apache.sling.servlets.get.DefaultGetServlet
>193 (2010-05-26 16:51:19) LOG Applying request filters
>194 (2010-05-26 16:51:19) LOG Calling filter:
> org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter
>194 (2010-05-26 16:51:19)
> TIMER_START{org.apache.sling.servlets.get.DefaultGetServlet#0}
>194 (2010-05-26 16:51:19)
> TIMER_END{0,org.apache.sling.servlets.get.DefaultGetServlet#0}
>194 (2010-05-26 16:51:19) TIMER_START{handleError:status=404}
>210 (2010-05-26 16:51:19) TIMER_END{16,handleError:status=404} Using
> handler
> org.apache.sling.servlets.resolver.internal.defaults.DefaultErrorHandlerServlet
> 
>211 (2010-05-26 16:51:19) TIMER_END{211,Request Processing} Dumping
> SlingRequestProgressTracker Entries
> 
> You can see that the URL is decomposed into path, selector and extension
> and then mapped to the default servlet. How can I enforce to have
> *everything* starting with '/VAADIN' beeing handled by a specific servlet?
> 
> Thx in advance
> 
> CSp
> 
> 


Re: authentication against trusted party

2010-06-02 Thread Felix Meschberger
Hi,

On 02.06.2010 06:12, Jos Snellings wrote:
> Dear,
> 
> I am confronted with the following use cases:
> 1. sling app needs to authenticate with a nearby (same server) webapp.
> No anonymous access allowed.
> => I created 'proxyauthenticator' for this:
>* anonymous requests are forwarded to the trused webapps
> login
>* trusted webapp places short (30 sec) session entry in a
> shared DB table upon
>   successful login
>* trusted webapp causes authenticated web client to
> request menu options from
>  sling app with this short session ID
>* proxyauthenticator picks this ID up, authenticates the
> user, and clears the entry from the table

Looks like you try to reinvent OpenID. How about implementing an OpenID
provider on the "trusted webapp" server ?

> 
> 2. sling app needs to authenticate with organisation's LDAP server
> 
> I have following questions:
> - for proxyAuthenticationHandler, is it alright if extractCredentials
> calls requestCredentials directly if no
>   valid credentials exist in the session?

Yes, in this case extractCredentials should return
AuthenticationInfo.DOING_AUTH to indicate credentials have already been
requested.

Yet, I would probably not do so but rather have the SlingAuthenticator
first try to find another authentication handler and only if none
provide credentials have the SlingAuthenticator select an authentication
handler and call its requestCredentials method.

> - proxyauthenticator is being written as a proof of concept, is there
> interest in adopting it in the sling trunk after peer review?

If its just duplicating OpenID functionality, we would have to see. If
it is a real LDAP-based authentication handler, most probably yes; but
see below for more flesh to the LDAP-bone.

> - these two 'trusted party' authentication mechanisms, are about the
> mechanism only. SlingAuthenticator's
>   handleSecurity will inevitably try to get a JCR session for the
> provided credentials... and this brings a complication:
>   the account must exist locally in the JCR repository.
>   Is there a way to obtain an even tighter integration? Would that imply
> a sort of synchronisation between the accounts on
>   trusted app and sling app?

Yes, definitely so and there are multiple options.

One option (which we at Day chose for integration of LDAP servers with
Day's CRX product) is to actually implement a Jackrabbit LoginModule
which is able to synchronize the user base with the LDAP server
on-demand. This LoginModule will (1) authenticate the Credentials with
the LDAP server (generally doing an LDAP bind) and (2) will
automatically create a local JCR Repository used based on data requested
from the LDAP server.

In fact, doing an LDAP LoginModule, would allow Sling to not require
contacting the authenication server at all. Instead you could use the
normal form based login handler which provides user name and password in
the JCR Credentials to the repository where the repository will then use
these credentials to check with the LDAP server.

The other option would be to have the Sling authentication handler
validate the credentials with the LDAP server (e.g. using LDAP bind) and
use Jackrabbit user management functionality to create the users on
demand if need be. This login handler would then have to use the
"trusted credentials" mechanism also used by the OpenID login module to
authenticate with the repository.

For the LDAP case, I would actually prefer the first option of writing a
LoginModule able to synchronize with the LDAP server on-demand.

Hope this helps.

Regards
Felix


Re: authentication against trusted party

2010-06-02 Thread Felix Meschberger
Hi,

On 02.06.2010 10:39, Jos Snellings wrote:
> Thank you for your very informative reply, Felix.
> I understand openID, but this is not what I need to do. My use case is:
> the customer organisation has a number of user accounts. They are in
> a web application. My customer does not use openID and does not want to.
> In order for my solution to be accepted it must work with that existing
> mechanism,
> and this integration must be really tight, even seamless.

ok. then you certainly could do that with a Sling AuthenticationHandler.

What I suggest to add in some "caching" (e.g. a cookie or so) to not
have to redirect the user on each request. To then actually access the
repository, you could do a PluggableLoginModule or leverage the "trusted
credentials" functionality of the Jackrabbit DefaultLoginModule.

BTW: of course we would be very interested in hearing about your user story.

> 
> As for with LDAP, I follow you in that a Login module is best, and, I
> think,
> based upon earlier experience the sync between JackRabbit user base and
> LDAP would best happen on demand.
> 
> As for the second solution: authenticationHandler should look up if the
> account exist,
> and create it if it does not: at that point, would the thread executing
> this code have
> the necessary privileges to insert a new user?

If the authentication handler gets an administrative session
(independent of the actual request), that session could be used to
synchronize the user.

Regards
Felix

> 
> Cheers,
> Jos
> 
> On 06/02/2010 09:57 AM, Felix Meschberger wrote:
>> Hi,
>>
>> On 02.06.2010 06:12, Jos Snellings wrote:
>>   
>>> Dear,
>>>
>>> I am confronted with the following use cases:
>>> 1. sling app needs to authenticate with a nearby (same server) webapp.
>>> No anonymous access allowed.
>>>  =>  I created 'proxyauthenticator' for this:
>>> * anonymous requests are forwarded to the trused webapps
>>> login
>>> * trusted webapp places short (30 sec) session entry
>>> in a
>>> shared DB table upon
>>>successful login
>>> * trusted webapp causes authenticated web client to
>>> request menu options from
>>>   sling app with this short session ID
>>> * proxyauthenticator picks this ID up, authenticates the
>>> user, and clears the entry from the table
>>>  
>> Looks like you try to reinvent OpenID. How about implementing an OpenID
>> provider on the "trusted webapp" server ?
>>
>>   
>>> 2. sling app needs to authenticate with organisation's LDAP server
>>>
>>> I have following questions:
>>> - for proxyAuthenticationHandler, is it alright if extractCredentials
>>> calls requestCredentials directly if no
>>>valid credentials exist in the session?
>>>  
>> Yes, in this case extractCredentials should return
>> AuthenticationInfo.DOING_AUTH to indicate credentials have already been
>> requested.
>>
>> Yet, I would probably not do so but rather have the SlingAuthenticator
>> first try to find another authentication handler and only if none
>> provide credentials have the SlingAuthenticator select an authentication
>> handler and call its requestCredentials method.
>>
>>   
>>> - proxyauthenticator is being written as a proof of concept, is there
>>> interest in adopting it in the sling trunk after peer review?
>>>  
>> If its just duplicating OpenID functionality, we would have to see. If
>> it is a real LDAP-based authentication handler, most probably yes; but
>> see below for more flesh to the LDAP-bone.
>>
>>   
>>> - these two 'trusted party' authentication mechanisms, are about the
>>> mechanism only. SlingAuthenticator's
>>>handleSecurity will inevitably try to get a JCR session for the
>>> provided credentials... and this brings a complication:
>>>the account must exist locally in the JCR repository.
>>>Is there a way to obtain an even tighter integration? Would that
>>> imply
>>> a sort of synchronisation between the accounts on
>>>trusted app and sling app?
>>>  
>> Yes, definitely so and there are multiple options.
>>
>> One option (which we at Day chose for integration of LDAP servers with
>> Day's CRX product) is to actually implement a Jackrabbit LoginModule
>> which is able to synchronize the user base with the LDAP server
>> on-dem

Re: HTTP Digest Authentication with Sling

2010-06-04 Thread Felix Meschberger
Hi,

On 04.06.2010 13:52, Alexander Klimetschek wrote:
> Hi all,
> 
> (sorry for cross-posting)
> 
> did anyone implement a Sling AuthenticationHandler for HTTP digest
> auth already (or at least looked into it)?

Not to my knowledge.

I am not sure, whether this is easy to achieve given the algorithm
description for HTTP digest authentication and not knowing the plain
text password on the server side.

Regards
Felix


Re: HTTP Digest Authentication with Sling

2010-06-04 Thread Felix Meschberger
Hi,

On 04.06.2010 15:20, Alexander Klimetschek wrote:
> On Fri, Jun 4, 2010 at 14:34, Felix Meschberger  wrote:
>> I am not sure, whether this is easy to achieve given the algorithm
>> description for HTTP digest authentication and not knowing the plain
>> text password on the server side.
> 
> True, but in my case a custom jackrabbit LoginModule would be present
> anyway, syncing users (and their password's md5s) from an external
> system.

As you said "password's md5": This is IIUIC the problem. Doesn't digest
auth need to know the plaintext password to be able to generate the
challenge ?

Also, once you hit the LoginModule throught Repository.login there is no
chance to get back at the client to ask for credentials. So your
authentication handler needs to be able to access user password upfront
before going to the login module and indicate a pre-authenticated request.

Regards
Felix

> 
> Regards,
> Alex
> 


Re: What is the process

2010-06-04 Thread Felix Meschberger
Hi Tony,

On 04.06.2010 15:53, Anthony Giaccone wrote:
> 
> 
> I want to deploy a production level sling system. To do that I have to
> go beyond what's offered in the launchpad.

Basically the launchpad should get your started with just about anything
you might need for your application.

> 
> I want to install jackrabbit as a stand alone war file.
> 
> Then link sling to talk to that instance of jackrabbit.

I personally think that running Jackrabbit embedded in Sling is the best
option from the perspective of systems management, ease of use,
performance etc.

And if you are not required to use a specific servlet container, I would
go for the Sling standalone application which has quite nice start/stop
control (run java -jar org.apache.sling.launchpad.app-5-incubator.jar
-help to get a list of command line options for the standalone application).

> 
> 
> First is this a reasonable way to do the deploy? Second, how do I do that?

You can deploy Sling and Jackrabbit as two separate web applications in
the same servlet container, but I would not recommend it, because it
brings close to no value and is complicated to set up.

If you still want to go that route, you have to:

  * put the jcr.jar and jackrabbit-api.jar into a shared class laoder
of the servlet container
  * configure Sling to use the JCR and Jackrabbit API using
bootclassloading
  * replace the Embedded Jackrabbit bundle by the Client Jackrabbit
bundle
  * Ensure the Sling Client Jackrabbit bundle can access the the
repository through JNDI (see jackrabbit docs for more information).

Regards
Felix

> 
> 
> Is there a document that describes how to set up a production sling
> environment?
> 
> 
> Tony Giaccone
> 


Re: HTTP Digest Authentication with Sling

2010-06-04 Thread Felix Meschberger
Hi,

This does not sound to add real security, since the passwords are
essentially stored in plain text (with respect to gaining access to the
system).

Regards
Felix

On 04.06.2010 19:55, Alexander Klimetschek wrote:
> On Fri, Jun 4, 2010 at 16:17, Felix Meschberger  wrote:
>> As you said "password's md5": This is IIUIC the problem. Doesn't digest
>> auth need to know the plaintext password to be able to generate the
>> challenge ?
> 
> Not necessarily, the server "only" needs to know/store an MD5 of
> "username : realm : password", where the realm can be a fixed string
> (see section 4.13 of RFC-2617 [1]). I think in my scenario it could be
> possible to store this information inside the repository, but I am
> still investigating.
> 
> [1] http://tools.ietf.org/html/rfc2617#section-4.13
> 
> Regards,
> Alex
> 


Re: Swapping Postgres for Derby

2010-06-14 Thread Felix Meschberger
Hi Tony

I have to say: hats off to you !

Thanks alot for this thorough explanation of your journey to get
Postgres support for Sling. Much appreciated.

I have created a new page on our site [1] providing these steps to the
public. Also I crated an issue [SLING-1556, 2] to ensure optional
imports for all JDBC references of Persistence Managers provided by
Jackrabbit Core.

Regards
Felix

PS: According to the jdbc.postgresql.org site, the difference between
the JDCB3 and JDBC4 driver is, that the JDBC4 driver implements the new
methods defined by the JDBC 4 API included with Java 6. If you don't use
this new API, you may probably safely use the JDBC 3 driver.

[1] http://sling.apache.org/site/jackrabbit-persistence.html
[2] https://issues.apache.org/jira/browse/SLING-1556

On 11.06.2010 22:14, Tony Giaccone wrote:
> 
> I asked for a bit of assistance to help me swap out the Derby persistence 
> manager in Sling for a 
> Database backed system. 
> 
> I was advised to look at the OSGi bundles for JDBC drivers and to get a 
> better understanding of how 
> that driver the Felix OSGi container is used by Sling..
> 
> 
> What follows is the process I used, and how I managed to be successful. I 
> hope that anyone else who 
> needs to follow this path will find this helpful and give you the specific 
> advice you need to make this 
> swap out.
> 
> Mind you there are some problems with this path. The main one being that none 
> of the maven testing 
> works.  It looks like this happens because the Derby DB is initialized to 
> blank each time it spins up
> while Postgress keeps state.  I really haven't looked in detail at why this 
> is, that is just my supposition.
> However, I was able to successfully deploy sling into glass fish and create 
> nodes which are backed
> by data in the database. For now, that's good enough for me. 
> 
> 
> My intent in this was to do the minimum necessary to get this to work.  As a 
> result I have not tried to 
> remove any of the existing structure that supported using Derby. I that 
> effort was only going to make 
> the process that more difficult. And made it that much more unlikely to 
> succeed for someone who 
> knows as little as I do.  What I did was augment the build process to include 
> the artifacts necessary to 
> use the DatabasePersistance manager and Postgres.  Once I have this working 
> on my local build, 
> I'll look into what it takes to do the same, and I expect that will be easy, 
> for Oracle. 
> 
> 
> There is an assumption here that you have a copy of postgres running on  your 
> local machine, and that 
> it's on the standard postgres port and that you have a schema set up for 
> Sling/Jackrabbit to use and  an 
> Postgress userid with access to that database. 
> 
> Typical warnings apply, I know very little about Sling or Jackrabbit, I'm 
> about as novice as you can be
> with both of these, as a result your milage may vary. I've done no testing on 
> this, the only reason I know
> it works is that jackrabbit created the  tables in the DB Schema.  With all 
> that said here's the process 
> that  seems to be working for me.  The sling files I've modified are in bold. 
> 
> 
> The first change I made was to go to a pom file:
> 
> sling/bundles/jcr/jackrabbit-server/pom.xml
> 
> This file is integral to how the derby code gets loaded. So I just duplicated 
> the line but changed it to 
> the driver for postgresql.
> 
>
> org.apache.derby.jdbc;resolution:=optional,
> 
> org.postgresql.Driver;resolution:=optional,
> 
> 
> Once this was done the next step was to ensure that the postgres drivers got 
> loaded.  To get them 
> loaded they must be part of an OSGi bundle. My first attempts to get this 
> working relied on bundles that 
> had been suggested to me from springsource.com
> 
> http://www.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.postgresql.jdbc3&version=8.3.603&searchType=bundlesByName&searchQuery=postgres
> 
> I was NOT able to get those drivers/bundles working. I don't think the 
> Manifest files contained in those 
> jar files  are correct. I burned the better part of  two days (I was totally 
> ignorant, and still am mostly 
> ignorant about OSGi).  That ignorance only made the process more complicated. 
> 
> This pdf helped immensely.
> 
> http://jonas.ow2.org/JONAS_5_2_0_M1/doc/doc-en/pdf/howto_install_jdbc_driver.pdf
> 
> 
> To get bundles that would work, I did the following.  I downloaded the 
> postgres jdbc drivers.  I also 
> downloaded the bnd tool (http://www.aqute.biz/Code/Bnd)
> 
> I used the bnd tool to wrap both sets of drivers. 
> 
> $ bnd wrap postgresql-8.4-701.jdbc3.jar
> $ mv postgresql-8.4-701.jdbc3.bar postgresql-8.4-701.jdbc3-bnd.jar
> $ bnd wrap postgresql-8.4-701.jdbc4.jar
> $ mv postgresql-8.4-701.jdbc4.bar postgresql-8.4-701.jdbc4-bnd.jar
> 
> In this way I had both level 3 and level 4 drivers 

Re: Swapping Postgres for Derby

2010-06-14 Thread Felix Meschberger
Hi,

On 14.06.2010 14:51, Tony Giaccone wrote:
> Felix, 
> 
> The real point of this exercise was to get Oracle up and running. However, 
> the Oracle server I 
> will be using is remote and is protected by a bit of security. Putting 
> postgres on my local box, 
> meant I was able to work anywhere, on this problem because everything I 
> needed was local. 

Good.

In fact given your description, I actually took me longer to setup
PostgreSQL  (install and configure) than to reconfigure Sling [though
PostgreSQL setup is easy by itself on a Linux box ;-) ].

Regards
Felix

> 
> I expect to have Oracle functioning later today now that I know how to make 
> the changes, 
> getting Launchpad reconfigured should only take a few minutes.  :-)
> 
> 
> Tony
> 
> 
> On Jun 14, 2010, at 4:12 AM, Felix Meschberger wrote:
> 
>> Hi Tony
>>
>> I have to say: hats off to you !
>>
>> Thanks alot for this thorough explanation of your journey to get
>> Postgres support for Sling. Much appreciated.
>>
>> I have created a new page on our site [1] providing these steps to the
>> public. Also I crated an issue [SLING-1556, 2] to ensure optional
>> imports for all JDBC references of Persistence Managers provided by
>> Jackrabbit Core.
>>
>> Regards
>> Felix
>>
>> PS: According to the jdbc.postgresql.org site, the difference between
>> the JDCB3 and JDBC4 driver is, that the JDBC4 driver implements the new
>> methods defined by the JDBC 4 API included with Java 6. If you don't use
>> this new API, you may probably safely use the JDBC 3 driver.
>>
>> [1] http://sling.apache.org/site/jackrabbit-persistence.html
>> [2] https://issues.apache.org/jira/browse/SLING-1556
>>
>> On 11.06.2010 22:14, Tony Giaccone wrote:
>>>
>>> I asked for a bit of assistance to help me swap out the Derby persistence 
>>> manager in Sling for a 
>>> Database backed system. 
>>>
>>> I was advised to look at the OSGi bundles for JDBC drivers and to get a 
>>> better understanding of how 
>>> that driver the Felix OSGi container is used by Sling..
>>>
>>>
>>> What follows is the process I used, and how I managed to be successful. I 
>>> hope that anyone else who 
>>> needs to follow this path will find this helpful and give you the specific 
>>> advice you need to make this 
>>> swap out.
>>>
>>> Mind you there are some problems with this path. The main one being that 
>>> none of the maven testing 
>>> works.  It looks like this happens because the Derby DB is initialized to 
>>> blank each time it spins up
>>> while Postgress keeps state.  I really haven't looked in detail at why this 
>>> is, that is just my supposition.
>>> However, I was able to successfully deploy sling into glass fish and create 
>>> nodes which are backed
>>> by data in the database. For now, that's good enough for me. 
>>>
>>>
>>> My intent in this was to do the minimum necessary to get this to work.  As 
>>> a result I have not tried to 
>>> remove any of the existing structure that supported using Derby. I that 
>>> effort was only going to make 
>>> the process that more difficult. And made it that much more unlikely to 
>>> succeed for someone who 
>>> knows as little as I do.  What I did was augment the build process to 
>>> include the artifacts necessary to 
>>> use the DatabasePersistance manager and Postgres.  Once I have this working 
>>> on my local build, 
>>> I'll look into what it takes to do the same, and I expect that will be 
>>> easy, for Oracle. 
>>>
>>>
>>> There is an assumption here that you have a copy of postgres running on  
>>> your local machine, and that 
>>> it's on the standard postgres port and that you have a schema set up for 
>>> Sling/Jackrabbit to use and  an 
>>> Postgress userid with access to that database. 
>>>
>>> Typical warnings apply, I know very little about Sling or Jackrabbit, I'm 
>>> about as novice as you can be
>>> with both of these, as a result your milage may vary. I've done no testing 
>>> on this, the only reason I know
>>> it works is that jackrabbit created the  tables in the DB Schema.  With all 
>>> that said here's the process 
>>> that  seems to be working for me.  The sling files I've modified are in 
>>> bold. 
>>>
>>>
>>> The first change I made was to go to 

Re: Swapping Postgres for Derby

2010-06-15 Thread Felix Meschberger
Hi,

On 15.06.2010 05:47, Jos Snellings wrote:
> Hi Tony,
> 
> From you explanation, this struck me:
> Once this was done the next step was to ensure that the postgres drivers
> got loaded. To get them
>> loaded they must be part of an OSGi bundle. My first attempts to get
>> this working relied on bundles that
>> had been suggested to me from springsource.com
>>
>> http://www.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.postgresql.jdbc3&version=8.3.603&searchType=bundlesByName&searchQuery=postgres
>>
>>
>> I was NOT able to get those drivers/bundles working. I don't think the
>> Manifest files contained in those
>> jar files  are correct. I burned the better part of  two days (I was
>> totally ignorant, and still am mostly
>> ignorant about OSGi).  That ignorance only made the process more
>> complicated.
>>
> * several bundles you find on spring source use a particular notation
> for a version interval:
> [v1,v2)
> would by a half-open interval, I assume it says "from v1 including, any
> version to v2, not included"

Exactly. It is good practice to explicitly describe the dependencies in
terms of version intervals to ensure the API contracts.

> Now, the Felix console makes trouble when you request details about the
> bundle. He will complain about "unable to read version".
> 
> Anyone knows why that is?

Yes, this is probably due to FELIX-2244 [1] which has been fixed in trunk.

But this is only a problem with the web console not with the framework
not being able to thandle the bundle.

Regards
Felix

> 
> What I often notice, as a novice to OSGi as well, is that resolution
> does not always work as I expected.

> 
> Cheers,
> Jos
> 


Re: exported... or not?

2010-06-15 Thread Felix Meschberger
Hi,


On 15.06.2010 10:23, Jos Snellings wrote:
> Yes, I like this version notation very much, time to rebuild the trunk!
> Then there is the dependency mystery:
> according to the manifest springsource xml commons 1.3.4 should export:
> javax.xml.transform, javax.xml.transform.dom, javax.xml.transform.sax ...
> but felix console says it does not. What could be the reason?

I cannot confirm this. When I install this bundle, Web Console 3.0
happily lists the exports.

Regards
Felix

> 
> Jos
> 


Re: Database issues..

2010-06-17 Thread Felix Meschberger
Hi Tony,

On 17.06.2010 14:32, Tony Giaccone wrote:
> 
> 
> Twice now, I've ended up having problems starting up Sling and ended up 
> having to delete all the tables in the database, to solve the problem. 
> 
> I recognize that this is probably a jackrabbit problem and so perhaps not 
> appropriate for this list, but given that the jackrabbit instance is part of 
> the sling install, I'm going to start here first. 
> 
> 
> The app was shut down, perhaps improperly, but I had to reboot my laptop. I 
> had to delete glassfish and in doing so blasted the repository file system. 
> 
> 
> On restart I get this message: 
> 
> 16.06.2010 20:49:00.906 *ERROR* [Repository Pinger] 
> org.apache.jackrabbit.core.RepositoryImpl Failed to initialize workspace 
> 'default' javax.jcr.RepositoryException: Cannot instantiate persistence 
> manager 
> org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager
> 
> Caused by: java.sql.SQLException: Schema generation error: Issuing statement: 
> create table JCR_DEFAULT_REFS (NODE_ID_HI bigint not null, NODE_ID_LO bigint 
> not null, REFS_DATA bytea not null, PRIMARY KEY (NODE_ID_HI, NODE_ID_LO))
> 
> Caused by: org.postgresql.util.PSQLException: ERROR: relation 
> "jcr_default_refs" already exists
> 
> 
> Now I'm only using Postgres for the Persistence manager, and not also using 
> the DbFileSystem. Is this possibly a problem with the FileSystem being out of 
> synch with the Persistence manager?
> 
> Is this a general tip in the direction that says, keep your file system in 
> the database also?

I have also setup a Sling instance with PostgresSQL without switching to
DbFileSystem. And until now, I had no issues whatsoever.

It looks like the persistence manager cannot find the jcr_default_bundle
table and thus decides to create all tables for the "default" workspace.

This then fails, because the jcr_default_refs table (?) seems to
still/already exist.

It sure looks strange, that the jcr_default_bundle table is missing, but
the jcr_default_refs table exists.

What tables exist at all ? In my instance, I have 12 tables whose names
are prefix_binval, prefix_bundle, prefix_names, prefix_refs where prefix
is jcr_default (for the default workspace), jcr_security (for the
security workspace) and version (for the version history store).

Regards
Felix

> 
> 
> Tony Giaccone
> 
> 


Re: Database issues..

2010-06-17 Thread Felix Meschberger
Hi,

On 17.06.2010 15:59, Tony Giaccone wrote:
> Felix,
> 
> What I think is happening, and I'm not sure about this, is that the 
> filesystem repository was deleted. So now Jackrabbit thinks it has to start 
> up with an empty instance and it's going to try and create those tables as 
> part of the "instantiate the repository". 

Not, sure. Looking at the code it looks like the persistence manager (as
I said) looks for one of the expected tables to exist. If so, the
manager expects all to exist. If that single table does not exist, the
persistencemanager assumes all to not exist.

> 
> I solved the problem by deleting the tables and sequences and letting 
> Jackrabbit create a blank new instance.  That solves the problem for now. 

Ok, this helps for now, but ... the question remains, why tables are
incomplete. Have you looked at the PostgreSQL instance using something
like pgAdmin ?

> 
> I was able to start stop and restart the instance of 
> sling/jackrabbit/postgres many times before I had a problem. 
> 
> I'm playing a bit lose with this as I'm trying to switch between jackrabbit 
> using postgress and jackrabbit using oracle. 
> 
> I'm not keen on the file repository being in the same space as the web server
> 
> To solve this problem in part, I think I need to move the repository out from 
> under the application server (glassfish) and into a file space
> that won't be disturbed as I do new installs of glassfish, sling and 
> jackrabbit. 
> 
> . So I made this change:
> 
> 
> 
> 
> 
> 
> I believe that should move the file repository out of the file system 
> controlled by the application server.
> 
> That way I can have one filesystem that's set up for oracle, and another for 
> postgres, and not have any problem with documents inconsistencies between the 
> two repositories. 
> 
> Does this approach seem reasonable?

I think it is reasonable to move stuff out from the web server area. But
I suggest to move the complete Sling instance data out of that area by
setting the sling.home init-param of the Sling servlet to some other
location.

Regards
Felix

> 
> 
> Tony
> 
> 
> On Jun 17, 2010, at 9:31 AM, Felix Meschberger wrote:
> 
>> Hi Tony,
>>
>> On 17.06.2010 14:32, Tony Giaccone wrote:
>>>
>>>
>>> Twice now, I've ended up having problems starting up Sling and ended up 
>>> having to delete all the tables in the database, to solve the problem. 
>>>
>>> I recognize that this is probably a jackrabbit problem and so perhaps not 
>>> appropriate for this list, but given that the jackrabbit instance is part 
>>> of the sling install, I'm going to start here first. 
>>>
>>>
>>> The app was shut down, perhaps improperly, but I had to reboot my laptop. I 
>>> had to delete glassfish and in doing so blasted the repository file system. 
>>>
>>>
>>> On restart I get this message: 
>>>
>>> 16.06.2010 20:49:00.906 *ERROR* [Repository Pinger] 
>>> org.apache.jackrabbit.core.RepositoryImpl Failed to initialize workspace 
>>> 'default' javax.jcr.RepositoryException: Cannot instantiate persistence 
>>> manager 
>>> org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager
>>>
>>> Caused by: java.sql.SQLException: Schema generation error: Issuing 
>>> statement: create table JCR_DEFAULT_REFS (NODE_ID_HI bigint not null, 
>>> NODE_ID_LO bigint not null, REFS_DATA bytea not null, PRIMARY KEY 
>>> (NODE_ID_HI, NODE_ID_LO))
>>>
>>> Caused by: org.postgresql.util.PSQLException: ERROR: relation 
>>> "jcr_default_refs" already exists
>>>
>>>
>>> Now I'm only using Postgres for the Persistence manager, and not also using 
>>> the DbFileSystem. Is this possibly a problem with the FileSystem being out 
>>> of synch with the Persistence manager?
>>>
>>> Is this a general tip in the direction that says, keep your file system in 
>>> the database also?
>>
>> I have also setup a Sling instance with PostgresSQL without switching to
>> DbFileSystem. And until now, I had no issues whatsoever.
>>
>> It looks like the persistence manager cannot find the jcr_default_bundle
>> table and thus decides to create all tables for the "default" workspace.
>>
>> This then fails, because the jcr_default_refs table (?) seems to
>> still/already exist.
>>
>> It sure looks strange, that the jcr_default_bundle table is missing, but
>> the jcr_default_refs table exists.
>>
>> What tables exist at all ? In my instance, I have 12 tables whose names
>> are prefix_binval, prefix_bundle, prefix_names, prefix_refs where prefix
>> is jcr_default (for the default workspace), jcr_security (for the
>> security workspace) and version (for the version history store).
>>
>> Regards
>> Felix
>>
>>>
>>>
>>> Tony Giaccone
>>>
>>>
> 
> 


Re: Database issues..

2010-06-18 Thread Felix Meschberger
Hi Ton,y

On 17.06.2010 21:49, Tony Giaccone wrote:
> 
> On Jun 17, 2010, at 10:10 AM, Felix Meschberger wrote:
> 
>> sling.home
> Felix, 
> 
> 
> I'm such a literal guy.. I need a bit of hand holding..

;-)

I mean in the web.xml file, where the SlingServlet is configured, you
can define init-params. You set sling.home there, something like:

   
   sling.home
   /var/sling
   

This will cause everything currently below "sling" to be placed inside
/var/sling (requiring access to this filesystem location ;-) ) This
includes also the filesystem data of the repository.

Look at the web.xml file enclosed in the sling launchpad .war file. You
should see some commment and even a prepared  element for
you to start with.

Hope, this helps.

Regards
Felix

> 
> 
> do you mean that by setting this property
> 
> 
> sling.home
> 
> in 
> 
> sling/launchpad/base/src/main/resources/sling.properites
> 
> which is currently set to 
> 
> sling.home = sling
> 
> 
> to something like:
> 
> sling.home = /sling
> 
> that I would move the sling and all  the deployed directories to a different 
> location on the file system?
> 
> 
> 
> Tony


Re: odd problem when moving sling/jackrabbit to oracle PM

2010-06-18 Thread Felix Meschberger
Hi Tony,

I am afraid, you probably have to ask this question at
users(a)jackrabbit(dot)apache(dot)org. You might also have to provide
your repository.xml file for them to be able to help.

I don't really think this is directly related to your move to Oracle.

Regards
Felix

On 17.06.2010 20:58, Tony Giaccone wrote:
> 
> 
> 
> In a standard launchpad build, how do the values for the jackrabbit 
> configurations variables like ${wsp.name},  get set? 
> 
> 
> I'm trying to switch over from postgres to oracle and I'm getting a message 
> about
> 
> 
>  org.apache.sling.jcr.jackrabbit.server acquireRepository: Repository problem 
> starting repository from 
> file:/usr/local/glassfish/domains/domain1/config/sling/_sling/jackrabbit/repository.xml
>  in /usr/local/glassfish/domains/domain1/config/sling/_sling/jackrabbit 
> (org.apache.jackrabbit.core.config.ConfigurationException: Replacement not 
> found for ${wsp.name}.) 
> org.apache.jackrabbit.core.config.ConfigurationException: Replacement not 
> found for ${wsp.name}.
> 
> 
> Which makes no sense to me. 
> 
> 
> Does anyone know what's going on here?
> 
> 
> 
> Tony Giaccone


Re: A practical suggestion.

2010-06-18 Thread Felix Meschberger
Hi,

Believe me: I hear you and I understand you. And believe me: Getting a
new full release (lets call it Sling 6 for now) is one of our top
priorities.

Facts of life, though prevent us from moving forward this very moment,
because we still have some nuts and bolts to fix...

On 18.06.2010 20:25, Tony Giaccone wrote:
> 
> Let me start out by saying that this maybe more of a Dev issue, then a users 
> issue. However, given that to do things like change the location of the 
> repository, you need to rebuild Sling, I think there's a reasonable case to 
> be made for posting this to the users list. 

I don't think you have to fully rebuild just to change the sling.home
folder: Just take the .war file your are already using, unpack with with
the jar command, edit web.xml file and pack it up again using jar. And
you're done.

> 
> The build process for Sling is pretty simple. If you know maven and are 
> reasonably facile at the command line, you can build sling with out much 
> trouble.  That said today I've had a miserable build problem, and it's cost 
> me all day figuring this out (which perhaps suggests my understanding of 
> maven isn't as good as it should be, I should have recognized this sooner). 
> 
> I wanted to make a change to the  web.xml file, and I made that change, and 
> did the build and the change wasn't propagating through to the war file. The 
> problem was, that the component that contains the web.xml file was building 
> to a different version (version-something-SNAPSHOT), then the launchpad was 
> dependent upon (version-something). 

Yes, this is sometimes tricky, and this is where a real full release is
really overdue...

Regards
Felix

> 
> So my change was making it into the maven repository but not making it back 
> out into the build of the war file.  
> 
> I should have recognized this as a problem sooner, but Sling is a fairly 
> complicated build with a lot of moving pieces. It wasn't clear to me till 
> quite late in the process that there was a trip to the maven repository 
> involved in the build. 
> 
> I'm reasonably certain that I pulled this source code based on the 
> instructions on the building page. 
> 
> http://sling.apache.org/site/getting-and-building-sling.html
> 
> 
> Grabbing source from the trunk is probably the right thing to do for folks 
> doing development on the Apache Sling project.  However, there are also guys 
> like me, who have to do builds and make changes based on stable versions of 
> the code.  Guys like me HATE pulling from the trunk. The trunk is by it's 
> very nature unstable and inconsistent. 
> 
> It's not clear to me how release management works on this project, but it 
> would be nice, to have a sources tar file, to go along with a stable release 
> version.  That way you could just download the tar file and have the sources 
> for a complete version which you could modify to do things like change the 
> location of the repository, or add JDBC driver support and not worry that 
> you're playing with the "latest" code base, or having to deal with 
> inconsistent version dependencies. 
> 
> Or at least publish tags for released versions , and change the check out 
> instructions to reflect the tag of most recent stable version. 
> 
> I hate pointing out a problem which ends up being a call for someone else to 
> do work, but Sling is a sophisticated piece of software, the project and the 
> build take time to understand and having a stable consistent code base to 
> work from, would make the whole process much more approachable. 
> 
> 
> Tony


Re: Custom logging

2010-07-26 Thread Felix Meschberger
Hi,

On 25.07.2010 12:04, Jacopo Franzoi wrote:
> Hi all,
> I'm wondering which could be the easiest way to support custom logging
> in Sling, I mean something like JMS / SMTP / JDBC appenders in log4j.
> 
> Sling currently redirects log4j logs to SLF4J (configured in the Felix
> web console), and that's ok, but I'm thinking about supporting custom

Currently, we have the setup that Log4J and Apache Commons Logging are
implemented in terms of SLF4J. SLF4J in turn is implemented by our own
grass-roots implementation, which currently only supports files and the
console (stdout).

There have been discussions of abandoning our SLF4J implementation again
in favor of another SLF4J implementation, most notably Logback.

> logging, such as notifying errors to an external service, not just
> plain text log files.
> 
> Is there already anything working in Sling, regarding this scenario?

Not to my knowledge, but patches to replace our implementation while
maintaining (at least) the same level of configurability are highly welcome.

Regards
Felix


Re: xml tag name

2010-07-26 Thread Felix Meschberger
Hi,

The default XML renderer of Sling (provided by the Sling Default GET
Servlets bundle) uses JCR Document View export to generate XML. If you
want JCR System View export, specify the "sysview" selector as in

   http://host/content/path.sysview.xml

Hope this helps.

Regards
Felix

On 26.07.2010 18:43, Tony Giaccone wrote:
> 
> 
> I've been playing around with generating XML outputs based on the data that's 
> passed in, and I'm curious about how Sling
> decides what to use as the tag for the stanza of xml..
> 
> 
> I used this curl to insert a document into my repository...
> 
> 
> curl -D - -F"sling:resourceType=mjb/blog" -F"seq=105" -F"firstName=Roberta" 
> -F"lastName=Chambers"  
> "http://admin:ad...@localhost:8080/sling/content/blog/*";
> 
> 
> And got this data: 
> 
> <_x0033__1280162305912 jcr:primaryType="nt:unstructured" firstName="Roberta" 
> lastName="Chambers" seq="105" sling:resourceType="mjb/blog" 
> xmlns:ocm="http://jackrabbit.apache.org/ocm"; 
> xmlns:fn="http://www.w3.org/2005/xpath-functions"; 
> xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions"; 
> xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
> xmlns:jcr="http://www.jcp.org/jcr/1.0"; 
> xmlns:mix="http://www.jcp.org/jcr/mix/1.0"; 
> xmlns:sv="http://www.jcp.org/jcr/sv/1.0"; 
> xmlns:sling="http://sling.apache.org/jcr/sling/1.0"; xmlns:rep="internal" 
> xmlns:nt="http://www.jcp.org/jcr/nt/1.0"/>
> 
> 
> That tag <_ x0033__1280162305912 is really not what I want there. What i'd 
> like to see is 
> 
>  
> 
> Is there a way to change how that tag is generated?
> 
> 
> Tony


Re: ESP again...

2010-08-06 Thread Felix Meschberger
Hi,

On 06.08.2010 01:47, Tony Giaccone wrote:
> 
> 
> 
> So I'm trying to get the data in the lineItems. 
> 
> Here's the XML fragment
> 
>  jcr:created="2010-08-02T19:54:57.329-04:00" jcr:createdBy="admin">
>   <_x0031_ jcr:primaryType="nt:unstructured" lineItemSeq="1" itemId="55"  
> itemDescr="Item selected to purchase" 
> sling:resourceType="mll/item">
> 
> 
> I tried this:
> 
> 
>   <% var items = currentNode.lineItems; %>
>   <% for (var i = 0;i

This is the problem.

The items variable is a JavaScript wrapper for the Node interface. As
such it is not an array and does not have a length property.

If you want to iterate over the child nodes of items, the best thing is
to call the getNodes() method like this:

<%
var items = currentNode.lineItems.getNodes();
for (var i=0; i < items.length; i++) {
%><%= items[i].itemDescr %><%
}
%>

The items object here is actually a normal Object where the contained
nodes can also be accessed by name (unless as in your example, the node
names are numbers).

Hope this helps.

Regards
Felix

>   <% { %>
>   <%= currentNode.lineItems[i].itemDescr %>
>   <% } %>
>End of loop
> 
> And get this message:
> 
> TypeError: Cannot read property "shortDescr" from undefined 
> 
> 
> 
> 
> 
> So I change it to this:
> 
>   <% var items = currentNode.lineItems; %>
>   <% for (var i = 0;i
>   <% { %>
>   <%= currentNode.lineItems[i] %>
>   <% } %>
>End of loop
> 
> This is what I get..
> undefined End of loop
> 
> Change the code to this:
> 
>   <% var items = currentNode.lineItems; %>
>   <% for (var i = 0;i
>   <% { %>
>   <%= currentNode.lineItems %>
>   <% } %>
>End of loop
> 
> And I get this:
> 
> content/Documents/2008/1155383/Order/2_1280793297315/lineItems
> End of loop
> 
> I'm guessing I need to do something to load that node(?) into the page? 
> 
> 
> Tony


Re: Scheduler service problem

2010-08-06 Thread Felix Meschberger
Hi,

Well, this functionality, albeit not graphical, is available. It is
called the OSGi Bundle Repository.

If you install bundles from there, it will automatically also install
any dependencies also required but not installed yet ...

Regards
Felix

On 05.08.2010 14:08, Bertrand Delacretaz wrote:
> On Thu, Aug 5, 2010 at 1:14 PM, Mike Müller  wrote:
>> Such depencies are reflected in the manifest.mf file of each
>> bundle. I don't think it's a good idea, to put them manually
>> into the documentation, as long as they can change over time
> 
> Agree with that. What would be nice is generating dependency graphs
> live, using graphviz for example.
> 
> Hey, an idea for the next GSoC already ;-)
> 
> -Bertrand
> 



Re: Properties file in a bundle

2010-08-06 Thread Felix Meschberger
Hi,

On 06.08.2010 14:13, Vidar Ramdal wrote:
> On Fri, Aug 6, 2010 at 2:04 PM, Bertrand Delacretaz
>  wrote:
>> On Fri, Aug 6, 2010 at 1:40 PM, Vidar Ramdal  wrote:
>>> ...In principle, all you need to do is have a string constant annotated
>>> as @scr.property (or @Property if you're using the 'real'
>>> annotations). Then create local variables to store the property
>>> values. These values are fetchted from the Felix ConfigAdmin on
>>> component activation
>>
>> I just did that this morning for the bgservlets module, if you look at
>> [1] you'll get an example of how to make things configurable, using
>> the "modern" annotations.
> 
> Yeah, use the modern annotations and not the old javadoc ones (that
> is, use @Property, not /** @scr.property */). The modern ones are
> easier to maintain, as you can use Java constants as values.
> Refactoring support in IDEs are also much better.
> 
> And, I forgot to mention, if you want a proper-looking configuration
> form in the Felix web console, you should supply a
> resources/OSGI-INF/metatype/metatypes.properties file, and specify
> metatype=true on your Component annotation. This also demonstrated in

Actually metatype is generated by default, so no need for
"metatype=true". You need the metatype attribute only if you want to
prevent this information from being generated.

Regards
Felix


Re: Properties file in a bundle

2010-08-06 Thread Felix Meschberger
Hi,

On 06.08.2010 12:21, Federico Paparoni wrote:
> Hi Vidar,
> 
> 2010/8/5 Vidar Ramdal 
> 
>> On Thu, Aug 5, 2010 at 10:44 AM, Federico Paparoni
>>  wrote:
>>> 2010/8/5 Vidar Ramdal 


 What are the properties for? Configuration of your components?
 If so, I'd use the OSGi configuration support, which will make the
 configuration available in the Felix Web Console.


>>> Yes configuration for the components and anyway I would like to show in
>>> David the best way to handle properties (hard coded String are useful
>> only
>>> to show examples :P)
>>
>> Then OSGi configurations are definately the way to go.
>>
>>
> These properties are available through the BundleContext object I can
> retrieve from the ComponentContext.

Actually it is ComponentContext.getProperties()

The properties available from BundleContext.getProperty() are so-called
framework properties and are not backed by the Configuration Admin
service but are global-properties.

Regards
Felix


Re: servlet paths & resource types

2010-08-06 Thread Felix Meschberger
Hi,

On 04.08.2010 16:05, Carl Hall wrote:
> On this page [1], it states that if the sling.servlet.paths is set,
> sling.servlet.resourceTypes
> is ignored.  In the javadoc for ServletResolverConstants, it states that
> both can be defined and the servlet will be registered under both.  Which is
> correct?

The page [1] used to be correct but over time we realized that it would
be usefull to have both approaches in paralell. Thus the JavaDoc is now
correct.

I will fix the servlets.html page.

Thanks for pointing out.

> Also, the javadoc on @SlingServlet is a copy/paste ball of confusion.  :-)

Oh yeah ! Will fix this, too.

Regards
Felix

> 
> 1 http://sling.apache.org/site/servlets.html
> 


Re: servlet paths & resource types

2010-08-06 Thread Felix Meschberger
Hi,

On 06.08.2010 15:37, Bertrand Delacretaz wrote:
> Hi,
> 
> On Wed, Aug 4, 2010 at 4:05 PM, Carl Hall  wrote:
>> On this page [1], it states that if the sling.servlet.paths is set,
>> sling.servlet.resourceTypes
>> is ignored.  In the javadoc for ServletResolverConstants, it states that
>> both can be defined and the servlet will be registered under both.  Which is
>> correct?...
> 
> I don't know off the top of my head, I'd say the automated tests
> linked from http://sling.apache.org/site/servlets.html are the
> Absolute Truth about this.

Well, then there is probably the Ultimate Truth which is the
implementation code itself ;-)

But yes, the automated tests help alot.

Regards
Felix

> If you're not sure how things work, the
> best would be to contribute some new tests there, unless the existing
> one demonstrate what you need.
> 
> -Bertrand
> 


Re: User managment

2010-08-11 Thread Felix Meschberger
+1 (and yes, don't care for backwards compatibility here. Security is
more important)

Regards
Felix

On 11.08.2010 09:15, Mike Müller wrote:
> Hi
> 
> Wouldn't it be safer if this feature is turned off be default?
> 
> best regards
> mike
> 
>> -Original Message-
>> From: Eric Norman [mailto:eric.d.nor...@gmail.com]
>> Sent: Wednesday, August 11, 2010 2:57 AM
>> To: users@sling.apache.org
>> Subject: Re: User managment
>>
>>
>> Hi Tony,
>>
>> Looks to me like you have discovered a bug.  The self-reg
>> enabled flag is
>> not handled correctly when activating the component.
>>
>> I filed a new bug report
>> (*SLING-1639
>> )* to track the defect and I will fix it now.
>>
>> Regards,
>> -Eric
>>
>> On Tue, Aug 10, 2010 at 11:08 AM, Tony Giaccone
>>  wrote:
>>
>>>
>>> I'm reading from the Sling web site:
>>>
>>> "The jackrabbit-usermanager bundle delivers a REST
>> interface to create,
>>> update and delete users"
>>>
>>> And I have been able to successfully add a user, by
>> executing the following
>>> curl cmnd.
>>>
>>> curl -F:name=reader -Fpwd=ourReader -FpwdConfirm=ourReader
>> -F"desc=Read
>>> only access"
>>> http://localhost:8080/sling/system/userManager/user.create.html
>>>
>>> Except that it seems that anyone at any time can post to
>> this URL and
>>> create a user.
>>>
>>>
>>> So I looked at the configuration for that bundle and found
>> a checkbox
>>> labled:
>>>
>>> Self-Registration Enabled
>>>
>>>When selected, the anonymous user is allowed to
>> register a new user
>>> with the system. (self.registration.enabled)
>>>
>>>
>>> And that checkbox was checked. So it seems that I should be
>> able to uncheck
>>> that box and prevent anonymous user creation.
>>>
>>> However, it doesn't work. I can still create new users as anonymous.
>>>
>>> What am I doing wrong?
>>>
>>>
>>> Tony
>>
> 



Re: access the libs-folder through WebDAV ?

2010-08-13 Thread Felix Meschberger
Hi,

On 13.08.2010 09:54, Clemens Wyss wrote:
> what resources/path are browsable through WebDAV? Configurable? Any chance to 
> get hold of the libs folder (and its subfolders)?

The complete repository is basically browsable through WebDAV. Generally
nodes are returned as WebDAV Collections with the exceptions of nt:file
nodes, which are returned as WebDAV non-Collections.

So, yes you can.

I use WebDAV alot to create folders and edit simple/small test scripts.
And this works just fine.

Regards
Felix


Re: access the libs-folder through WebDAV ?

2010-08-13 Thread Felix Meschberger
Hi,

On 13.08.2010 10:11, Clemens Wyss wrote:
> that's weird.

Not its not ;-)

> The manifest of the jQuery explorer bundle says:
> Sling-Bundle-Resources: /libs/sling/explorer,
> /libs/sling/servlet/default/explorer

This provides the resources in the resource tree available through the
ResourceResolver but ...

> 
> but I cannot see the /libs folder in WebDAV (Windows Explorer)

... WebDAV is operating on the repository and does not see these
resources. Therefore through WebDAV these are not visible.

But you can GET them in the browser; provided the Default GET Servlet as
auto-index enabled, you can also list them as in :

  http://host:port/libs/sling/explorer/

to list all children of the explorer resource.

But beware, these resources are read-only and cannot be modified, either.

To have the resources in the Repository use the Sling-Initial-Content
instead of Sling-Bundle-Resource (though I really like the
Sling-Bundle-Resource ;-) ).

Regards
Felix

> 
>> -Original Message-
>> From: Felix Meschberger [mailto:fmesc...@gmail.com]
>> Sent: Friday, August 13, 2010 10:03 AM
>> To: users@sling.apache.org
>> Subject: Re: access the libs-folder through WebDAV ?
>>
>>
>> Hi,
>>
>> On 13.08.2010 09:54, Clemens Wyss wrote:
>>> what resources/path are browsable through WebDAV?
>> Configurable? Any chance to get hold of the libs folder (and
>> its subfolders)?
>>
>> The complete repository is basically browsable through
>> WebDAV. Generally
>> nodes are returned as WebDAV Collections with the exceptions
>> of nt:file
>> nodes, which are returned as WebDAV non-Collections.
>>
>> So, yes you can.
>>
>> I use WebDAV alot to create folders and edit simple/small
>> test scripts.
>> And this works just fine.
>>
>> Regards
>> Felix
>>


Re: access the libs-folder through WebDAV ?

2010-08-19 Thread Felix Meschberger
Hi,

On 18.08.2010 15:24, Clemens Wyss wrote:
> Novell to help
> -> http://www.theblog.ca/novell-netdrive
> does it for me, which is ok for the moment...

I also had success with WebDrive on windows. On Linux (Ubuntu, Gnome)
the built-in support works, too (though there are messages here and there).

My experience with Windows native WebDAV client is in fact not sooo
good; which is why I went for WebDrive.

Regards
Felix

> 
>> -Original Message-
>> From: Clemens Wyss [mailto:clemens...@mysign.ch]
>> Sent: Wednesday, August 18, 2010 3:12 PM
>> To: 'users@sling.apache.org'
>> Subject: RE: access the libs-folder through WebDAV ?
>>
>>
>> I still have a problem editing files through WebDAV (WinXP
>> WebDAV Client). I can see all folders and files, but I am not
>> able to edit them. Neither do I have have an "Edit" context
>> menu option, nor can I drag&drop a file into my editor.
>>
>> What might be the reason?
>>
>>> -Original Message-
>>> From: Felix Meschberger [mailto:fmesc...@gmail.com]
>>> Sent: Friday, August 13, 2010 10:32 AM
>>> To: users@sling.apache.org
>>> Subject: Re: access the libs-folder through WebDAV ?
>>>
>>>
>>> Hi,
>>>
>>> On 13.08.2010 10:11, Clemens Wyss wrote:
>>>> that's weird.
>>>
>>> Not its not ;-)
>>>
>>>> The manifest of the jQuery explorer bundle says:
>>>> Sling-Bundle-Resources: /libs/sling/explorer,
>>>> /libs/sling/servlet/default/explorer
>>>
>>> This provides the resources in the resource tree available
>> through the
>>> ResourceResolver but ...
>>>
>>>>
>>>> but I cannot see the /libs folder in WebDAV (Windows Explorer)
>>>
>>> ... WebDAV is operating on the repository and does not see these
>>> resources. Therefore through WebDAV these are not visible.
>>>
>>> But you can GET them in the browser; provided the Default GET
>>> Servlet as
>>> auto-index enabled, you can also list them as in :
>>>
>>>   http://host:port/libs/sling/explorer/
>>>
>>> to list all children of the explorer resource.
>>>
>>> But beware, these resources are read-only and cannot be
>>> modified, either.
>>>
>>> To have the resources in the Repository use the
>> Sling-Initial-Content
>>> instead of Sling-Bundle-Resource (though I really like the
>>> Sling-Bundle-Resource ;-) ).
>>>
>>> Regards
>>> Felix
>>>
>>>>
>>>>> -Original Message-
>>>>> From: Felix Meschberger [mailto:fmesc...@gmail.com]
>>>>> Sent: Friday, August 13, 2010 10:03 AM
>>>>> To: users@sling.apache.org
>>>>> Subject: Re: access the libs-folder through WebDAV ?
>>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> On 13.08.2010 09:54, Clemens Wyss wrote:
>>>>>> what resources/path are browsable through WebDAV?
>>>>> Configurable? Any chance to get hold of the libs folder (and
>>>>> its subfolders)?
>>>>>
>>>>> The complete repository is basically browsable through
>>>>> WebDAV. Generally
>>>>> nodes are returned as WebDAV Collections with the exceptions
>>>>> of nt:file
>>>>> nodes, which are returned as WebDAV non-Collections.
>>>>>
>>>>> So, yes you can.
>>>>>
>>>>> I use WebDAV alot to create folders and edit simple/small
>>>>> test scripts.
>>>>> And this works just fine.
>>>>>
>>>>> Regards
>>>>> Felix
>>>>>
>>>
>>


Re: access the libs-folder through WebDAV ?

2010-08-19 Thread Felix Meschberger
Hi,

On 19.08.2010 16:14, Clemens Wyss wrote:
>> which is why I went for WebDrive
> the commercial (http://www.webdrive.com/products/webdrive/index.html) or the 
> "free" (http://www.theblog.ca/novell-netdrive)?

I didn't know that Novell's net driver is free ;-)

... and it is some time ago, that I bought WebDrive. In the meantime my
dev box became an Ubuntu box 

Regards
Felix

> 
>> -Original Message-
>> From: Felix Meschberger [mailto:fmesc...@gmail.com]
>> Sent: Thursday, August 19, 2010 9:24 AM
>> To: users@sling.apache.org
>> Subject: Re: access the libs-folder through WebDAV ?
>>
>>
>> Hi,
>>
>> On 18.08.2010 15:24, Clemens Wyss wrote:
>>> Novell to help
>>> -> http://www.theblog.ca/novell-netdrive
>>> does it for me, which is ok for the moment...
>>
>> I also had success with WebDrive on windows. On Linux (Ubuntu, Gnome)
>> the built-in support works, too (though there are messages
>> here and there).
>>
>> My experience with Windows native WebDAV client is in fact not sooo
>> good; which is why I went for WebDrive.
>>
>> Regards
>> Felix
>>
>>>
>>>> -Original Message-
>>>> From: Clemens Wyss [mailto:clemens...@mysign.ch]
>>>> Sent: Wednesday, August 18, 2010 3:12 PM
>>>> To: 'users@sling.apache.org'
>>>> Subject: RE: access the libs-folder through WebDAV ?
>>>>
>>>>
>>>> I still have a problem editing files through WebDAV (WinXP
>>>> WebDAV Client). I can see all folders and files, but I am not
>>>> able to edit them. Neither do I have have an "Edit" context
>>>> menu option, nor can I drag&drop a file into my editor.
>>>>
>>>> What might be the reason?
>>>>
>>>>> -Original Message-
>>>>> From: Felix Meschberger [mailto:fmesc...@gmail.com]
>>>>> Sent: Friday, August 13, 2010 10:32 AM
>>>>> To: users@sling.apache.org
>>>>> Subject: Re: access the libs-folder through WebDAV ?
>>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> On 13.08.2010 10:11, Clemens Wyss wrote:
>>>>>> that's weird.
>>>>>
>>>>> Not its not ;-)
>>>>>
>>>>>> The manifest of the jQuery explorer bundle says:
>>>>>> Sling-Bundle-Resources: /libs/sling/explorer,
>>>>>> /libs/sling/servlet/default/explorer
>>>>>
>>>>> This provides the resources in the resource tree available
>>>> through the
>>>>> ResourceResolver but ...
>>>>>
>>>>>>
>>>>>> but I cannot see the /libs folder in WebDAV (Windows Explorer)
>>>>>
>>>>> ... WebDAV is operating on the repository and does not see these
>>>>> resources. Therefore through WebDAV these are not visible.
>>>>>
>>>>> But you can GET them in the browser; provided the Default GET
>>>>> Servlet as
>>>>> auto-index enabled, you can also list them as in :
>>>>>
>>>>>   http://host:port/libs/sling/explorer/
>>>>>
>>>>> to list all children of the explorer resource.
>>>>>
>>>>> But beware, these resources are read-only and cannot be
>>>>> modified, either.
>>>>>
>>>>> To have the resources in the Repository use the
>>>> Sling-Initial-Content
>>>>> instead of Sling-Bundle-Resource (though I really like the
>>>>> Sling-Bundle-Resource ;-) ).
>>>>>
>>>>> Regards
>>>>> Felix
>>>>>
>>>>>>
>>>>>>> -Original Message-
>>>>>>> From: Felix Meschberger [mailto:fmesc...@gmail.com]
>>>>>>> Sent: Friday, August 13, 2010 10:03 AM
>>>>>>> To: users@sling.apache.org
>>>>>>> Subject: Re: access the libs-folder through WebDAV ?
>>>>>>>
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> On 13.08.2010 09:54, Clemens Wyss wrote:
>>>>>>>> what resources/path are browsable through WebDAV?
>>>>>>> Configurable? Any chance to get hold of the libs folder (and
>>>>>>> its subfolders)?
>>>>>>>
>>>>>>> The complete repository is basically browsable through
>>>>>>> WebDAV. Generally
>>>>>>> nodes are returned as WebDAV Collections with the exceptions
>>>>>>> of nt:file
>>>>>>> nodes, which are returned as WebDAV non-Collections.
>>>>>>>
>>>>>>> So, yes you can.
>>>>>>>
>>>>>>> I use WebDAV alot to create folders and edit simple/small
>>>>>>> test scripts.
>>>>>>> And this works just fine.
>>>>>>>
>>>>>>> Regards
>>>>>>> Felix
>>>>>>>
>>>>>
>>>>
>>


Re: Form submission and jcr:primaryType

2010-08-21 Thread Felix Meschberger
Hi Tony,

See inline comment

On 20.08.2010 22:23, Tony Giaccone wrote:
> Summary:  
> 
> Using java to post a multipart form with values of "jcr:primaryType" set to 
> "nt:unstructured" fails, curl to same address succeeds. 
> 
> 
> 
> Details:
> 
> 
> I'm using httpcomponent/httpclient  to send submit a form to sling. 
> 
> To do this I'm creating a multi-part form, with the fields being sent using 
> code like this:
> 
>   
> public String insertWithAuth(String userId, String password,String url, 
> List slingData) {
>   String retValue = null;
>   HttpPost post = new HttpPost(url);
>   BasicNameValuePair[] pairs = new BasicNameValuePair[slingData.size()];
>   pairs = slingData.toArray(pairs);
>   try {
>   MultipartEntity anEntity = new MultipartEntity( 
> HttpMultipartMode.BROWSER_COMPATIBLE);
>   for(BasicNameValuePair entry : pairs) 
>   {
>   anEntity.addPart(entry.getName(), new 
> StringBody(entry.getName(),Charset.forName("UTF-8")));

Are you sure this line is correct ?? I would assume the StringBody is
created from the entry's value not its name.

Regards
Felix

>   }
>   post.setEntity(anEntity);
>   HttpResponse theResponse = client.execute(targetHost, post, 
> localContext);
> 
> 
> I've left out the declarations for targetHost and localContent I don't think 
> they are significant. 
> 
> The List of BasicNameValuePairs is created based on the contents of the 
> entity that's being posted.
> 
> If I don't do anything but set my own values, based on the object I'm trying 
> to insert everything works fine. 
> 
> The document ends up with this property:
> 
> "jcr:primaryType":"sling:Folder"
> 
> 
> However, when I try to set the jcr:primary value with the following code:
> 
>   key = "jcr:primaryType";
>   value = "nt:unstructured";
>   entry = new BasicNameValuePair(key,value);
>   retValue.add(entry);
>   
>   return (retValue);
> 
>  I always get this error message:
> 
> 
> 
> Status
> 500
> Message   
> javax.jcr.nodetype.NoSuchNodeTypeException: 
> {http://www.jcp.org/jcr/1.0}primaryType
> 
> 
> Using Curl to set that value works just fine:
> 
> curl -F"sling:resourceType=foo/bar" -F"jcr:primaryType=nt:unstructured" 
> -F"userId=jsmith" 
> http://admin:ad...@localhost:8080/sling/content/Documents/users/jsmith
> 
> 
> {"sling:resourceType":"foo/bar","userId":"jsmith","jcr:primaryType":"nt:unstructured"}
> 
> 
> 
> 


Re: Velocity scripting support - release?

2010-09-16 Thread Felix Meschberger
Mike, will you give it a try ?

Regards
Felix

Am 16.09.2010 15:13, schrieb olaf.o...@css.ch:
> Hi there
> 
> I think the current velocity scripting support is, albeit some open issues 
> persist, ready for a first release. I see there already is a 2.0.0 tag for 
> it - will this version be deployed to the releases repository? I'd then 
> use it in a vital development project, so we can collect issues 
> improvements for the next version ;-)
> 
> Regards,
> Olaf
> 
> ___
> 
> Olaf Otto IKGE*
> externe Mitarbeiter, Unic AG, Bern
> CSS Versicherung
> Tribschenstrasse 21
> CH-6002 Luzern
> Telefon +41 (0)58 277 11 11
> Telefax +41 (0)58 277 12 12
> olaf.o...@css.ch
> www.css.ch / www.intras.ch
> ___
> 
> CSS Kranken-Versicherung AG, CSS Versicherung AG,
> INTRAS Kranken-Versicherung AG, INTRAS Versicherung AG,
> Arcosana AG, Auxilia Kranken-Versicherung AG
> 
> 
> 
> Von:Mike Müller 
> An: "'users@sling.apache.org'" 
> Datum:  25.08.2010 16:22
> Betreff:RE: Velocity scripting support
> 
> 
> 
>> On Wed, Aug 25, 2010 at 4:07 PM, Mike Müller
>>  wrote:
>>> I just upgraded and tested the Velocity scripting
>>> support to the latest stable version 1.6.4.
>>
>> Thanks!
>>
>>>
>>> What about making Velocity scripting to a first citizen
>>> scripting bundle and move it to bundles/scripting/velocity?...
>>
>> My preference is to leave it under contrib/scripting/velocity, so as
>> to keep our core small. That doesn't prevent us from releasing it.
> 
> Okay, that's fine for me. In this case I would like to make a
> release 2.0.0.
> 
> best regards
> mike
> 
> 
> -- 
> Der Inhalt dieses E-Mails ist streng vertraulich und möglicherweise 
> gesetzlich besonders geschützt. Dieses E-Mail ist nur für den Adressaten 
> bestimmt. Wenn Sie nicht der beabsichtigte Empfänger sind, ist es Ihnen nicht 
> gestattet und stellt möglicherweise einen Gesetzesverstoss dar, dieses E-Mail 
> zu kopieren, zu verbreiten oder anderweitig zu verwenden. In diesem Fall 
> sollten Sie uns so schnell wie möglich benachrichtigen und dieses E-Mail 
> löschen. 
> 
> Le contenu de ce courriel est strictement confidentiel et probablement 
> légalement protégé. Il n'est adressé qu'aux destinataires mentionnés. Si vous 
> n'en faites pas partie, vous n'avez pas l'autorisation de le copier, ni de le 
> diffuser, ni même de le destiner à un autre usage - ce qui dans chaque cas 
> peut en effet constituer une infraction à la loi. Dans ce cas, vous devriez 
> nous en informer immédiatement et effacer ce courriel. 
> 
> Il contenuto del presente messaggio elettronico è da considerare di massima 
> riservatezza e possibilmente è protetto in modo particolare dalla legge. La 
> presente e-mail è riservata alla sola attenzione della persona destinataria. 
> Se lei non è la persona che avrebbe dovuto ricevere la e-mail, non le è 
> permesso e possibilmente rappresenta una violazione della legge, copiare la 
> presente e-mail, diffonderla o utilizzarla in qualsiasi altro modo. In questo 
> caso lei dovrebbe informarci al più presto possibile e cancellare la presente 
> e-mail.  



Re: Overwriting Map Entry

2010-09-16 Thread Felix Meschberger
Hi,

This is probably really more a Jackrabbit question. IIRC this is some
"debug" logging at the wrong level which has been fixed in more recent
releases.

Regards
Felix

Am 16.09.2010 17:36, schrieb Carl Hall:
> Cross-posting as this might originate in Sling.  Any thoughts?
> 
> -- Forwarded message --
> From: Carl Hall 
> Date: Wed, Sep 15, 2010 at 10:08 PM
> Subject: Overwriting Map Entry
> To: us...@jackrabbit.apache.org
> 
> 
> We see the messages below in varying amounts depending on the environment.
>  Are they something we should care about?
> 
> 14.09.2010 10:00:54.248 *WARN* [Configuration Updater]
> org.apache.jackrabbit.core.state.ItemStateMap overwriting map entry
> b94a4679-512b-34bf-bf62-7ef58c4a04a3
> 14.09.2010 10:00:54.248 *WARN* [Configuration Updater]
> org.apache.jackrabbit.core.state.ItemStateMap overwriting map entry
> 9e096755-2386-c8d4-2ba0-94500c444a4d
> 14.09.2010 10:00:54.248 *WARN* [Configuration Updater]
> org.apache.jackrabbit.core.state.ItemStateMap overwriting map entry
> c17243dc-2436-25e2-973b-31f06ccc66fa
> 14.09.2010 10:00:54.248 *WARN* [Configuration Updater]
> org.apache.jackrabbit.core.state.ItemStateMap overwriting map entry
> be976267-e070-6771-d8da-cd1dfeebb0ea
> 


Re: JSON tree

2010-09-17 Thread Felix Meschberger
Hi,

yes you can. By indicating the depth of the tree you want to get back as
a selector:

   /content.json --- returns just the properties of /content
   /content.2.json -- returns /content plus two levels down
   /content.infinity.json -- returns complete /content tree

Beware of the "infinity", though, this may get very large very quickly.

Regards
Felix

Am 17.09.2010 10:27, schrieb Federico Paparoni:
> Hi all,
> 
> In Apache Sling it's possible to have the resource in a JSON format, but is
> it possible to have a JSON tree ?
> For example if I have a node with children, can I have the rappresentation
> of these structure as a JSON tree using Apache Sling?
> 
> Cheers,
> 


Re: form based authentication with CRX

2010-09-22 Thread Felix Meschberger
(Beware: This is going to be an answer specific to CRX)

Hi Jozsef,

The first question raising: Do you want to authenticate using form based
authentication against the CRX webapp below /crx ? If so, then the setup
of the Sling part of the URI space is of no relevance and you are bound
to what is provided by the CRX web application.

If you want to authenticate against the Sling part (everyhting except
the /crx, /admin, and /system/console subtrees) you have to update a few
other bundles as well and particularly remove the
org.apache.sling.commons.auth bundle because it has been replaced by the
org.apache.sling.auth.core bundle.

The bundles to update/install (in addition to what you did) are:

  - Sling Engine (to 2.1.0)
  - Sling Settings (new install, version 1.0.0)
  - JCR Resource Resolver (trunk build, release not available yet)

Next you have to reconfigure CRX and the Form Authentication Handler to
support "trusted_credentials_attribute".

For CRX edit the repository.xml file and uncomment the  element
whose name is "trusted_credentials_attribute" and restart CRX.

For the Form Authentication Module, edit (or create) the Form
Authentication Handler configuration (e.g. at [1]) to set the
"Credentials Attribute" property to the value of the http://localhost:7402/system/console/configMgr/org.apache.sling.auth.form.FormAuthenticationHandler


Am 21.09.2010 19:51, schrieb Jozsef Vass:
> I have built sling from svn and form based authentication works as expected. 
> When starting Sling,  
> http://localhost:8080/system/console/slingauth shows "Apache Sling Form Based 
> Authentication Handler" and form authentication works right out of the box.
> 
> However, I would like to use form based authentication with CRX. I have CRX 
> 2.1 (April 2010) installed. Under 
> http://localhost:7402/system/console/slingauth, I only see "Token 
> Authentication Handler." I have installed Apache Sling Authentication Service 
> (org.apache.sling.auth.core) 1.0.2 and Apache Form Based Authentication 
> Handler (org.apache.sling.auth.form) 1.0.0 bundles and updated to Apache 
> Sling API 2.1.0 (org.apache.sling.api). All the above bundles are active. 
> However, Form Based Authentication Handler does not show up as a registered 
> authentication handler and request does not get authenticated, but a node is 
> created (j_security_check).
> 
> At the bundles, I also see older Apache Sling Authentication Service 
> (org.apache.sling.commons.auth) 0.9.0.R925144. If I disable this bundle, I do 
> not see any authentication handler.
> 
> How could I use form-based auth authentication with CRX. Any more bundles or 
> configuration needs to be changed?
> 
> Thanks.
> 
> Jozsef
> 


Re: JCR-SQL2 : paging

2010-09-30 Thread Felix Meschberger
Hi,

On 30.09.2010 09:45, Clemens Wyss wrote:
> should I post this "issue" in the jackrabbit newsgroup?

This would probably make sense ...

Regards
Fleix

> 
>> -Original Message-
>> From: Clemens Wyss [mailto:clemens...@mysign.ch]
>> Sent: Wednesday, September 29, 2010 11:27 AM
>> To: 'users@sling.apache.org'
>> Subject: RE: JCR-SQL2 : paging
>>
>>
>> sorry for re-activating this thread again.
>> I just noticed that adding "order by [jcr:score]" only works,
>> ie delivers the hit count, when there is no WHERE-clause.
>> E.g.:
>>   select * from [nt:unstructured] order by [jcr:score]
>> returns the hit count (query.execute().getRows().getSize()), whereas
>>   select * from [nt:unstructured] where entity = "customer"
>> order by [jcr:score]
>> doesn't. Bug, feature, (jackrabbit-)limitation?
>>
>>> -Original Message-
>>> From: Greg Klebus [mailto:gkle...@day.com]
>>> Sent: Tuesday, August 24, 2010 4:26 PM
>>> To: users@sling.apache.org
>>> Subject: Re: JCR-SQL2 : paging
>>>
>>>
>>> On Tue, Aug 24, 2010 at 3:55 PM, Clemens Wyss
>>>  wrote:
 @Mark: could you link me to the mentioned thread?
>>>
>>> Not sure about the thread. This is, however, a Jackrabbit
>> FAQ [1]. You
>>> can use "order by jcr:score" if you don't have more
>> specific ordering
>>> needs.
>>>
>>> [1]
>>> http://jackrabbit.apache.org/frequently-asked-questions.html#F
>> requentlyAskedQuestions-Whyisthesizeofmyqueryresult1%3F
>>
>> HTH
>> Greg
>>
>> --
>> Greg Klebus
>> Sr. Product Manager
>> mailto: greg.kle...@day.com
>> T +41 61 226 9898
>> F +41 61 226 9897
>>
>> Info-World 2009 Technology of the Year Award:  Best Web CMS
>> http://www.infoworld.com/slideshow/2009/01/194-2009_technology-4.html
>>
>> Day Software AG
>> Barfuesserplatz 6,  4001 Basel, Switzerland
>> web:  http://www.day.com/
>> twitter: @gklebus @daysoftware
>> 
>> This message is a private communication. If you are not the intended
>> recipient, please do not read, copy or use it, and do not disclose to
>> others. Please notify the sender of the delivery error by replying to
>> this message, and then delete it from your system. Thank you.
>> The sender does not assume any liability for timely,
>> trouble-free, complete,
>> virus free, secure, error free or uninterrupted arrival of this email.
>> For verification please request a hard-copy version.
>> 
>>
> 


Fwd: Ask for Post to Sling

2010-10-13 Thread Felix Meschberger
Forwarding this query to the Sling users list.

Regards
Felix

 Original Message 
Subject:Ask for Post to Sling
Date:   Wed, 13 Oct 2010 23:07:47 +0700
From:   Zhongmiao Li 
To: users-ow...@sling.apache.org




Hi dear Sling technician,

I have stuck in the problem for 10 days and am really eager for help
now. The problem is as follows:
I download the Sling stangalone jar file then run it on my machine. And
I just run it by double clikcing without any modification. However, I
found that there is really something strange.
I wirte a simple HTML containing a form to post a file to it, and I
found that if the action of the form is http://localhost:8080/.
, the post will succeed. However if I write
"127.0.0.1" or my real IP instead of "localhost", it will always fail
with error "not allowed to modify"!  And in my Java program I also tried
two methods, one of which is using HttpClient, and none of them can
work. The error code is always 500.
So can you just tell me what extra components should be added to Sling
or just send me a piece of java code that is sure to work? Really thanks
very much, I'm desperate now!

-- 
Best regards
Li Zhongmiao
Digital Media, College of Computer Science, Zhejiang University


Re: script resolving doesn't work

2010-10-22 Thread Felix Meschberger
Hi all,

I found the problem: The exceptions are not written back into the
responses any more because I recently cleanup what is getting written
back to the client in case of an error:

As part of SLING-1842 I also modified the error handlers to not write an
error stuff into the response if the response cannot be reset. The idea
here is to not interfere with any content already sent back...

But maybe, this is a completely wrong assumption and this should be
reverted ... Done with SLING-1850.

Regards
Felix

[1] https://issues.apache.org/jira/browse/SLING-1842
[2] https://issues.apache.org/jira/browse/SLING-1850

On 20.10.2010 22:27, Sandro Boehme wrote:
> Hi Justin,
> 
> I get the two test failures:
> testMaxCallsDetection(org.apache.sling.launchpad.webapp.integrationtest.JspIncludeTest)
> 
> testInfiniteLoopDetection(org.apache.sling.launchpad.webapp.integrationtest.IncludeTest)
> 
> Attached you find more detailed information and logs.
> 
> Best,
> 
> Sandro
> 
> Am 20.10.10 21:34, schrieb Justin Edelson:
>> Sandro-
>> If you get a chance, please try out trunk now. I just committed a fix
>> which seems to be working for me, but it'll be a while before Hudson
>> confirms.
>>
>> Thanks,
>> Justin
>>
>> On 10/20/10 3:21 PM, Sandro Boehme wrote:
>>> I'm glad it was not a user error ;-). The problem simply was, that I
>>> checked out the trunk while it was not yet working properly.
>>> I should have had a look at the hudson build before updating from trunk.
>>> Using git (git://git.apache.org/sling.git) now to be able to easily
>>> revert my local experiments to the last working version of the trunk
>>> (right now this should be commit 129f4d btw).
>>>
>>> Best,
>>>
>>> Sandro
>>>
>>> Am 20.10.10 01:23, schrieb Sandro Boehme:
 Hello,

 mvn clean install of sling on a fresh checkout from trunk did not show
 any errors. Also running Jetty works and all bundles are active. But
 the
 scripts of the Sling Explorer don't get executed and the
 HtmlRendererServlet is show like that:
 =


 Resource dumped by HtmlRendererServlet

 Resource path: */index.html*

 Resource metadata: *{sling.creationTime=1287529282337,
 sling.contentType=text/html, sling.resolutionPathInfo=.explorer.html,
 sling.modificationTime=1287528833921, sling.contentLength=5898,
 sling.resolutionPath=/index.html}*

 Resource type: *nt:file*

 Resource super type: *-*


 Resource properties

 jcr:createdBy: *admin*
 jcr:created:
 *java.util.GregorianCalendar[time=1287529282337,areFieldsSet=true,areAllFieldsSet=true,lenient=false,zone=sun.util.calendar.ZoneInfo[id="GMT+02:00",offset=720,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2010,MONTH=9,WEEK_OF_YEAR=43,WEEK_OF_MONTH=4,DAY_OF_MONTH=20,DAY_OF_YEAR=293,DAY_OF_WEEK=4,DAY_OF_WEEK_IN_MONTH=3,AM_PM=0,HOUR=1,HOUR_OF_DAY=1,MINUTE=1,SECOND=22,MILLISECOND=337,ZONE_OFFSET=720,DST_OFFSET=0]*



 jcr:primaryType: *nt:file
 *

 =
 *The bundle of the Sling Explorer is marked active in the console.
 *

 Also the simple script from the 15min tutorial that renders the title
 property does not get executed. Instead the HtmlRendererServlet dumps
 the Resource like that:
 =


 Resource dumped by HtmlRendererServlet

 Resource path: */content/mynode*

 Resource metadata: *{sling.resolutionPathInfo=.html,
 sling.resolutionPath=/content/mynode}*

 Resource type: *foo/bar*

 Resource super type: *-*


 Resource properties

 title: *some title*
 sling:resourceType: *foo/bar*
 jcr:primaryType: *nt:unstructured
 *=

 The curl commands that create the WebDAV folders and upload the script
 are executed successfully. And via WebDAV I can see that the script is
 there (/apps/foo/bar/html.esp).

 I debugged some resolver classes, searched at Google and tried to
 find a
 solution to that for quite some time now. But I have no idea left.
 Does somebody have a hint what I could try to get it working?

 Best,

 Sandro


>>>
>>
>>
> 


Re: script resolving doesn't work

2010-10-22 Thread Felix Meschberger
Hi,

On 22.10.2010 17:24, Justin Edelson wrote:
> Thanks Felix.
> 
> Perhaps this should just be configurable. I can see the pre-1842 behavior 
> being useful in dev, but the post-1842 being preferable in production.

Not so sure: The SLING-1842 behaviour was absolutely strict: no error
handling (except a single error message in the log) if the response has
been committed.

This means: error handlers are not called at all and  the new error
level filters are called neither.

What we could make configurable, though, is what the Sling error handler
(the DefaultErrorHandler from the Engine and the configurable error
handler support in the Servlet Resolver) do when called 

For now, they just write into the response (optionally resetting the
response if possible) ... we could limit this ...

Regards
Felix

> 
> Justin
> 
> On Oct 22, 2010, at 10:56 AM, Felix Meschberger  wrote:
> 
>> Hi all,
>>
>> I found the problem: The exceptions are not written back into the
>> responses any more because I recently cleanup what is getting written
>> back to the client in case of an error:
>>
>> As part of SLING-1842 I also modified the error handlers to not write an
>> error stuff into the response if the response cannot be reset. The idea
>> here is to not interfere with any content already sent back...
>>
>> But maybe, this is a completely wrong assumption and this should be
>> reverted ... Done with SLING-1850.
>>
>> Regards
>> Felix
>>
>> [1] https://issues.apache.org/jira/browse/SLING-1842
>> [2] https://issues.apache.org/jira/browse/SLING-1850
>>
>> On 20.10.2010 22:27, Sandro Boehme wrote:
>>> Hi Justin,
>>>
>>> I get the two test failures:
>>> testMaxCallsDetection(org.apache.sling.launchpad.webapp.integrationtest.JspIncludeTest)
>>>
>>> testInfiniteLoopDetection(org.apache.sling.launchpad.webapp.integrationtest.IncludeTest)
>>>
>>> Attached you find more detailed information and logs.
>>>
>>> Best,
>>>
>>> Sandro
>>>
>>> Am 20.10.10 21:34, schrieb Justin Edelson:
>>>> Sandro-
>>>> If you get a chance, please try out trunk now. I just committed a fix
>>>> which seems to be working for me, but it'll be a while before Hudson
>>>> confirms.
>>>>
>>>> Thanks,
>>>> Justin
>>>>
>>>> On 10/20/10 3:21 PM, Sandro Boehme wrote:
>>>>> I'm glad it was not a user error ;-). The problem simply was, that I
>>>>> checked out the trunk while it was not yet working properly.
>>>>> I should have had a look at the hudson build before updating from trunk.
>>>>> Using git (git://git.apache.org/sling.git) now to be able to easily
>>>>> revert my local experiments to the last working version of the trunk
>>>>> (right now this should be commit 129f4d btw).
>>>>>
>>>>> Best,
>>>>>
>>>>> Sandro
>>>>>
>>>>> Am 20.10.10 01:23, schrieb Sandro Boehme:
>>>>>> Hello,
>>>>>>
>>>>>> mvn clean install of sling on a fresh checkout from trunk did not show
>>>>>> any errors. Also running Jetty works and all bundles are active. But
>>>>>> the
>>>>>> scripts of the Sling Explorer don't get executed and the
>>>>>> HtmlRendererServlet is show like that:
>>>>>> =
>>>>>>
>>>>>>
>>>>>> Resource dumped by HtmlRendererServlet
>>>>>>
>>>>>> Resource path: */index.html*
>>>>>>
>>>>>> Resource metadata: *{sling.creationTime=1287529282337,
>>>>>> sling.contentType=text/html, sling.resolutionPathInfo=.explorer.html,
>>>>>> sling.modificationTime=1287528833921, sling.contentLength=5898,
>>>>>> sling.resolutionPath=/index.html}*
>>>>>>
>>>>>> Resource type: *nt:file*
>>>>>>
>>>>>> Resource super type: *-*
>>>>>>
>>>>>>
>>>>>> Resource properties
>>>>>>
>>>>>> jcr:createdBy: *admin*
>>>>>> jcr:created:
>>>>>> *java.util.GregorianCalendar[time=1287529282337,areFieldsSet=true,areAllFieldsSet=true,lenient=false,zone=sun.util.calendar.ZoneInfo[id="GMT+02:00",offset=720,dstSavings=0,useDaylight=false,transitions=0,lastRu

Re: request.getInputStream() yields unreadable stream

2010-10-26 Thread Felix Meschberger
Hi,

Sling processes the raw request input for multipart/form-data requests
to be able to transparently provide posted form data. This is an
extension ot the Servlet API which explicitly states that the Servlet
Container does not parse multipart/form-data requests.

See [1] and [2] for full details and information on how to get at
uploaded binary data (file uploads).

Regards
Felix

[1] http://sling.apache.org/site/request-parameters.html
[2]
http://sling.apache.org/apidocs/sling5/index.html?org/apache/sling/api/request/RequestParameter.html

On 26.10.2010 22:09, Carl Hall wrote:
> I'm trying to read the raw body of a request so I can proxy it over to
> another service but can't seem to read an input stream from the request.
> 
> This is the gist of my code:
> 
> protected void doPost(SlingHttpServletRequest request,
> SlingHttpServletResponse response)
>   throws ServletException, IOException {
> InputStream is = request.getInputStream();
> int i = is.read();  // i == -1 , always
> }
> 
> Should I use a different means to get an input stream for the request body?
> 


Re: Delete Node with resourceType Handler

2010-10-26 Thread Felix Meschberger
Hi,

Have your servlet implement the OptingServlet [1] interface and return
false from the accepts method if you encounter the ":operation" request
parameter.

This way, your servlet will not be called in these circumstances and
thus the search for a servlet to call will continue ultimatelively
leading to the default POST servlet.

Regards
Felix

[1]
http://sling.apache.org/apidocs/sling5/index.html?org/apache/sling/api/servlets/OptingServlet.html

On 26.10.2010 19:07, Carl Hall wrote:
> I have a node, /var/proxy/scribd, that has sling:resourceType='sakai/proxy'
> which triggers a proxy handling servlet.  While in development, I often need
> to change properties on this node or delete the node entirely.  Since my
> servlet handles POST, it catches my call when I do "curl -F
> :operation=delete http://localhost:8080/var/proxy/scribd"; leaving me with
> the results of the servlet processing which is a 400 return code and thusly
> doesn't run the delete post processor.  Is there a way I can not run the
> resource type processor or do I need to add a catch for the delete command
> so my servlet stops processing gracefully to allow deletion?
> 


Re: OpenID authenticationhandler j_security_check

2010-10-27 Thread Felix Meschberger
Hi

this looks like a bug in the login form generation. It should probably
really include the path of the authentication handler registration
which triggered the login form being rendered.

Can you please report a JIRA ? Thanks.

Regards
Felix

On Wed, Oct 27, 2010 at 11:53 AM, Jos Snellings
 wrote:
> Dear sling users,
>
> Problem, just observed:
> - activated OpenID authentication handler on content tree "noanonymous"
>       => when accessing a resource, sling correctly displays the OpenID
> login form
>       however, the login form contains a form action:
>         enctype="multipart/form-data" accept-charset="UTF-8">
>
> When posting this form back, sling says:
>
>
>  Error while processing /j_security_check
>
> Status
> 500
> Message
> javax.jcr.AccessDeniedException: /j_security_check/openid_identifier: not
> allowed to add or modify item
> Location        /j_security_check 
> Parent Location         / 
> Path
> /j_security_check
> Referer         http://localhost:8080/system/sling/openid/login
> ChangeLog
>
> created("/j_security_check");
> modified("/j_security_check/openid_identifier");
>
>
> So it is the POST servlet who took the request and not the authentication
> handler, or ... j_security_check is not recognized.
> What did I overlook?
>
> Thanks!
> Jos
>
>
>
>
>
>
>
>
>
>


Re: OpenID authenticationhandler j_security_check

2010-11-01 Thread Felix Meschberger
Hi,

I have fixed SLING-1855 in trunk as well as the corrollary issue
SLING-1856 in trunk. To get the fix you will have to update the Sling
Authentication Core and OpenID Authentication bundles to the latest
trunk SNAPSHOTs.

Regards
Felix

Am Mittwoch, den 27.10.2010, 11:53 +0200 schrieb Jos Snellings: 
> Dear sling users,
> 
> Problem, just observed:
> - activated OpenID authentication handler on content tree "noanonymous"
> => when accessing a resource, sling correctly displays the 
> OpenID login form
> however, the login form contains a form action:
>   enctype="multipart/form-data" accept-charset="UTF-8">
> 
> When posting this form back, sling says:
> 
> 
>   Error while processing /j_security_check
> 
> Status
> 500
> Message   
> javax.jcr.AccessDeniedException: /j_security_check/openid_identifier: 
> not allowed to add or modify item
> Location  /j_security_check 
> Parent Location   / 
> Path  
> /j_security_check
> Referer   http://localhost:8080/system/sling/openid/login
> ChangeLog 
> 
> created("/j_security_check");
> modified("/j_security_check/openid_identifier");
>
> 
> 
> So it is the POST servlet who took the request and not the 
> authentication handler, or ... j_security_check is not recognized.
> What did I overlook?
> 
> Thanks!
> Jos
> 
> 
> 
> 
> 
>   
> 
>   
> 




Re: Using sling.include()

2010-11-01 Thread Felix Meschberger
Hi,

Am Samstag, den 30.10.2010, 12:58 -0500 schrieb Bruce Green: 
> Given the JSP example below what is the equivalent sling.include() statement
> in ESP? 

This would by

   sling.include(request.resource, "some/resource/type");

Regards
Felix

> 
> 
> 
> 
> <%...@page session="false"%>
> 
> <%...@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0"%>
> 
>  
> 
> 
> 
>  
> 
> 
> 
> 
> 
> 
> 
>  
> 
> <%= currentNode.toString() %>
> 
> 
> 
> 
> 




Re: Filter JCR Content Selectively

2010-11-04 Thread Felix Meschberger
Hi,

I'd register a request-level filter which does the filtering when one of
the to-be-filtered resources is requested and just does nothing if not.

This test is probably as simple as:

  if (match(slingRequest.getResource())) {
  response = createFilteringResponse(response);
   }
   chain.doFilter(request, response);

Regards
Felix

Am Donnerstag, den 04.11.2010, 10:06 -0400 schrieb Carl Hall: 
> I have UI static content files for client side rendering that lives in JCR
> under /dev.  I'd like to filter this content a bit to replace message keys 
> with
> language specific text as this step is currently being done on the client by
> javascript.  I'd prefer to not make these files into server side scripting
> files.  What's the best way to have everything under /dev get passed through
> a response filter/servlet?




Re: Replacing jackrabbit with other JCR implementation

2010-11-16 Thread Felix Meschberger
Hi,

Am Dienstag, den 16.11.2010, 09:54 +0100 schrieb Gunzenreiner Simon: 
> Hi all
> 
> I am looking into replacing the embedded Jackrabbit JCR implementation
> with another JCR 2.0 implementation (Modeshape). This should be possible
> in principle, right? What functionality in Sling is depending on
> Jackrabbit as a repository?

Interesting idea ;-)

> 
> I would appreciate any hints or guidance of how to achieve this and what
> pitfalls to avoid.

First off this should be possible. Basically it is just about replacing
jackrabbit-server bundle with your own bundle providing the
repository ...

You might want to use the jackrabbit-server bundle as a role-model.

One thing that may break is the node type loading functionality of the
jcr/base bundle. This uses Jackrabbit API which is not standardized
(There is in fact an old issue to replace this implementation with an
implementation leveraging the official JCR node type management API).

Two other things, that may break are the jcr/jackrabbit.usermanager
jcr/jackrabbit.accessmanager bundles.

Other than that, I would expect Sling to work properly with just about
any JCR 2.0 (most operations event only require JCR 1.0) compliant
repository.

If you stumble upon any issues, don't hesitate to ask !

If you succeed, don't hesitate to share your findings ;-)

Regards
Felix



Re: Question about streaming ability

2010-11-18 Thread Felix Meschberger
Hi Vic,

Am Freitag, den 19.11.2010, 10:43 +0800 schrieb Vicary Archangel: 
> I am an ActionScript developer and was intensively work under AMF against
> PHP and Java, but I have particularly interest in SSJS.
> 
> I am new to apache communities and the Sling project. While I can found no
> where but this mail list to ask questions, I'd put it here.

Welcome !

You have reached the right place to ask questions on using Sling.

> 
> The question is how does Sling handle streaming? And can it send binary data
> directly with pure JavaScript but not template things?

Do you want to know whether Sling is able to just provide raw files like
any regular Web Server like Apache httpd ?

Yes, Sling can do that. In fact we recently added support for the
If-Range and Range headers to the Sling get servlet helping with
streaming of Multi-media content.

> 
> In fact I'm seeking the possibility to implement an AMF-HTTP channel in the
> future.

Of course you can also implement a Servlet (or even a script in a
language like Groovy or JavaScript [I think this is your main interest,
right ?] or whatever comes with support for Java Scripting API) to
generate the content to send to the client, which may well be some AMF
serialization.

So, just come back when further questions arise -- and of course if you
want to contribute, you are welcome, too ;-)

Regards
Felix

> 
> If I have gone wrong place, please direct me to where I can ask this
> question. =]
> Thanks a lot.
> 
> cheers,
> Vic.




Re: question about accessing Sling in Java

2010-11-19 Thread Felix Meschberger
Hi,

If you are connecting using Java you have to provide the HTTP Basic
authentication header containing your credentials. We generally use the
Apache HttpComponents (or HttpClient) libraries to to HTTP connections.
See also the Integration tests, where we are leveraging HttpClient to
fire requests at Sling.

In HttpClient (I assume HttpComponents is similar) you would create a
Credentials object with the user name and password and registering with
the HttpClient object so that it is transparently used as requested by
the server.

Using the user name and password in the URL does not work.

Hope this helps.

Regards
Felix


Am Freitag, den 19.11.2010, 04:39 -0800 schrieb Zhongmiao Li: 
> Hi, I   have got stuck in a very  strange problem and hope anycould help
> me!
> 
> The address I use to access Sling is as follows:
> 
> http://admin:ad...@141.83.80.149:8080/content/nemoclient?sling:authRequestLogin=1
> 
> On my own computer ( the computer running Sling, whose Ip Address
> is 141.83.80.149), I can connect to Sling properly in Java program(Using
> HttpUrlConnection).  However, I can not connect to the server  in my  Java
> program on another computer! The error code is 401, Unauthorized.
>  But I can upload  and download files on any computer by HTML form. So can
> anyone help me to solve this problem?
> 




Re: Question about streaming ability

2010-11-22 Thread Felix Meschberger
Hi,

Am Montag, den 22.11.2010, 10:54 +0800 schrieb Vicary Archangel: 
> On Sat, Nov 20, 2010 at 3:46 AM, Justin Edelson 
> wrote:
> 
> > On 11/19/10 1:43 PM, Vicary Archangel wrote:
> > > Hi Justin,
> > >
> > > On Sat, Nov 20, 2010 at 12:39 AM, Justin Edelson <
> > justinedel...@gmail.com>wrote:
> > >>
> > >> Have you looked at just running BlazeDS or LCDS inside Felix/Sling? That
> > >> seems much simpler than writing your own RTMP server.
> > >>
> > >> Justin
> > >
> > >
> > > Thanks for the advise.
> > >
> > > It seems just a bit outta my expectation and interest if I run those
> > > Java thing
> > > inside Sling. My original thought is making the whole thing from back to
> > > front
> > > with JavaScript. (Says MongoDB at the back, along with Flash / AJAX)
> >
> > Out of the box, Sling's scripting harness only get invoked as part of
> > HTTP request processing. You'll have to write some bridge code in Java
> > to do something else.
> >
> > As I said, I don't know why you would do this instead of just using
> > BlazeDS.
> >
> > Justin
> >
> > >
> > > When there is already open source products there in Java, I believe
> > porting
> > > the
> > > whole thing into OSGi bundles will be only a handful of tasks.
> > >
> > > All I need is to confirm the ability of Sling in handling most of the
> > common
> > > used
> > > LCDS functionalities, before I start anything.
> > >
> > > Vic
> > >
> >
> >
> Yeah, you're right. If this is only to achieve the functionality, I can use
> anything. I can even have some workarounds in my apps and stick to my
> existing PHP classes.
> 
> When there is so much frameworks and Java web servers out there, I feel the
> fun comes from the unity of scripting languages in both client and server
> sides.
> 
> My first thought when I saw Sling is that an OSGi launchpad that supports
> scripting in processing requests in all three languages (JSP, SSJS and
> Scala), and doing everything Java supports (through calling OSGi bundles
> from the scripts). But what I learned is just a small portion of process is
> "scriptable".

What do you mean by "a small portion" ? Point is, that almost complete
request processing is in fact scriptable. The only things not scriptable
is the work being done by Sling on behalf of the developer:

  * Find the data to work on by resolving the URL. We present this
 as an instance of the  Resource interface to the request
  * Find a script or Servlet to call to process the request

The Script or Servlet can be written in plain Java (mostly regular
servlets) or any scripting language providing support for JSR 223 (Java
Scripting API). You are most interested in JavaScript it seems, so you
get this out of the box with Sling by our use of the Rhino
implementation.

Of course this is somewhat different to traditional web applications,
where the URL generally is first resolved to a Servlet being called and
the servlet then has to access/find the data itself.

Regards
Felix

> 
> There's nothing wrong with Sling, the concept does wiki and content driven
> websites very well. Just I might have gone a wrong place I guess.
> 
> Thanks for all of you in this thread anyways, you guys are really helpful.
> 
> Vic.




Re: how can I disable sling json servlet for some nodes?

2010-11-22 Thread Felix Meschberger
Hi,

The maximum depths supported for JSON requests is configurable for the
Default GET Servlet (IIRC the default is 200).

To disable the default JSON rendering for some nodes, you might want to
implement a JSON servlet/script that is assigned to these types of nodes
and which does "nothing" or sends back an error.

For example, to prevent rendering nt:folder nodes for JSON you might
register an Servlet service implementing the OptingServlet interface for
the nt/folder resource type and implement the accepts method to return
true or false in certain situations. In case false would be returned
your servlet is ignored and the default one used. In case true is
returned, your servlet would be called and you may then return whatever
you like incl. an error.

Regards
Felix

Am Montag, den 22.11.2010, 09:41 -0500 schrieb sam lee: 
> Is there a way to disable json servlet for some nodes?
> 
> For example, I can think of DDoS for sling applications:
> http://www.example.com/content/dam.tidy.-1.json
> http://www.example.com/content/dam.tidy.-2.json
> ...
> http://www.example.com/content/dam.acl.-1.json
> http://www.example.com/content/dam.acl.-2.json
> ...
> http://www.example.com/content/dam.eacl.-1.json
> http://www.example.com/content/dam.eacl.-2.json
> ...
> in parallel..
> where /content/dam is a very deep hierarchy.
> 
> I see live sites accepting such GET requests (for example, adobe.com).
> 
> How do you partially disable json servlet? (be it only selected nodes accept
> json request.. or maybe set a limit on json "level" selector?)
> 
> Thanks.
> Sam





  1   2   3   >