You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2007/02/12 09:29:07 UTC

[jira] Created: (FELIX-212) commons-httpclient 3.0.1 wrapping

commons-httpclient 3.0.1 wrapping
---------------------------------

                 Key: FELIX-212
                 URL: https://issues.apache.org/jira/browse/FELIX-212
             Project: Felix
          Issue Type: New Feature
          Components: Felix Commons
            Reporter: Felix Meschberger


Create an OSGi bundle for the commons-httpclient 3.0.1 jar.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Work started: (FELIX-212) commons-httpclient 3.0.1 wrapping

Posted by "Enrique Rodriguez (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-212?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on FELIX-212 started by Enrique Rodriguez.

> commons-httpclient 3.0.1 wrapping
> ---------------------------------
>
>                 Key: FELIX-212
>                 URL: https://issues.apache.org/jira/browse/FELIX-212
>             Project: Felix
>          Issue Type: New Feature
>          Components: Felix Commons
>            Reporter: Felix Meschberger
>         Assigned To: Enrique Rodriguez
>            Priority: Minor
>         Attachments: pom.xml
>
>
> Create an OSGi bundle for the commons-httpclient 3.0.1 jar.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-212) commons-httpclient 3.0.1 wrapping

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-212?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger updated FELIX-212:
------------------------------------

    Attachment: pom.xml

> commons-httpclient 3.0.1 wrapping
> ---------------------------------
>
>                 Key: FELIX-212
>                 URL: https://issues.apache.org/jira/browse/FELIX-212
>             Project: Felix
>          Issue Type: New Feature
>          Components: Felix Commons
>            Reporter: Felix Meschberger
>            Priority: Minor
>         Attachments: pom.xml
>
>
> Create an OSGi bundle for the commons-httpclient 3.0.1 jar.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (FELIX-212) commons-httpclient 3.0.1 wrapping

Posted by "Enrique Rodriguez (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-212?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Enrique Rodriguez reassigned FELIX-212:
---------------------------------------

    Assignee: Enrique Rodriguez

> commons-httpclient 3.0.1 wrapping
> ---------------------------------
>
>                 Key: FELIX-212
>                 URL: https://issues.apache.org/jira/browse/FELIX-212
>             Project: Felix
>          Issue Type: New Feature
>          Components: Felix Commons
>            Reporter: Felix Meschberger
>         Assigned To: Enrique Rodriguez
>            Priority: Minor
>         Attachments: pom.xml
>
>
> Create an OSGi bundle for the commons-httpclient 3.0.1 jar.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: (FELIX-212) commons-httpclient 3.0.1 wrapping

Posted by Roland Weber <ht...@dubioso.net>.
Hello Enrique,

> We are using Maven 2 and the "Bundle Plugin for Maven"
> (maven-bundle-plugin):
> http://cwiki.apache.org/FELIX/bundle-plugin-for-maven-bnd.html
> 
> There was a BerliOS bundle plugin for Maven 1, but it didn't have some
> key functionality you would really want.  As for minimum JDK version
> required, I don't know.
> 
> Opening an issue and working within your project would be great.

I've thought it over and came to the conclusion that OSGi support in
HttpClient 3.x is not a good idea. See Niclas' mail for one example,
and there are others. HttpClient 3 is simply not designed to be run
as a shared library. If we added the OSGi meta information, we'd be
encouraging users to run the code in an environment for which it is
ill suited.

We started a complete API redesign about two years ago:
componentized, new abstractions for the relevant concepts, all code
in new packages. The results of this work on HttpComponents [1],
which will include HttpClient 4, have recently started to pick up
traction. We'll be making sure that the new code base can be used
safely as a shared library. And since our releases for 4.0 are
built using Maven 2, we can employ the plugin you mentioned. I'll
keep it on my to-do list [2], and hopefully HttpComponents 4.0
releases will include the OSGi information later this year. That
of course depends on other people's views. Thanks for the pointers.

cheers,
  Roland

[1] http://jakarta.apache.org/httpcomponents/
[2] https://issues.apache.org/jira/browse/HTTPCLIENT-639


Re: (FELIX-212) commons-httpclient 3.0.1 wrapping

Posted by Enrique Rodriguez <en...@gmail.com>.
On 2/23/07, Roland Weber <ht...@dubioso.net> wrote:
> ... What tool do you use to generate the info
> in the manifest? I can't promise anything, but if it is easy to integrate
> into our Maven 1 build process and can be run with an old JVM
> (HttpClient 3.x is still compatible with 1.2.2) we might add it to
> HttpClient 3.1 RC1. I'll open an issue right away, but discussions will
> have to wait for some weeks. The lead developer is going on a vacation
> and I'll be on a business trip starting next week.

We are using Maven 2 and the "Bundle Plugin for Maven" (maven-bundle-plugin):
http://cwiki.apache.org/FELIX/bundle-plugin-for-maven-bnd.html

There was a BerliOS bundle plugin for Maven 1, but it didn't have some
key functionality you would really want.  As for minimum JDK version
required, I don't know.

Opening an issue and working within your project would be great.

Enrique

Re: (FELIX-212) commons-httpclient 3.0.1 wrapping

Posted by Roland Weber <ht...@dubioso.net>.
Hi Enrique,

> Thanks for the tip.  However, the bundling process simply repackages
> the library jar to include bundle metadata.  With the bundle metadata,
> the jar can now be added to an OSGi runtime, but no code is actively
> started.  Consumers of the bundle would need to be aware of the issue
> you mention.

thanks for the explanation. I thought that all bundles were required
to clean up after themselves. What tool do you use to generate the info
in the manifest? I can't promise anything, but if it is easy to integrate
into our Maven 1 build process and can be run with an old JVM
(HttpClient 3.x is still compatible with 1.2.2) we might add it to
HttpClient 3.1 RC1. I'll open an issue right away, but discussions will
have to wait for some weeks. The lead developer is going on a vacation
and I'll be on a business trip starting next week.

cheers,
  Roland


Re: (FELIX-212) commons-httpclient 3.0.1 wrapping

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Friday 23 February 2007 04:03, Enrique Rodriguez wrote:

> However, the bundling process simply repackages
> the library jar to include bundle metadata.  With the bundle metadata,
> the jar can now be added to an OSGi runtime, but no code is actively
> started.  Consumers of the bundle would need to be aware of the issue
> you mention.

I disagree. This kind of thinking is why there is so much problems in the Java 
world at large. Everyone works on stuff getting started and never clean up 
the mess behind.

Moving the problem to the client bundles doesn't help and creates even more 
problems.
BundleA uses commons-httpclient. It takes note of you "issue" and 
shutdownAll() as noted. Eveything is fine.
BundleB does the same thing.
Now, deploy both on the same framework, and how???

Demanding that the commons-httpclient is only "valid" if it is started is IMHO 
a reasonable reqruirement, and put in a clean up in the stop() method is 
obviously needed. 

This is of course true for all libraries creating threads and registering 
other global resources, so this 'bulk wrapping' is IMHO not necessarily a 
good thing, unless one look into the consequences.



Cheers
Niclas

Re: (FELIX-212) commons-httpclient 3.0.1 wrapping

Posted by Enrique Rodriguez <en...@gmail.com>.
On 2/22/07, Roland Weber <ht...@dubioso.net> wrote:
> ...
> I just wanted to point out that in HttpClient 3 (and 2), the class
> MultiThreadedHttpConnectionManager starts background threads when used.
> ...

Hi, Roland,

Thanks for the tip.  However, the bundling process simply repackages
the library jar to include bundle metadata.  With the bundle metadata,
the jar can now be added to an OSGi runtime, but no code is actively
started.  Consumers of the bundle would need to be aware of the issue
you mention.

Besides some basics, like giving the bundle a name, the main purpose
of the bundle metadata is to declare the packages the bundle imports
and exports.  This is the foundation for resolving dependencies in the
OSGi framework.

I've included the new MANIFEST.MF, below.  The new values to look at
are the "Import-Package" and "Export-Package" statements, as well as
all the ones beginning with "Bundle-".  As you can see this process is
quite non-invasive; however, it is required to use this library in an
OSGi runtime.  Our hope is that this metadata is added by projects
directly, obviating our need to provide repackaging at Felix.

Enrique


Manifest-Version: 1

Specification-Title: Jakarta Commons HttpClient

Built-By: Michael

Created-By: Bnd-0.0.107

Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt

Import-Package: javax.crypto,javax.crypto.spec,javax.net,javax.net.ssl

 ,org.apache.commons.codec,org.apache.commons.codec.binary,org.apache.

 commons.codec.net,org.apache.commons.httpclient,org.apache.commons.ht

 tpclient.auth,org.apache.commons.httpclient.cookie,org.apache.commons

 .httpclient.methods,org.apache.commons.httpclient.methods.multipart,o

 rg.apache.commons.httpclient.params,org.apache.commons.httpclient.pro

 tocol,org.apache.commons.httpclient.util,org.apache.commons.logging

Export-Package: org.apache.commons.httpclient.util;uses:="org.apache.c

 ommons.httpclient,org.apache.commons.codec,org.apache.commons.logging

 ,org.apache.commons.codec.net",org.apache.commons.httpclient;uses:="o

 rg.apache.commons.httpclient.params,org.apache.commons.httpclient.aut

 h,org.apache.commons.httpclient.protocol,org.apache.commons.logging,o

 rg.apache.commons.httpclient.util,org.apache.commons.httpclient.cooki

 e,org.apache.commons.codec,org.apache.commons.codec.net",org.apache.c

 ommons.httpclient.cookie;uses:="org.apache.commons.httpclient.util,or

 g.apache.commons.httpclient,org.apache.commons.logging",org.apache.co

 mmons.httpclient.params;uses:="org.apache.commons.httpclient,org.apac

 he.commons.logging",org.apache.commons.httpclient.methods;uses:="org.

 apache.commons.httpclient.util,org.apache.commons.httpclient,org.apac

 he.commons.httpclient.params,org.apache.commons.httpclient.methods.mu

 ltipart,org.apache.commons.logging",org.apache.commons.httpclient.aut

 h;uses:="org.apache.commons.httpclient,org.apache.commons.httpclient.

 util,org.apache.commons.httpclient.params,javax.crypto.spec,org.apach

 e.commons.logging,javax.crypto,org.apache.commons.codec.binary",org.a

 pache.commons.httpclient.protocol;uses:="org.apache.commons.httpclien

 t.util,org.apache.commons.httpclient,org.apache.commons.httpclient.pa

 rams,javax.net,javax.net.ssl",org.apache.commons.httpclient.methods.m

 ultipart;uses:="org.apache.commons.httpclient.util,org.apache.commons

 .httpclient.methods,org.apache.commons.httpclient.params,org.apache.c

 ommons.logging"

Bundle-Version: 3.0.1

Bundle-Name: commons-httpclient-osgi bundle

Bundle-Description: This bundle simply wraps commons-httpclient-3.0.1.

 jar.

Build-Jdk: 1.3.1_17

Ant-Version: Apache Ant 1.5.3

Bundle-DocURL: http://incubator.apache.org/felix/

Originally-Created-By: Apache Maven

Bundle-ManifestVersion: 2

Bundle-Vendor: Apache Felix Project

Implementation-Title: org.apache.commons.httpclient

Bundle-SymbolicName: commons-httpclient-osgi

Specification-Vendor: Apache Software Foundation

Extension-Name: commons-httpclient

Implementation-Version: 3.0.1

Package: org.apache.commons.httpclient

Implementation-Vendor: Apache Software Foundation

Re: (FELIX-212) commons-httpclient 3.0.1 wrapping

Posted by Felix Meschberger <Fe...@day.com>.
Hi Roland,

Thanks a lot for the clarifications !

Given these remarks, I would opt to remove the bundling of HTTPClient
3.0.1again.

As a less dramatic means, a way would be to clearly state the issues (in the
Commons Wiki Page for example) and add a BundleActivator to the bundling,
which calls the shutdownAll method on stop.

What does the community think on this ?

Regards
Felix

On 3/11/07, Roland Weber <ht...@dubioso.net> wrote:
>
> Hi Felix,
>
> sorry for the late reply, I don't access OSS related mail while
> travelling.
>
> > You also say, that HTTPClient is not built to be used as a shared
> library.
> > Can you elaborate on that a bit, please ? The reason for me asking is
> that
> > we exactly do that, and if there is actually an issue there, I would
> > like to
> > be prepared (or prevent it altogether): Thanks alot.
>
> There are some issues I am aware of. One is the MTHCM which I already
> mentioned. That can be addressed by calling shutdownAll(). The other
> connection manager (SimpleHCM) can be shut down individually by the
> application using it, there are no shared background threads.
>
> Another issue is the static map of registered protocols in class
> org.apache.commons.httpclient.protocol.Protocol. Each application
> that needs to use for example HTTPS will register it's HTTPS protocol
> handler there. There is another static map of cookie specs in
> org.apache.commons.httpclient.cookie.Cookie, but that is typically
> not modified since we ship a good selection of cookie specs which
> are all registered by default. Then there's the default parameter
> factory, a static attribute in o.a.c.h.params.DefaultHttpParams.
> Like the cookie specs typically not modified.
>
> There might be some other open holes elsewhere... I don't care to
> search for them, because the ones I know of already tell me that it
> is imprudent to run HttpClient 3 as a shared library, unless ALL
> the applications using it are perfectly aware of the limitations.
>
> > Consequently, if there is a problem, we might (a) provide an activator
> > which
> > "shutdownAll()" on bundle stop [I could do that] or (b) remove
> HTTPClient
> > again.
>
> Unless you want to document the limitations for it's use, I think
> removing it is the better option. If you feel like documenting it,
> we could find a place for that on the HttpClient pages.
>
> cheers,
>   Roland
>
> (btw, I'll be offline again for another week)
>

Re: (FELIX-212) commons-httpclient 3.0.1 wrapping

Posted by Roland Weber <ht...@dubioso.net>.
Hi Felix,

sorry for the late reply, I don't access OSS related mail while travelling.

> You also say, that HTTPClient is not built to be used as a shared library.
> Can you elaborate on that a bit, please ? The reason for me asking is that
> we exactly do that, and if there is actually an issue there, I would
> like to
> be prepared (or prevent it altogether): Thanks alot.

There are some issues I am aware of. One is the MTHCM which I already
mentioned. That can be addressed by calling shutdownAll(). The other
connection manager (SimpleHCM) can be shut down individually by the
application using it, there are no shared background threads.

Another issue is the static map of registered protocols in class
org.apache.commons.httpclient.protocol.Protocol. Each application
that needs to use for example HTTPS will register it's HTTPS protocol
handler there. There is another static map of cookie specs in
org.apache.commons.httpclient.cookie.Cookie, but that is typically
not modified since we ship a good selection of cookie specs which
are all registered by default. Then there's the default parameter
factory, a static attribute in o.a.c.h.params.DefaultHttpParams.
Like the cookie specs typically not modified.

There might be some other open holes elsewhere... I don't care to
search for them, because the ones I know of already tell me that it
is imprudent to run HttpClient 3 as a shared library, unless ALL
the applications using it are perfectly aware of the limitations.

> Consequently, if there is a problem, we might (a) provide an activator
> which
> "shutdownAll()" on bundle stop [I could do that] or (b) remove HTTPClient
> again.

Unless you want to document the limitations for it's use, I think
removing it is the better option. If you feel like documenting it,
we could find a place for that on the HttpClient pages.

cheers,
  Roland

(btw, I'll be offline again for another week)

Re: (FELIX-212) commons-httpclient 3.0.1 wrapping

Posted by Felix Meschberger <Fe...@day.com>.
Hi Roland,

As the provider of the original bundling descriptor, I have to admit, that I
was not aware of this issue ....

You also say, that HTTPClient is not built to be used as a shared library.
Can you elaborate on that a bit, please ? The reason for me asking is that
we exactly do that, and if there is actually an issue there, I would like to
be prepared (or prevent it altogether): Thanks alot.

Consequently, if there is a problem, we might (a) provide an activator which
"shutdownAll()" on bundle stop [I could do that] or (b) remove HTTPClient
again.

Regards
Felix

On 2/22/07, Roland Weber <ht...@dubioso.net> wrote:
>
> Hello Enrique,
>
> > A wrapper POM creating an OSGi bundle of the 3rd-party library was
> committed on rev 510316.
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=510316
> >
> >> commons-httpclient 3.0.1 wrapping
> >> ---------------------------------
> >>
> >>                 Key: FELIX-212
> >>                 URL: https://issues.apache.org/jira/browse/FELIX-212
> >>
> >> Create an OSGi bundle for the commons-httpclient 3.0.1 jar.
> >
>
> I just wanted to point out that in HttpClient 3 (and 2), the class
> MultiThreadedHttpConnectionManager starts background threads when used.
> If I am not mistaken, the OSGi bundle mechanism expects bundles to
> clean up when they are stopped. In order to clean up, you would need
> a bundle activator that calls
>
>       MultiThreadedHttpConnectionManager.shutdownAll();
>
> when the bundle is stopped.
>
>
> http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.html#shutdownAll()
>
> cheers,
>   Roland
>
>

(FELIX-212) commons-httpclient 3.0.1 wrapping

Posted by Roland Weber <ht...@dubioso.net>.
Hello Enrique,

> A wrapper POM creating an OSGi bundle of the 3rd-party library was committed on rev 510316.
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=510316
> 
>> commons-httpclient 3.0.1 wrapping
>> ---------------------------------
>>
>>                 Key: FELIX-212
>>                 URL: https://issues.apache.org/jira/browse/FELIX-212
>>
>> Create an OSGi bundle for the commons-httpclient 3.0.1 jar.
> 

I just wanted to point out that in HttpClient 3 (and 2), the class
MultiThreadedHttpConnectionManager starts background threads when used.
If I am not mistaken, the OSGi bundle mechanism expects bundles to
clean up when they are stopped. In order to clean up, you would need
a bundle activator that calls

      MultiThreadedHttpConnectionManager.shutdownAll();

when the bundle is stopped.

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.html#shutdownAll()

cheers,
  Roland


[jira] Resolved: (FELIX-212) commons-httpclient 3.0.1 wrapping

Posted by "Enrique Rodriguez (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-212?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Enrique Rodriguez resolved FELIX-212.
-------------------------------------

    Resolution: Fixed

A wrapper POM creating an OSGi bundle of the 3rd-party library was committed on rev 510316.

URL: http://svn.apache.org/viewvc?view=rev&rev=510316


> commons-httpclient 3.0.1 wrapping
> ---------------------------------
>
>                 Key: FELIX-212
>                 URL: https://issues.apache.org/jira/browse/FELIX-212
>             Project: Felix
>          Issue Type: New Feature
>          Components: Felix Commons
>            Reporter: Felix Meschberger
>         Assigned To: Enrique Rodriguez
>            Priority: Minor
>         Attachments: pom.xml
>
>
> Create an OSGi bundle for the commons-httpclient 3.0.1 jar.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-212) commons-httpclient 3.0.1 wrapping

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12481495 ] 

Felix Meschberger commented on FELIX-212:
-----------------------------------------

Considering the discussion on the list regarding the problems related to using HTTPClient as a shared library, what shall we do here ?

  - Do we leave this bundling as is ?
  - Should we remove it again ?
  - Should I add a BundleActivator which calls shutdownAll on Bundle.stop() ?

> commons-httpclient 3.0.1 wrapping
> ---------------------------------
>
>                 Key: FELIX-212
>                 URL: https://issues.apache.org/jira/browse/FELIX-212
>             Project: Felix
>          Issue Type: New Feature
>          Components: Felix Commons
>            Reporter: Felix Meschberger
>         Assigned To: Enrique Rodriguez
>            Priority: Minor
>         Attachments: pom.xml
>
>
> Create an OSGi bundle for the commons-httpclient 3.0.1 jar.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-212) commons-httpclient 3.0.1 wrapping

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-212?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger updated FELIX-212:
------------------------------------

    Priority: Minor  (was: Major)

> commons-httpclient 3.0.1 wrapping
> ---------------------------------
>
>                 Key: FELIX-212
>                 URL: https://issues.apache.org/jira/browse/FELIX-212
>             Project: Felix
>          Issue Type: New Feature
>          Components: Felix Commons
>            Reporter: Felix Meschberger
>            Priority: Minor
>         Attachments: pom.xml
>
>
> Create an OSGi bundle for the commons-httpclient 3.0.1 jar.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.