karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Nodet <gno...@gmail.com>
Subject Re: jetty.xml --> spring jetty.xml
Date Fri, 24 Dec 2010 07:26:35 GMT
On Friday, December 24, 2010, Charles Moulliard <cmoulliard@gmail.com> wrote:
> Indeed this will not be easy as pax-web must be changed because it
> uses a method of jetty to load the resource file (jetty.xml).

Yes, that's clearly not an easy task.


>
>         public void start() {
>                 LOG.debug("Starting " + this);
>                 try {
>                         //PAXWEB-193 suggested we should open this up for
external configuration
>                         URL jettyResource = getClass().getResource("/jetty.xml");
>                         File serverConfigurationFile = getServerConfigDir();
>                         if (serverConfigurationFile != null) {
>                                 if (LOG.isDebugEnabled())
>                                         LOG.debug("found server configuration
file: "+serverConfigurationFile);
>                                 if (!serverConfigurationFile.isDirectory()
&&
> serverConfigurationFile.canRead()) {
>                                         if (LOG.isDebugEnabled())
{
>                                                 LOG.debug("server
config dir is readable and exists");
>                                         }
>                                         String fileName = serverConfigurationFile.getName();
>                                         if (fileName.equalsIgnoreCase("jetty.xml"))
>                                                 jettyResource
= serverConfigurationFile.toURI().toURL();
>                                 }
>                         }
>                         if (jettyResource != null) {
>                                 ClassLoader loader = Thread.currentThread().getContextClassLoader();
>                                 try
>                                 {
>                                         Thread.currentThread().setContextClassLoader(
> getClass().getClassLoader() );
>                                         LOG.debug("Configure using
resource " + jettyResource);
>                                         XmlConfiguration configuration
= new XmlConfiguration(jettyResource);
>                                         configuration.configure(m_server);
>                                 }
>                                 finally
>                                 {
>                                         Thread.currentThread().setContextClassLoader(
loader );
>                                 }
>                         }
>                         m_server.start();
>                 } catch (Exception e) {
>                         LOG.error(e);
>                 }
>         }
>
> By the way, why don't we expose as a OSGI service the HTTP parameters
> that we need to configure the Jetty Server. In this case, xml file +
> blueprint can be used to configure the HTTP Parameters interface and
> then we can inject this reference in pax-web to provide all the info
> required to configure Jetty Server (port number, session timeout,
> beans definition to configure securityHandler, .....)

Some of them are already exposed through ConfigAdmin, but even if we
add some, it may still be limited. But I agree that could be a way to
go, as pax-web already supports ConfigAdmin and reloading of the
configuration (which is lost when modifying the jetty.xml btw).
I'm not sure why we would use an OSGi service to access this config though.

>
> Otherwise, we can create for Karaf project a bundle extending OSGI
> HTTP. We can mix the work done with camel-jetty + blueprint + Apache
> Felix HTTP to reach this goal ....

I would definitely try to avoid that as that's really *A LOT* of work.


>
>
>
> On Thu, Dec 23, 2010 at 7:05 PM, Guillaume Nodet <gnodet@gmail.com> wrote:
>> If we were to change, I'd rather use a blueprint config  coupled with
>> some ConfigAdmin support so that we can change the jetty configuration
>> more easily.
>> Though I don't think it's that easy to switch, as pax-web needs to be
>> enhanced I'd think.
>>
>> On Thu, Dec 23, 2010 at 18:48, Charles Moulliard <cmoulliard@gmail.com> wrote:
>>> Hi,
>>>
>>> I would like to suggest that we use spring bean syntax to configure
>>> the jetty server. As the spring beans xml syntax is much more
>>> supported by all the developers, that would simplify the configuration
>>> of the jetty.xml file instead of the proprietary syntax used.
>>>
>>> http://wiki.eclipse.org/Jetty/Howto/Spring
>>>
>>> Regards,
>>>
>>> Charles Moulliard
>>>
>>> Sr. Principal Solution Architect - FuseSource
>>> Apache Committer
>>>
>>> Blog : http://cmoulliard.blogspot.com
>>> Twitter : http://twitter.com/cmoulliard
>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard
>>> Skype: cmoulliard
>>>
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>> ------------------------
>> Open Source SOA
>> http://fusesource.com
>>
>

-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Mime
View raw message