jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alessandro Bologna" <alessandro.bolo...@gmail.com>
Subject Re: [ANNOUNCE] Apache Jackrabbit 1.4 released
Date Wed, 16 Jan 2008 16:51:03 GMT
Jukka,

thank you, this helps a lot to understand (glad I didn't have to sift
through the code), and the new architecture seems to be quite better!
Alessandro


On Jan 16, 2008 10:37 AM, Jukka Zitting <jukka.zitting@gmail.com> wrote:
> HI,
>
> On Jan 16, 2008 4:25 PM, Alessandro Bologna
> <alessandro.bologna@gmail.com> wrote:
> > I have installed the new webapp war file, and I have a question
> > regarding its architecture. Is it using the new
> > org.apache.jackrabbit.servlet classes or still relying on the previous
> > architecture? Looking at the web.xml, it seems that is not. And if
> > not, is there any sample implementation for the new classes?
>
> The webapp is still based on the good old RepositoryStartupServlet,
> but the webapp includes the jackrabbit-jcr-servlet jar and the
> RepositoryStartupServlet extends AbstractRepositoryServlet, which
> makes it easy to integrate with the other new servlet classes. See
> also the new instruction pages (.../local.jsp and .../remote.jsp)
> included in the webapp.
>
> Thanks to RepositoryStartupServlet extending
> AbstractRepositoryServlet, the started repository is automatically
> available as the javax.jcr.Repository servlet context attribute. This
> makes it easy to use the repository with other classes from
> jackrabbit-jcr-servlet.
>
> For example to bind the started repository in the local JNDI tree,
> just add the following to the web.xml descriptor:
>
>    <servlet>
>      <servlet-name>JNDIBinding</servlet-name>
>      <servlet-class>org.apache.jackrabbit.servlet.JNDIBindingServlet</servlet-class>
>      <load-on-startup>10<load-on-startup>
>    </servlet>
>
> See [1] for the available init parameters to better configure the JNDI
> binding. (Note that you can also do the JNDI binding with previous
> RepositoryStartupServlet configuration options, this example is just
> to show you how the new servlets work.)
>
> Alternatively, if you want to access the repository from another
> webapp in the same servlet container and don't have (or don't want to
> set up) a shared writable JNDI directory through which to make the
> repository available, you can use cross-context access to look
> directly into the servlet context of the Jackrabbit webapp. Use the
> following in your webapp:
>
>    <servlet>
>      <servlet-name>Repository</servlet-name>
>      <servlet-class>org.apache.jackrabbit.servlet.CrossContextRepositoryServlet</servlet-class>
>      <init-param>
>        <param-name>path</param-name>
>        <param-value>/jackrabbit-webapp-1.4</param-value>
>        <description>Context path of the Jackrabbit webapp</description>
>      </init-param>
>      <load-on-startup>1<load-on-startup>
>    </servlet>
>
> For this to work, you need to enable cross-context access for your
> webapp. In Tomcat this happens by setting crossContext="true" in the
> <Context/> configuration.
>
> With that in place, you can access the repository in your webapp quite
> easily like this:
>
>    import javax.jcr.Repository;
>    import org.apache.jackrabbit.servlet.ServletRepository;
>
>    public class MyServlet extends HttpServlet {
>        private final Repository repository = new ServletRepository(this);
>
>        // ...
>    }
>
> [1] http://jackrabbit.apache.org/api/1.4/org/apache/jackrabbit/servlet/JNDIBindingServlet.html
>
> BR,
>
> Jukka Zitting
>

Mime
View raw message