Load jsf strings in wildfly swarm - jboss

I'm trying to run a jsf application on wildfly swarm but I'm having some trouble with the resource management. Their short example on their github page states :
You will need to add the xhtml files to Shrinkwrap in a manner such as
deployment.addAsWebResource() since JSF is non static.
I didn't manage to make my bundle file recognized. Furthermore I have about 20 .properties file which hold strings. Do I really need to add all of those programatically ?
<f:loadBundle basename="strings.strings"> Can't find bundle for base name strings.strings, locale en_US
In my main method I have:
deployment.addAsWebResource(
new ClassLoaderAsset("strings/strings.properties", Main.class.getClassLoader()), "strings.strings");

The JSF example you link to uses Shrinkwrap to customize the container and deployment.
If you don't need to customize anything it can pick up the resources automatically as in https://github.com/wildfly-swarm/wildfly-swarm-examples/tree/master/jsf/jsf-war

Related

Add javadocs to show on a webpage

Is there someway that I can show my javadocs that I have generated through eclipse to show them on a webpage in my Spring mvc project? I know I gotta do something with the controller but what?
Thanks in advance!
You could generate the javadocs in some folder within your application (like /WEB-INF/docs/) and instruct Spring to serve them as static resources (which they are):
<mvc:resources mapping="/docs/**" location="/WEB-INF/docs/" />
You then access them with something like http://localhost:8080/yourAppContext/docs/index.html.
Depending on your application URL mappings it might even be possible to generate the files in a publicly available folder (outside of WEB-INF) and let the server itself serve them from there without triggering the Spring dispatcher servlet.

Wicket 6 webapp context resources

Im migrating a wicket 1.4 application which has alot of js,css en images under the webapp context directory :
src/main/webapp
+js
++plugin1.js
++plugin2.js
+app
+css
e.t.c.
In our application we have used
JavaScript.getHeaderContribution("js/plugin1.js");
The new wicket 6 implementation doesn't have this header contribution method.In stead you should use :
JavaHeaderItem.forReference(new JavaScriptResourceReference(Application.class,"js/plugin1.js");
But i dont want to use a scope! it will now search for files in the same package as the Application class. ContextRelativeReference is not valid in this location because it does not extend ResourceReference.
Any ideas about how i should access my webapp files without having to add every single file as a shared resource and reference it in my header contributor?
I have found the solution. It was easier then i expected.
You can simply use JavaScriptHeaderItem.forUrl("js/plugin1.js");
No reference and thus no scope needed.
Regards Niels
And what about mounted resource caching ?? Because when using this method nothing will be cached by browser!

Specifying other Path to ResourceBundle / i18n for Vaadin

Is it possible to specify another path than the classpath for the properties files of Vaadin MVP plugin?
My main objective is to try to decouple these properties files at e.g. live deployment of the product being developed.
The plugin uses ResourceBundle.getBundle(baseName, locale) internally in the ResourceBundleUiMessageSource class. This means that it only looks at the class path and you cannot specify arbitrary locations externally.
However, all source code is included with the plugin, so you can extend it to use PropertyResourceBundle. See this question for more details.

GWT resource bundle priority

I have a GWT application which uses a style sheet which is defined in a resource bundle and the injected into my main entrypoint as follows:
MyResources.INSTANCE.main().ensureInjected();
I then also have another stylesheet that I make use of which which is served by my cms and is injected via the bla.gwt.xml file as follows:
<stylesheet src="cms/clientSpecific.css"/>
The idea is that styles in clientSpecific.css should override those in main.css but it seems that main.css (the one in the resource bundle) takes preferance to the one that was defined in the bla.gwt.cml (served by my cms). Is there a way to tell the GWT application which style sheet takes priority?
It's not possible as the main is injected in JavaScript which is executed at a point past the loading of the style sheets. However, even if you could get it to work, you might have another problem, because the injected main css is obfuscated (unless you disabled that). Thus the original stylenames are gone and the styles in the clientSpecific.css won't match.

ASP.NET MVC2 IoC: Looking for an example using CastleWindsor container that works with minimum config

I am looking for an example of how to configure an ASP.NET MVC2 project to use CastleWindsor container to do IoC.
I keep running into problems setting it up, and for every problem there seems to be a solution on-line, but in the end I make so many changes and end up with such a verbose setup to get IoC working using CastleWindsor, that I thought it best to ask this question.
I am looking for the minimum configuration required in the Global.asax page, the Web.config, and if required, what other changes and extension classes are required.
I am not looking to inject into actionfilters at this stage, so just the basics. Preferably not using XML files, but doing it in .NET programatically.
Thank you in advance...
This is as basic as it gets:
Start a MVC2 project from VS2010
Download MvcContrib for MVC2 (the one that says "extra binaries")
In your project, add a reference to (all these DLLs are included in MvcContrib):
Castle.Core.dll
Castle.DynamicProxy2.dll
Castle.MicroKernel.dll
Castle.Windsor.dll
MvcContrib.dll
MvcContrib.Castle.dll
In your Application_Start(), add these lines (and whatever namespaces are needed):
var container = new WindsorContainer();
container.RegisterControllers(typeof(HomeController).Assembly);
ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(container));