| Summary: | Theming 'competition' when using multiple entry points in RAP/RWT | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Kees Pieters <info> | ||||
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> | ||||
| Status: | RESOLVED WORKSFORME | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | ||||||
| Version: | 3.1 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows NT | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Kees Pieters
Could you please provide a very simple application (project) that demonstrates the issue? Are these themes a complete themes or they are contributions the the RAP default theme? Created attachment 266506 [details] Two Basic RAP bundles that demonstrate the problem Sorry for the delay. Please find attached two basic RAP bundles (org.test.heelo1 and org.test.hello3) that open up on locations (respectively) http://127.0.0.1:64558/hello1 and http://127.0.0.1:64558/hello When you start both bundles, one of themes will be the dominant one, and the other will not be activated. We have tries various scenarios and the only owrkaround we could find was to: -create different stylesheets, with different ids for the widgets (e.g Button.Test1 and Button.Test3) - add the stylesheets to ALL the bundles that we use. This behaviour is alse present on a Virgo application server, which impairs the modularity of the system. Cheers Kees That's because both application are running in the same context directory and share the same "rwt-resources" where the theme files are copied. With this setup you will see an exception that the "rwt-resources" directory is already registered. You have to deploy both applications under different context path like: http://127.0.0.1:64558/context1/hello1 and http://127.0.0.1:64558/context3/hello3 also... use a complete theme, not a contribution and set it to the EntryPoint like: ---- Map<String, String> properties = new HashMap<String, String>(); properties.put( WebClient.PAGE_TITLE, "Hello RAP Number 1" ); properties.put( WebClient.THEME_ID, S_STYLE_SHEET_MAIN_ID ); application.addEntryPoint( "/hello1", BasicEntryPoint.class, properties ); application.addStyleSheet( S_STYLE_SHEET_MAIN_ID, S_STYLE_SHEET_MAIN ); ---- The "themes/theme1.css" should contain a copy of RAP default theme "default.css" + your extensions. With this setup even the exception is printed on the console: java.lang.RuntimeException: org.eclipse.equinox.http.servlet.internal.error.PatternInUseException: Pattern already in use: /rwt-resources at org.eclipse.rap.rwt.osgi.internal.ApplicationReferenceImpl.registerResourceDirectory(ApplicationReferenceImpl.java:198) at org.eclipse.rap.rwt.osgi.internal.ApplicationReferenceImpl.startRWTApplication(ApplicationReferenceImpl.java:80) at org.eclipse.rap.rwt.osgi.internal.ApplicationReferenceImpl.start(ApplicationReferenceImpl.java:64) I can see both applications working with separate themes. Om, I've done as you suggested: In the two RAP bundles I have modified the contribution.xml as follows: <?xml version="1.0" encoding="UTF-8"?> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="Test1 Application"> <implementation class="org.test.test1.BasicApplication"/> <property name="contextName" type="String" value="context1"/> <service> <provide interface="org.eclipse.rap.rwt.application.ApplicationConfiguration"/> </service> </scr:component> <?xml version="1.0" encoding="UTF-8"?> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="Test1 Application"> <implementation class="org.test.test3.BasicApplication"/> <property name="contextName" type="String" value="context3"/> <service> <provide interface="org.eclipse.rap.rwt.application.ApplicationConfiguration"/> </service> </scr:component> When I launch the two bundles (do NOT add a context path in the launch configuration!), I can open two web pages: http://127.0.0.1:10080/context1/hello1 http://127.0.0.1:10080/context3/hello These pages indeed have different themes. I will double check this solution on a Virgo server, but this solution seems to work fine! Thanks Finally have come around to give my feedback. The proposed solution works, BUT ..now I get unexpected behaviour in the launch configuration. If I add a context path in the contribution.xml, for instance to get me to: <my-ip-address>/<my-context>/home Then I would expect to configure the launch configuration as: context path: <my-context> servlet path: /home This will not work, for the launch configuration starts the servlet at: <my-ip-address>/<my-context>/<my-context>/home this would appear to be one path to many. The workaround is to disable the context path, and setting the servlet-path to: /<my-context>, abd typing in 'home' in the browser after the application has started. That works for me, but is not very intuitive, and elicits a lot of unecessary checking and debugging if you don't know this. |