You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by Torgeir Veimo <to...@pobox.com> on 2008/01/22 07:30:03 UTC

embedding Apache DS as a webapp

I'm looking at the example shown here; http://directory.apache.org/apacheds/1.5/embedding-apacheds-as-a-web-application.html

I've sort of gettng it to work by tweaking a bit with jar files, but  
I'm also interested in packaging a server.xml file I've used with the  
standalone ApacheDS setup. I had a look at  
MutableServerStartupConfiguration to see if I could supply it with an  
InputSource/Stream to server.xml, but it seems to only accept a File  
for the working directory.

Any idea how to accomplish this? I'm planning to include an already  
configured DIT tree with data, and would require the webapp to run  
exploded, in order to allow it to use data from within the WEB-INF  
directory.

-- 
Torgeir Veimo
torgeir@pobox.com




Re: embedding Apache DS as a webapp

Posted by Emmanuel Lecharny <el...@gmail.com>.
Stefan Zoerner wrote:
> Hi Jürgen!
>
> Juergen Weber wrote:
>> Listening on a socket is kind of misbehaviour for web applications. It
>> were better if the app server would control the socket listener.
>>
>> See http://issues.apache.org/bugzilla/show_bug.cgi?id=39862
>
> This is really interesting!
>
> Please note that the described example is just a case study on how 
> simple it is to embed ApacheDS. One option to mitigate this 
> misbehavior would be to simply not start the network protocol, and 
> interact with ApacheDS solely in process like the RootDseServlet in 
> the example does.
Exactly. Embedding the server will also improve the performances a lot, 
as you won't have any need to encode/decode LDAP requests.



-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org



Re: embedding Apache DS as a webapp

Posted by Stefan Zoerner <st...@labeo.de>.
Hi Jürgen!

Juergen Weber wrote:
> Listening on a socket is kind of misbehaviour for web applications. It
> were better if the app server would control the socket listener.
> 
> See http://issues.apache.org/bugzilla/show_bug.cgi?id=39862

This is really interesting!

Please note that the described example is just a case study on how 
simple it is to embed ApacheDS. One option to mitigate this misbehavior 
would be to simply not start the network protocol, and interact with 
ApacheDS solely in process like the RootDseServlet in the example does.

But for the sake of an impressive example, I would opt on opening the 
network port ;-)

My favorite integration option for Tomcat would be a ApacheDSRealm 
anyway (Realm implementation with embedded ApacheDS), which uses an 
embedded ApacheDS for authentication/authorization. But this is another 
story (maybe later this year ...).

Greetings from Hamburg,
     Stefan


Re: embedding Apache DS as a webapp

Posted by Juergen Weber <we...@gmail.com>.
Listening on a socket is kind of misbehaviour for web applications. It
were better if the app server would control the socket listener.

See http://issues.apache.org/bugzilla/show_bug.cgi?id=39862

On Jan 22, 2008 7:45 PM, Stefan Zoerner <st...@labeo.de> wrote:
> Hi Torgeir!
>
>
> Torgeir Veimo wrote:
> > I'm looking at the example shown here;
> > http://directory.apache.org/apacheds/1.5/embedding-apacheds-as-a-web-application.html
> >
> > I've sort of gettng it to work by tweaking a bit with jar files, but I'm
> > also interested in packaging a server.xml file I've used with the
> > standalone ApacheDS setup. I had a look at
> > MutableServerStartupConfiguration to see if I could supply it with an
> > InputSource/Stream to server.xml, but it seems to only accept a File for
> > the working directory.
> >
> > Any idea how to accomplish this? I'm planning to include an already
> > configured DIT tree with data, and would require the webapp to run
> > exploded, in order to allow it to use data from within the WEB-INF
> > directory.
>
> I have created the example basically for demonstration purposes. It is
> therefore as simple as possible. The server.xml file is a Spring bean
> definition file, hence Spring is necessary to start up the server. For
> embedded use, this is not necessary. The configuration is done
> programmatically then. This is exactly what I wanted to show.
>
> Basically, it is possible to achieve all features available in the
> server.xml programatically as well. Spring is only used to wire the
> beans. The server.xml is a good option to configure the server without
> recompiling it. The example already takes advantage of the beans to some
> degree, like here:
>
> ...
> // Set LDAP port to 10389
> LdapConfiguration ldapCfg = cfg.getLdapConfiguration();
> ldapCfg.setIpPort(10389);
> ...
>
> You can do more (I assume: everything).
>
> Another option would be to deploy Spring with the webapp and modify the
> startup class (StartStopListener) to use the same startup style which is
> used standalone to fire up the server. In this case you may user the
> server.xml as well. Obviously, you have to reworkthe example for this.
>
> If you just want to deploy some data with ApacheDS. There are several
> options. One is to provide an LDIF file for startup, which may be
> included in the war-File (I have not tried this out, but it would be
> nice to extend the example this way ...).
>
> I hope this already helps a bit.
> Greetings from Hamburg,
>      Stefan
>
>

Re: embedding Apache DS as a webapp

Posted by Stefan Zoerner <st...@labeo.de>.
Hi Torgeir!

Torgeir Veimo wrote:
> I'm looking at the example shown here; 
> http://directory.apache.org/apacheds/1.5/embedding-apacheds-as-a-web-application.html 
> 
> I've sort of gettng it to work by tweaking a bit with jar files, but I'm 
> also interested in packaging a server.xml file I've used with the 
> standalone ApacheDS setup. I had a look at 
> MutableServerStartupConfiguration to see if I could supply it with an 
> InputSource/Stream to server.xml, but it seems to only accept a File for 
> the working directory.
> 
> Any idea how to accomplish this? I'm planning to include an already 
> configured DIT tree with data, and would require the webapp to run 
> exploded, in order to allow it to use data from within the WEB-INF 
> directory.

I have created the example basically for demonstration purposes. It is 
therefore as simple as possible. The server.xml file is a Spring bean 
definition file, hence Spring is necessary to start up the server. For 
embedded use, this is not necessary. The configuration is done 
programmatically then. This is exactly what I wanted to show.

Basically, it is possible to achieve all features available in the 
server.xml programatically as well. Spring is only used to wire the 
beans. The server.xml is a good option to configure the server without 
recompiling it. The example already takes advantage of the beans to some 
degree, like here:

...
// Set LDAP port to 10389
LdapConfiguration ldapCfg = cfg.getLdapConfiguration();
ldapCfg.setIpPort(10389);
...

You can do more (I assume: everything).

Another option would be to deploy Spring with the webapp and modify the 
startup class (StartStopListener) to use the same startup style which is 
used standalone to fire up the server. In this case you may user the 
server.xml as well. Obviously, you have to reworkthe example for this.

If you just want to deploy some data with ApacheDS. There are several 
options. One is to provide an LDIF file for startup, which may be 
included in the war-File (I have not tried this out, but it would be 
nice to extend the example this way ...).

I hope this already helps a bit.
Greetings from Hamburg,
     Stefan