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!
Related
What I'm trying to do in Aurelia, is something like Prism is doing in WPF- Composite applications.
So lets say I have a "shell" application that defines the main application layout, then i have modules that I can plugin at run-time. Those modules can be an Aurelia application per se or Aurelia plugin (don't know what to use - need recommendation).
When loaded, the module needs to add it's menu items to the main application menu to expose it's features.
This is a mockup of the application:
Each module can have multiple menu items and can be pretty complex.
I'm using latest Typescript, Aurelia-CLI to create the application, and I'm using the built-in bundler : Aurelia's new built-in bundler.
So What I don't know is:
Those modules/features - what must they be? (Maybe Aurelia Plugins, or another Aurelia application?)
How to load those modules/features at run-time? (like deploy it in some plugins folder and tell the main shell application to load them)
How to modify the main menu and add new menu items from the loaded module?
Please help
Aurelia supports ultra dynamic applications. Also, there have been other community members who have had similar requirements and was able to resolve it. So I think the scenario is possible.
It seems the sub-application can just be a route.How/where to load the route should be determined based on the application URL
Those modules doesn't need to do anything specific, they can just be a normal, plain JS/TS class with lifecycle methods to handle activation/deactivation. I guess that main shell and all sub-applications need to share a common URL, you cannot have more than one router.
There could be a singleton/central store for new route to register information about loaded features, or it can be loaded upfront by a configuration file/metadata file or a database fetch.
Here is a similar question from another community member that I think can help you see how to glue things to https://discourse.aurelia.io/t/dynamicaly-load-routes/1906
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
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.
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));
I am developing an app using Grails and GWT for a client side.
I want to use the same date format both on the client side and on the server side (preferably defined in one file).
So far i've understood that Grails got it's own mechanism for internationalization (grails-app/i18n). I know i can access these messages from any server code using app context.
I can also access any resource file inside web-app directory.
For the client side, i can use ConstantsWithLookup interface and GWT.Create(...) to get an instance of it.
But, i still haven't found good solution to integrate these two together, so i have date format defined in one place. Any ideas or tips?
Thanks,
Sergey
After digging into Grails more, i came to a solution.
I've put constant into .properties file under grails-app/i18n.
Then, i hook to eventCompileEnd and i copy resources from grails-app/i18n to specific package in target\generated-sources.
After this step is completed, i generate google I18N interfaces using copied property files.
I've put this functionality to separate plugin.
_Events.groovy:
includeTargets << new File("${myPluginDir}/scripts/_MyInternal.groovy")
eventCompileEnd = {
internalCopyMessageResources();
}
eventCopyMessageResourcesEnd = {
generateI18NInterface();
}
Now it is possible to access localized data from server side and from client side.