You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Dan Tran <da...@gmail.com> on 2013/05/29 06:15:51 UTC

How to make a bundle's Web-ContextPath configurable at runtime??

Hi

I have a bundle that uses war feature where I statically configure the
context path via bundle maven plugin list this

  <build>

    <plugins>

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <Import-Package>!*</Import-Package>
            <Export-Package>*</Export-Package>
            <Web-ContextPath>/console/help</Web-ContextPath>
          </instructions>
        </configuration>
      </plugin>

    </plugins>

  </build>


Is there a  way to configure 'Web-ContextPath' at runtime?

Big thanks ahead

-Dan

Re: How to make a bundle's Web-ContextPath configurable at runtime??

Posted by Gražvydas Valeika <gv...@gmail.com>.
Hi, I don't know. Please try an share ;)

G.


On Wed, May 29, 2013 at 7:13 PM, Dan Tran <da...@gmail.com> wrote:

> Hi Grazvydas
>
> Would your solution work if my packing is a jar?
>
> Thanks
>
> -D
>
>
>
> On Wed, May 29, 2013 at 7:52 AM, Gražvydas Valeika <gv...@gmail.com>wrote:
>
>> Hi,
>>
>>
>>
>> On Wed, May 29, 2013 at 10:24 AM, Dan Tran <da...@gmail.com> wrote:
>>
>>> ouch!! :-)
>>>
>>> if I dont put it in the manifest, is it possible to configure context at
>>> runtime? :-)
>>>
>>> -D
>>>
>>>
>>> On Tue, May 28, 2013 at 11:45 PM, Achim Nierbeck <
>>> bcanhome@googlemail.com> wrote:
>>>
>>>> Hi Dan,
>>>>
>>>> quick answer: No!
>>>>
>>>
>>
>> Recently I also was trying to do the same thing. I even wanted to try to
>> patch stuff but when I found workaround my motivation lowered.
>>
>> Workaround would be to use not osgified war file. And install it using :
>>
>> install  warref:file:///pathTo/Test.bnd
>>
>> and in bnd file you can put necessary manifest fields, sample bnd file
>> (similar to file I used):
>>
>> Bundle-SymbolicName:\
>>  TestBnd
>>
>> Bundle-Version:\
>>  1.3.0
>>
>> Export-Package:\
>>  !*
>>
>> Import-Package:
>> javax.servlet,javax.servlet.http,com.my.test;version="0.0.0",*
>>
>> Bundle-ClassPath: .,WEB-INF/classes,/WEB-INF/lib/gwt-servlet-2.5.1.jar
>>
>> -removeheaders:\
>>  Private-Package,\
>>  Ignore-Package
>>
>> WAR-URL:\
>>   file:///pathTot/Test.war
>>
>> Webapp-Context: TestContext
>>
>>
>>
>> I tried and this works with karaf-3.0.0.RC1.
>>
>>
>> Best regards,
>>
>> Grazvydas
>>
>
>

Re: How to make a bundle's Web-ContextPath configurable at runtime??

Posted by Dan Tran <da...@gmail.com>.
Hi Grazvydas

Would your solution work if my packing is a jar?

Thanks

-D



On Wed, May 29, 2013 at 7:52 AM, Gražvydas Valeika <gv...@gmail.com>wrote:

> Hi,
>
>
>
> On Wed, May 29, 2013 at 10:24 AM, Dan Tran <da...@gmail.com> wrote:
>
>> ouch!! :-)
>>
>> if I dont put it in the manifest, is it possible to configure context at
>> runtime? :-)
>>
>> -D
>>
>>
>> On Tue, May 28, 2013 at 11:45 PM, Achim Nierbeck <bcanhome@googlemail.com
>> > wrote:
>>
>>> Hi Dan,
>>>
>>> quick answer: No!
>>>
>>
>
> Recently I also was trying to do the same thing. I even wanted to try to
> patch stuff but when I found workaround my motivation lowered.
>
> Workaround would be to use not osgified war file. And install it using :
>
> install  warref:file:///pathTo/Test.bnd
>
> and in bnd file you can put necessary manifest fields, sample bnd file
> (similar to file I used):
>
> Bundle-SymbolicName:\
>  TestBnd
>
> Bundle-Version:\
>  1.3.0
>
> Export-Package:\
>  !*
>
> Import-Package:
> javax.servlet,javax.servlet.http,com.my.test;version="0.0.0",*
>
> Bundle-ClassPath: .,WEB-INF/classes,/WEB-INF/lib/gwt-servlet-2.5.1.jar
>
> -removeheaders:\
>  Private-Package,\
>  Ignore-Package
>
> WAR-URL:\
>   file:///pathTot/Test.war
>
> Webapp-Context: TestContext
>
>
>
> I tried and this works with karaf-3.0.0.RC1.
>
>
> Best regards,
>
> Grazvydas
>

Re: How to make a bundle's Web-ContextPath configurable at runtime??

Posted by Gražvydas Valeika <gv...@gmail.com>.
Hi,



On Wed, May 29, 2013 at 10:24 AM, Dan Tran <da...@gmail.com> wrote:

> ouch!! :-)
>
> if I dont put it in the manifest, is it possible to configure context at
> runtime? :-)
>
> -D
>
>
> On Tue, May 28, 2013 at 11:45 PM, Achim Nierbeck <bc...@googlemail.com>wrote:
>
>> Hi Dan,
>>
>> quick answer: No!
>>
>

Recently I also was trying to do the same thing. I even wanted to try to
patch stuff but when I found workaround my motivation lowered.

Workaround would be to use not osgified war file. And install it using :

install  warref:file:///pathTo/Test.bnd

and in bnd file you can put necessary manifest fields, sample bnd file
(similar to file I used):

Bundle-SymbolicName:\
 TestBnd

Bundle-Version:\
 1.3.0

Export-Package:\
 !*

Import-Package:
javax.servlet,javax.servlet.http,com.my.test;version="0.0.0",*

Bundle-ClassPath: .,WEB-INF/classes,/WEB-INF/lib/gwt-servlet-2.5.1.jar

-removeheaders:\
 Private-Package,\
 Ignore-Package

WAR-URL:\
  file:///pathTot/Test.war

Webapp-Context: TestContext



I tried and this works with karaf-3.0.0.RC1.


Best regards,

Grazvydas

Re: How to make a bundle's Web-ContextPath configurable at runtime??

Posted by Dan Tran <da...@gmail.com>.
ouch!! :-)

if I dont put it in the manifest, is it possible to configure context at
runtime? :-)

-D


On Tue, May 28, 2013 at 11:45 PM, Achim Nierbeck <bc...@googlemail.com>wrote:

> Hi Dan,
>
> quick answer: No!
> It's in the manifest so this is not alterable in runtime :-)
>
>
> regards, Achim
>
>
>
>
> 2013/5/29 Dan Tran <da...@gmail.com>
>
>> Hi
>>
>> I have a bundle that uses war feature where I statically configure the
>> context path via bundle maven plugin list this
>>
>>   <build>
>>
>>     <plugins>
>>
>>       <plugin>
>>         <groupId>org.apache.felix</groupId>
>>         <artifactId>maven-bundle-plugin</artifactId>
>>         <configuration>
>>           <instructions>
>>             <Import-Package>!*</Import-Package>
>>             <Export-Package>*</Export-Package>
>>             <Web-ContextPath>/console/help</Web-ContextPath>
>>           </instructions>
>>         </configuration>
>>       </plugin>
>>
>>     </plugins>
>>
>>   </build>
>>
>>
>> Is there a  way to configure 'Web-ContextPath' at runtime?
>>
>> Big thanks ahead
>>
>> -Dan
>>
>>
>
>
> --
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
> Commiter & Project Lead
> blog <http://notizblog.nierbeck.de/>
>

Re: How to make a bundle's Web-ContextPath configurable at runtime??

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Dan,

quick answer: No!
It's in the manifest so this is not alterable in runtime :-)


regards, Achim




2013/5/29 Dan Tran <da...@gmail.com>

> Hi
>
> I have a bundle that uses war feature where I statically configure the
> context path via bundle maven plugin list this
>
>   <build>
>
>     <plugins>
>
>       <plugin>
>         <groupId>org.apache.felix</groupId>
>         <artifactId>maven-bundle-plugin</artifactId>
>         <configuration>
>           <instructions>
>             <Import-Package>!*</Import-Package>
>             <Export-Package>*</Export-Package>
>             <Web-ContextPath>/console/help</Web-ContextPath>
>           </instructions>
>         </configuration>
>       </plugin>
>
>     </plugins>
>
>   </build>
>
>
> Is there a  way to configure 'Web-ContextPath' at runtime?
>
> Big thanks ahead
>
> -Dan
>
>


-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>