Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » Extending context of a web bundle via fragment
Extending context of a web bundle via fragment [message #976842] Thu, 08 November 2012 22:17 Go to next message
Thorsten Schlathölter is currently offline Thorsten SchlathölterFriend
Messages: 312
Registered: February 2012
Location: Düsseldorf
Senior Member
Hi,
I would like to ask what is generally the best way to extend the spring context of a web-bundle by a fragment. The documentation instructs not to use WEB-INF\spring\*.xml contexts but rather use the web-framework to bootstrap the context:

http://static.springsource.org/osgi/docs/2.0.0.M1/reference/html/web.html

So I tried a contextConfigLocation <context-param> to configure a ContextLoaderListener. Here is the respective part of my web.xml:

<context-param>
	<param-name>contextConfigLocation</param-name>
	<param-value>
	/WEB-INF/*Context.xml
	</param-value>
</context-param>

<context-param>
	<param-name>contextClass</param-name>
	<param-value>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
</context-param>

<listener>
	<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>

<listener>
	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>



I found that this configuration of the contextConfigLocation does not find contexts in fragments. The fragment contexts are only found if they are specified with no wildcards. So this here would work:

<context-param>
	<param-name>contextConfigLocation</param-name>
	<param-value>
	/WEB-INF/*Context.xml, /WEB-INF/SomeFragmentContextThatExists.xml
	</param-value>
</context-param>


Of course this doesn't make sense since I don't know which fragments will be provided in my final configuration. After debugging into the code I found the following solution to the problem:

<context-param>
   <param-name>contextConfigLocation</param-name>
   <param-value>
	osgibundle:/WEB-INF/*Context.xml
   </param-value>
</context-param>


This configuration will also find all fragment contexts. Since according to the documentation fragments should seamlessly integrate with the host bundle I do not see a reason why "WEB-INF/*Context.xml" should not find all fragment contexts. Therefore I would consider this a bug.

Are there any experiences with this?

Regards,
Thorsten
Re: Extending context of a web bundle via fragment [message #977468 is a reply to message #976842] Fri, 09 November 2012 10:01 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
The web support in Spring DM was dead-ended in favour of what ultimately became Gemini Web and Virgo. Are you still using the old web support? If so, I'm afraid you won't be able to get a bug fix unless you fork the code.
Re: Extending context of a web bundle via fragment [message #977493 is a reply to message #977468] Fri, 09 November 2012 10:24 Go to previous messageGo to next message
Thorsten Schlathölter is currently offline Thorsten SchlathölterFriend
Messages: 312
Registered: February 2012
Location: Düsseldorf
Senior Member
No I am using Gemini-Web 2.1.0 and Virgo so I assume it is a current issue. Just the link points into some old documentation.

Regards,
Thorsten
Re: Extending context of a web bundle via fragment [message #983815 is a reply to message #977493] Wed, 14 November 2012 07:01 Go to previous messageGo to next message
Violeta Georgieva is currently offline Violeta GeorgievaFriend
Messages: 278
Registered: October 2010
Senior Member
Hi,

Can you please report a bug and attach there a small example.

Regards
Violeta
Re: Extending context of a web bundle via fragment [message #987490 is a reply to message #983815] Mon, 26 November 2012 20:36 Go to previous message
Thorsten Schlathölter is currently offline Thorsten SchlathölterFriend
Messages: 312
Registered: February 2012
Location: Düsseldorf
Senior Member
Here is the bug
Previous Topic:Gemini Web 2.2.0 M02 is now available
Next Topic:Gemini JPA and JNDI non jta DataSource
Goto Forum:
  


Current Time: Tue Apr 16 23:26:07 GMT 2024

Powered by FUDForum. Page generated in 2.13706 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top