<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Jackrabbit with Spring</title>
	<atom:link href="http://lorands.com/2008/11/jackrabbit-with-spring/feed/" rel="self" type="application/rss+xml" />
	<link>http://lorands.com/2008/11/jackrabbit-with-spring/</link>
	<description>Thoughts on Software Development…</description>
	<lastBuildDate>Mon, 09 May 2011 14:32:31 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Paco Avila</title>
		<link>http://lorands.com/2008/11/jackrabbit-with-spring/comment-page-1/#comment-2602</link>
		<dc:creator>Paco Avila</dc:creator>
		<pubDate>Mon, 09 May 2011 14:32:31 +0000</pubDate>
		<guid isPermaLink="false">http://lorand.somogyi.name/?p=115#comment-2602</guid>
		<description>Yes, I will try some other ways to achieve this but not sure because I&#039;m far from being an expert in Spring. </description>
		<content:encoded><![CDATA[<p>Yes, I will try some other ways to achieve this but not sure because I&#039;m far from being an expert in Spring.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lóránd Somogyi</title>
		<link>http://lorands.com/2008/11/jackrabbit-with-spring/comment-page-1/#comment-2309</link>
		<dc:creator>Lóránd Somogyi</dc:creator>
		<pubDate>Mon, 28 Sep 2009 05:26:52 +0000</pubDate>
		<guid isPermaLink="false">http://lorand.somogyi.name/?p=115#comment-2309</guid>
		<description>&lt;a href=&quot;#comment-2307&quot; rel=&quot;nofollow&quot;&gt;@Paco Avila &lt;/a&gt; 
Sorry for delay. Still in trouble with passing credentials?</description>
		<content:encoded><![CDATA[<p><a href="#comment-2307" rel="nofollow">@Paco Avila </a><br />
Sorry for delay. Still in trouble with passing credentials?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paco Avila</title>
		<link>http://lorands.com/2008/11/jackrabbit-with-spring/comment-page-1/#comment-2307</link>
		<dc:creator>Paco Avila</dc:creator>
		<pubDate>Tue, 01 Sep 2009 10:56:38 +0000</pubDate>
		<guid isPermaLink="false">http://lorand.somogyi.name/?p=115#comment-2307</guid>
		<description>Yes, this is the objetive but is complicated for me to archieve :) I don&#039;t know how to pass the authentication credentials to the jackrabbit session :(</description>
		<content:encoded><![CDATA[<p>Yes, this is the objetive but is complicated for me to archieve <img src='http://lorands.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I don&#8217;t know how to pass the authentication credentials to the jackrabbit session <img src='http://lorands.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lóránd Somogyi</title>
		<link>http://lorands.com/2008/11/jackrabbit-with-spring/comment-page-1/#comment-2306</link>
		<dc:creator>Lóránd Somogyi</dc:creator>
		<pubDate>Mon, 31 Aug 2009 15:56:33 +0000</pubDate>
		<guid isPermaLink="false">http://lorand.somogyi.name/?p=115#comment-2306</guid>
		<description>&lt;a href=&quot;#comment-2305&quot; rel=&quot;nofollow&quot;&gt;@Paco Avila &lt;/a&gt; 
In that case you need to pass the user/password to the jackrabbit configuration, and make sure those credentials are the same in Jackrabbit. - IMO in cases like that service authorization, - or at least part of it, - should come from Jackrabbit.</description>
		<content:encoded><![CDATA[<p><a href="#comment-2305" rel="nofollow">@Paco Avila </a><br />
In that case you need to pass the user/password to the jackrabbit configuration, and make sure those credentials are the same in Jackrabbit. &#8211; IMO in cases like that service authorization, &#8211; or at least part of it, &#8211; should come from Jackrabbit.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paco Avila</title>
		<link>http://lorands.com/2008/11/jackrabbit-with-spring/comment-page-1/#comment-2305</link>
		<dc:creator>Paco Avila</dc:creator>
		<pubDate>Mon, 31 Aug 2009 12:19:09 +0000</pubDate>
		<guid isPermaLink="false">http://lorand.somogyi.name/?p=115#comment-2305</guid>
		<description>Well, not the same thing: in jackrabbit you usually add access info to nodes and implement and AccessManager so the JCR framework can decide if an user have permissions to read a node. 

If you make a XPath search in JCR, the system will show only the matches nodes where the user who launched the query have access.</description>
		<content:encoded><![CDATA[<p>Well, not the same thing: in jackrabbit you usually add access info to nodes and implement and AccessManager so the JCR framework can decide if an user have permissions to read a node. </p>
<p>If you make a XPath search in JCR, the system will show only the matches nodes where the user who launched the query have access.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lóránd Somogyi</title>
		<link>http://lorands.com/2008/11/jackrabbit-with-spring/comment-page-1/#comment-2304</link>
		<dc:creator>Lóránd Somogyi</dc:creator>
		<pubDate>Sun, 09 Aug 2009 20:47:34 +0000</pubDate>
		<guid isPermaLink="false">http://lorand.somogyi.name/?p=115#comment-2304</guid>
		<description>&lt;a href=&quot;#comment-2303&quot; rel=&quot;nofollow&quot;&gt;@Paco Avila &lt;/a&gt; 
I&#039;m not getting it. From your code you are authenticating the user with spring. So in your spring container you have a loged in user. But you do not pass the same user to jackrabbit... If you would like to do that, you would need to pass the user to Jackrabbit too. 

Usually you would not do that. Same as with any database access: one use it with a single user/role, which is different from the container user. In that case you would handle privileges with the container (spring) and not within the database, - or in this case Jackrabbit.</description>
		<content:encoded><![CDATA[<p><a href="#comment-2303" rel="nofollow">@Paco Avila </a><br />
I&#8217;m not getting it. From your code you are authenticating the user with spring. So in your spring container you have a loged in user. But you do not pass the same user to jackrabbit&#8230; If you would like to do that, you would need to pass the user to Jackrabbit too. </p>
<p>Usually you would not do that. Same as with any database access: one use it with a single user/role, which is different from the container user. In that case you would handle privileges with the container (spring) and not within the database, &#8211; or in this case Jackrabbit.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paco Avila</title>
		<link>http://lorands.com/2008/11/jackrabbit-with-spring/comment-page-1/#comment-2303</link>
		<dc:creator>Paco Avila</dc:creator>
		<pubDate>Fri, 31 Jul 2009 09:23:46 +0000</pubDate>
		<guid isPermaLink="false">http://lorand.somogyi.name/?p=115#comment-2303</guid>
		<description>&lt;a href=&quot;#comment-2302&quot; rel=&quot;nofollow&quot;&gt;@Lóránd Somogyi &lt;/a&gt; 
Thanks! Now there is no NPE thrown.

But I have another issue: session.getUserID() is returning &quot;anonymous&quot; in place of the web authenticated user name. Do you have any idea why is this happening?

Thanks again :)</description>
		<content:encoded><![CDATA[<p><a href="#comment-2302" rel="nofollow">@Lóránd Somogyi </a><br />
Thanks! Now there is no NPE thrown.</p>
<p>But I have another issue: session.getUserID() is returning &#8220;anonymous&#8221; in place of the web authenticated user name. Do you have any idea why is this happening?</p>
<p>Thanks again <img src='http://lorands.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lóránd Somogyi</title>
		<link>http://lorands.com/2008/11/jackrabbit-with-spring/comment-page-1/#comment-2302</link>
		<dc:creator>Lóránd Somogyi</dc:creator>
		<pubDate>Fri, 31 Jul 2009 08:43:25 +0000</pubDate>
		<guid isPermaLink="false">http://lorand.somogyi.name/?p=115#comment-2302</guid>
		<description>&lt;a href=&quot;#comment-2300&quot; rel=&quot;nofollow&quot;&gt;@Paco Avila &lt;/a&gt; 
I&#039;ve checked your project. According to your configuration your TopicService is *not* beanfactory managed. On the other hand in SimpleServlet you created a *new* instance of TopicService, so even if you would have it managed by spring this would be a new instance.

The solution:
1. In application-context.xml register the service (you can do this with javaconfig too, but this is the old fashion way):


&lt;pre&gt;
	&lt;bean name=&quot;myService&quot; class=&quot;org.monkiki.TopicService&quot; /&gt;
&lt;/pre&gt;


2. In SimpleServlet make sure you use the managed instance. For example:


&lt;pre&gt;
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		try {
			WebApplicationContext wac = WebApplicationContextUtils
						.getWebApplicationContext(
						request.getSession().getServletContext()
						);
			TopicService ts = (TopicService) wac.getBean(&quot;myService&quot;);
			ts.myFunction();
		} catch (Exception e) {
			log.error(e.getMessage(), e);
		}
	}
&lt;/pre&gt;


This setup now works for me. (JBoss and Tomcat too).</description>
		<content:encoded><![CDATA[<p><a href="#comment-2300" rel="nofollow">@Paco Avila </a><br />
I&#8217;ve checked your project. According to your configuration your TopicService is *not* beanfactory managed. On the other hand in SimpleServlet you created a *new* instance of TopicService, so even if you would have it managed by spring this would be a new instance.</p>
<p>The solution:<br />
1. In application-context.xml register the service (you can do this with javaconfig too, but this is the old fashion way):</p>
<pre>
	&lt;bean name="myService" class="org.monkiki.TopicService" /&gt;
</pre>
<p>2. In SimpleServlet make sure you use the managed instance. For example:</p>
<pre>
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		try {
			WebApplicationContext wac = WebApplicationContextUtils
						.getWebApplicationContext(
						request.getSession().getServletContext()
						);
			TopicService ts = (TopicService) wac.getBean("myService");
			ts.myFunction();
		} catch (Exception e) {
			log.error(e.getMessage(), e);
		}
	}
</pre>
<p>This setup now works for me. (JBoss and Tomcat too).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paco Avila</title>
		<link>http://lorands.com/2008/11/jackrabbit-with-spring/comment-page-1/#comment-2301</link>
		<dc:creator>Paco Avila</dc:creator>
		<pubDate>Fri, 31 Jul 2009 07:34:40 +0000</pubDate>
		<guid isPermaLink="false">http://lorand.somogyi.name/?p=115#comment-2301</guid>
		<description>I forgot to mention: I deploy the war in a JBoss 4.2.2.GA (not sure if this matters)</description>
		<content:encoded><![CDATA[<p>I forgot to mention: I deploy the war in a JBoss 4.2.2.GA (not sure if this matters)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paco Avila</title>
		<link>http://lorands.com/2008/11/jackrabbit-with-spring/comment-page-1/#comment-2300</link>
		<dc:creator>Paco Avila</dc:creator>
		<pubDate>Fri, 31 Jul 2009 07:33:56 +0000</pubDate>
		<guid isPermaLink="false">http://lorand.somogyi.name/?p=115#comment-2300</guid>
		<description>&lt;a href=&quot;#comment-2299&quot; rel=&quot;nofollow&quot;&gt;@Lóránd Somogyi &lt;/a&gt; 
Yes, Jackrabbit configuration is ok. The repository is created. Here is a very simple eclipse &amp; maven project which reproduce this issue: http://rapidshare.com/files/262044081/test_jcr.zip.html</description>
		<content:encoded><![CDATA[<p><a href="#comment-2299" rel="nofollow">@Lóránd Somogyi </a><br />
Yes, Jackrabbit configuration is ok. The repository is created. Here is a very simple eclipse &amp; maven project which reproduce this issue: <a href="http://rapidshare.com/files/262044081/test_jcr.zip.html" rel="nofollow">http://rapidshare.com/files/262044081/test_jcr.zip.html</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

