Re: Exposing DB Data
Write access is a little less clear to me. I'd like to have a servlet which handles json, xml or form POSTs for anything submitted to the path of my ResourceProvider. I think I need to do this: 1. MyResourceTypeProvider implements JcrResourceTypeProvider - provider.roots = /my/resources - any node below the root is returned as resourceType my/Model, otherwise return null 2. MyPostServlet extends SlingAllMethodsServlet - registered to handle nodes of type my/Model - override doPost() to handle data based on content-type - creates new database entries using MyService That would allow the creation of a new database row by posting an appropriate json or xml file to /my/resource/*.html . For the form data, I'd conform to the SlingPostServlet interface to remain compatible with generic node editing. Am I thinking about this correctly, or is their a more appropriate Sling-Way? Hmm not sure :) I guess your idea should work. Now, for updating db data it should already work if your resource is adaptable to PersistableValueMap. For adding/deleting resources something like the above might work. We are thinking of extending the resource provider interface to get better support for these use cases. This is one of the topics for the near future, so maybe we should start thinking about this (again) now :) The PersistableValueMap seems like a good way to go. If I extend MyResourceProvider to allow creation of MyResources from a node, I should then consider adding a SlingPostProcessor instead, which would use MyResourceProvider.createResourceForNode(n) for any nodes created under /my/resource. I guess I'd have to undo any nodes actually created in the jcr since they'd be masked by MyResourceProvider. But, that would then get me round-trip node semantics. For xml or json posts, I've noticed the OptingServlet interface, which is probably a better approach than trying to use the JcrResourceTypeProvider to assert a default resource type in an attempt to resolve the request to a POST servlet mapped to that type. I could then register my POST servlets as default resource type handlers, which only opt-in for post requests to the appropriate path and http content-type. Better, right? Thanks for your advice, Andreas
Openid integration for Sling 3
Hi Tanmay I went down this road once before when developing the OpenIDAuthenticationHandler. OpenID4Java has a large number of dependencies, some of which are not even required for basic operation (though your last email is not an example of that). I eventually switched (at Felix's suggestion) to using the dyuproject OpenID APIs, which are very lightweight in terms of dependencies & much easier to integrate. Take a look at that and see if it accomplishes what you need. Also, if you are just implementing OpenID authentication (and not self-registration, attribute exchange etc) for Sling, there is already an OpenID hander in bundles/extensions/openidauth that might work for you. Regards, Rory
Re: Content Packaging
Great! Thank you Vidar. On Thu, Jun 4, 2009 at 4:21 AM, Vidar Ramdal wrote: > 2009/6/3 John Crawford : > > > Is anyone aware of content / node packaging built-in functionality? I > found > > a url [1] on initial content loading with Sling, but may be a little > > incomplete. > > The docs are undergoing an update. > > Currently there's a more up-to-date description of the content loading > mechanism at > http://cwiki.apache.org/confluence/display/SLING/Content+Loading > > > [1] http://incubator.apache.org/sling/site/content-loading.html > > > -- > Vidar S. Ramdal - http://www.idium.no > Akersgata 16, N-0158 Oslo, Norway > +47 21 531941, ext 2070 >
Re: Openid integration for Sling 3
Hi Carsten, Thanks for suggesting me the right jar. After that I needed some more jars as 1. commons-httpclient-3.1.jar 2. openxri-client-1.0.1.jar 3. openxri-syntax-1.0.1.jar 4. xercesImpl-2.9.1.jar 5. htmlparser.jar 6. xml-security-1.0.4.jar 7. xalan-2.6.0.jar Now it is throwing me org/apache/xpath/compiler/FuncLoader (500) The requested URL /jcrdev/openid resulted in an error in org.apache.sling.samples.jcrdev.servlets.SampleConsumerServlet. Exception: java.lang.NoClassDefFoundError: org/apache/xpath/compiler/FuncLoader at org.openxri.xml.XRD.(XRD.java:108) at org.openid4java.discovery.Discovery.(Discovery.java:58) at org.openid4java.consumer.ConsumerManager.(ConsumerManager.java:51) at org.apache.sling.samples.jcrdev.servlets.SampleConsumerServlet.authRequest(SampleConsumerServlet.java:93) at org.apache.sling.samples.jcrdev.servlets.SampleConsumerServlet.doPost(SampleConsumerServlet.java:67) at org.apache.sling.samples.jcrdev.servlets.SampleConsumerServlet.doGet(SampleConsumerServlet.java:59) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:462) at org.apache.sling.engine.impl.SlingMainServlet.processRequest(SlingMainServlet.java:419) at org.apache.sling.engine.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:48) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:54) at org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter.doFilter(RequestProgressTrackerLogFilter.java:59) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:52) at org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:273) at org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:171) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) at org.ops4j.pax.web.service.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:51) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:722) at org.ops4j.pax.web.service.internal.HttpServiceContext.handle(HttpServiceContext.java:87) at org.ops4j.pax.web.service.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:63) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) But the class already stays in xalan-2.6.0.jar. If you have any idea please share with me. Regards, Tanmay On Thu, Jun 4, 2009 at 12:16 PM, Carsten Ziegeler wrote: > Tanmay Barman wrote: > > Hi all, > > I was trying to integrate openid in my project that is based on sling 3. > I > > was trying with openid4java api. But I am having the following error > > > > java.lang.NoClassDefFoundError: > > org/apache/commons/httpclient/methods/RequestEntity > Hi, > > the class in question has been added to httpclient in version 3.0, so > you need to add commons httpclient 3.1 or similar to your bundles. > > Regards > Carsten > > > at > org.apache.sling.samples.jcrdev.servlets.SampleConsumerServlet.authRequest(SampleConsumerServlet.java:93) > > at > org.apache.sling.samples.jcrdev.servlets.SampleConsumerServlet.doPost(SampleConsumerServlet.java:67) > > at > org.apache.sling.samples.jcrdev.servlets.SampleConsumerServlet.doGet(SampleConsumerServlet.java:59) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) > > at > org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:462) > > at > org.apache.sling.engine.impl.SlingMainServlet.processRequest(SlingMainServlet.java:419) > > at > org.apache.sling.engine.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:48) > > at > org.apache.sling.engine.impl.filter.AbstractSl
[jira] Resolved: (SLING-986) Dynamic URL rewriting as per discussion on list.
[ https://issues.apache.org/jira/browse/SLING-986?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ian Boston resolved SLING-986. -- Resolution: Invalid I now believe this approach to be invalid, as the same results can be achieved with a simple servlet request dispatch. Closing as invalid to avoid adding more unused code to sling. (We will have reverted this patch from our branch) > Dynamic URL rewriting as per discussion on list. > > > Key: SLING-986 > URL: https://issues.apache.org/jira/browse/SLING-986 > Project: Sling > Issue Type: New Feature > Components: Engine >Affects Versions: JCR Resource 2.0.6 >Reporter: Ian Boston > Attachments: SLING-251.patch > > > After discussion on list http://markmail.org/thread/yvm3xoqtmpvrkijk > The patch to follow creates the ability to have nodes of the following form > /etc/map/http/myhost/~ > -> sling:mapper=(prefix='~') > Where the value of the sling:mapper property is a valid OSGi Filter and > locates a Service implementation of type MappingResolver. > Where the request path matches pattern, the service will be used to resolve > the request path to an internal path and to map the internal path to a url. > The patch that follows is a first pass, that passes existing tests, but does > not have unit test coverage. > One area of concern is the extent to which the bundle context needs to be > propagated to facilitate a ServiceTracker. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
Re: Content Packaging
2009/6/3 John Crawford : > Is anyone aware of content / node packaging built-in functionality? I found > a url [1] on initial content loading with Sling, but may be a little > incomplete. The docs are undergoing an update. Currently there's a more up-to-date description of the content loading mechanism at http://cwiki.apache.org/confluence/display/SLING/Content+Loading > [1] http://incubator.apache.org/sling/site/content-loading.html -- Vidar S. Ramdal - http://www.idium.no Akersgata 16, N-0158 Oslo, Norway +47 21 531941, ext 2070