Hi David,
The webbundle://foo?key=value URL is mainly a transport vehicle for meta data. I don't
think it is intended to give access to the bytes of the war (however, we could do this too
- see below). That URL spec (as a string) is the Bundle.location that is given in
BundleContext(location, input). That location identifier was originally meant to be a URL
that could give access to the Bundle's bytes. This is no longer the case and any
string (in most cases an URI) can be given as the location. Internally, I think the
location becomes the DU name. If not, it is definitely the Deployment.location.
So a DUP does have access to that web bundle location. The URL handler is mainly a URI
parser that is supposed to give access to the OSGi metadata that need to be put in the
manifest (in our case the OSGiMetaData not the Manifest). AFAIK, the Framework tries to
construct a URL from the location only if no input bytes are given. When we talk about an
URLHandler we are mainly talking about a simple URI parser. A URLHandler would need to be
implemented for BundleContext(location) to work.
Given that the URI parsing works and that we can generate OSGiMetaData from it, the bytes
that make up the WAR are maintained by the DeploymentRepository and available through the
DU roots.
In the unlikely case that the TCK does something like this:
Manifest manifest = new Manifest(new
URL("webbundle://foo?key=value").openStream());
validateGeneratedManifest(manifest)
we would need to feed back the generated OSGiMetaData to a byte buffer. In any case that
would have to access the DU root content and amend it by a generated Manifest.
I'd have to check if the above is really required.
If this does not help either, give me a shout and I put together a quick prototype.
cheers
--thomas
On Nov 29, 2012, at 12:29 PM, David Bosschaert <david(a)redhat.com> wrote:
Hi Thomas,
I have the following issues with your suggestion.
1. I don't fully see how the information available to the URL handler can be
associated with the information available to the DeploymentUnitProcessor. The URL handler
has the URL, that's all, while AFAICS the original URL (or whatever was inside the
webbundle: url) is no longer available when the deploy() method is called.
2. If we find a way to fix 1. this will only work if people use
BundleContext.install(String location). It will fail when people call url.openStream() on
the webbundle: url and does not work with BundleContext.install(String, InputStream).
Another approach would be to simply let the URL handler do all the work, i.e. modify the
stream being passed through. Then those URLs will work in any context.
Cheers,
David
On 26/11/2012 17:25, Thomas Diesler wrote:
> Hi David,
>
> here a quick summary of what I suggested today:
>
> The first thing that sees the URL coming from BundleContext.install(...) is the
Framework, which has a notion of pluggable URL handlers.
> In AS7 the URL handler should be an integration plugin and a DUP at the same time.
The DUP would do nothing as long as the plugin
> is not activated (i.e. the framework is down). When the Framework activates the URL
handler gets registered with the framework and the DUP becomes active.
>
> The DUP would then need to provide OSGiMetaData with a Bunde-SymbolicName and
Bundle-Classpath. The Bundle-Classpath should point to WEB-INF/classes and
> the collection of stuff in WEB-INF/lib. For completeness it could generate
Package-Import requirements on the javax.servlet.* APIs. The DUP should be placed after
> the DUP that normally provides OSGiMetaData and should do nothing if the OSGiMetaData
is already there.
>
> Hope that helps, cheers
> --thomas
>
>
> On 11/21/2012 05:58 PM, David Bosschaert wrote:
>> Hi all,
>>
>> As part of making the JBoss OSGi Web Application Support compliant with
>> the spec I have started running it through the OSGi TCK.
>> I noticed that the TCK depends heavily on the webbundle: URL protocol
>> which is specified in section 128.4 of the specification - it is not an
>> optional piece. So in order to support this we need to provide such a
>> URL handler.
>>
>> As the webbundle: handler is never part of runtime operation (it only
>> converts a WAR file into a WAB file on the fly) I was looking into
>> possibly using existing implementations of the URL handler instead.
>> However the ones that I found are quite heavy on the dependencies. The
>> implementation in Aries depends on Blueprint being present and the one
>> in Pax has about 10 other dependencies (including junit) - they drag in
>> too much baggage IMHO.
>>
>> So I'm starting to come to the conclusion that we need to provide such
>> an implementation as part of the OSGi webbundle support in AS7. The JIRA
>> is
https://issues.jboss.org/browse/AS7-6006
>>
>> Any other ideas?
>>
>> Cheers,
>>
>> David
>> _______________________________________________
>> jboss-as7-dev mailing list
>> jboss-as7-dev(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>