how to configure apache tiles to read jsps from inside jar files? - apache

The architecture of my web application is highly modular. I am using apache tiles as the templating framework. The app modules are bundled as different jar files and put inside WEB-INF/lib folder. So each jar file will contain its own tiles configuration files (containing tiles definitions) and related jsp templates.
I am using CompleteAutoloadTilesListener which is a part of tiles-extras package to read the tiles config files from the jar files. But the jsp files aren't picked up by tiles. When I access any definition, it couldn't find the jsp template file.
A configuration change will solve this problem? or should I subclass any tiles base class to let tiles load jsps from the jar?

Someone else ran into this problem before and even wrote a blog about it
It mentions this issue that is fixed, so you should be able to use the same setup and load your tiles definitions from the classpath.
I haven't tested it, but it looks like a sensible solution.

Related

unable to include external files in a project

I have created the default play application in IntelliJ in directory P. I have over-written the default index.scala.html with my own html code. The html code refers to some css and js files which are outside the directory P. To include these external files, I added the directory of these files using project configuration settings.
My webpage doesn't load properly as the server returns 404 for the css and js files. What am I doing wrong?
When you added your directory using project structure, you only say:
Hey, IDEA, please consider this folder part of my project, consider
its contents source code and display it when I open my project.
However, when you deploy or run your app, you only deploy the usual folders to the server, which contain the resources which will be available for clients to access.
The external directory is not part of these directories and will not be deployed.
What you can do is to copy the file from the external directory as a part of your build process before deploying the application.
EDIT: Detailed answer here: What is intellij's build process for play applications

Combine all my custom JS into one single file with dojo build

I'm having a hard time trying to set up dojo build in my project.
Basically, I have my js folder with all my custom widgets and components. I simply want to combine all javascript files form js folder into one single file.
dojo sources are located outside this folder. The structure looks similar to this:
/public
/prod
/dojo-1.9
/dijit
/dojo
/dojox
/js
myScript1.js
myScript2.js
Do you have any idea on how should I configure the package.json and profile.js? The documentation doesn't seem to help since all I am getting is an output folder with the same contents as the js folder (no javascript is merged).
You can start by reading this article:
https://dojotoolkit.org/reference-guide/1.10/build/simpleExample.html
It provides a simplified overview of dojo build system.
Additional there is dojo boilerplate with a sample of folder structure and profile.js configuration for quick start here:
https://github.com/csnover/dojo-boilerplate
I definitely suggest you to use the boilerplate as start for your project as it simplify a lot initial configurations.

What is the file structure of the Share Webscript extensions for Alfresco 4.0.3+

I've been reading David Drapers' blog on the new feature - the extension of share webscripts, but I didn't find any working examples. What is the file naming and structure convention?
From what I gather, I have a module configuration file, and I don't know how to name it or where to put it (share/WEB-INF/classes/alfresco?)
Also, I understood that my custom client side resources (.js and .css files) go to META-INF/custom-dashlet/extension/ in the JAR file. Is this correct? Finally, the *.get.js and *.get.html.ftl go to webscripts/com/mycompany/mypackage/*?
So I have now:
*share/WEB-INF/lib/mypackage.jar*
and in it:
*META-INF/mypackage/extension/myfile.js
webscripts/com/mycompany/mypackage/myfile.get.js
webscripts/com/mycompany/mypackage/myfile.get.html.ftl
*
and the
*share/WEB-INF/classes/alfresco/something.xml*
This question was also posted to the Alfresco forums here: https://forums.alfresco.com/en/viewtopic.php?f=48&t=46438
The answer provided was as follows:
An extension module a Surf configuration object so you should place XML files containing module configuration in any of the locations where Surf config gets picked up... e.g. <web-server>/webapps/share/WEB-INF/classes/alfresco/site-data (there are lots of places where Surf configuration gets picked up, but alfresco/site-data on the classpath is the most common). Extension config files should be placed in the extensions folder within the directory. So you could place an extension config file in: alfresco/site-data/extensions or alfresco/web-extension/site-data/extensions, for example.
You could create a JAR file containing this folder structure. Everything that the extension refers to (e.g. WebScripts, other Surf config objects such as Pages, Template-Instances, Components, etc) should just be placed in their normal location. These can also be built into a JAR file.
If you want to access resources (e.g. CSS, images, JS) from a JAR file then place them in the META-INF folder of the JAR. You should place your JAR file in the <web-server>/webapps/share/WEB-INF/lib directory (obviously your server will need to be restarted to pick up new JAR contents).
WebScripts should be in (on the classpath):
alfresco/site-webscripts
alfresco/web-extension/site-webscripts
webscripts
You can also configure other locations in the Surf configuration from which to load Surf config objects/WebScripts. It's pretty much endlessly customizable but you should probably just stick to the default locations configured for Share.

ScriptBundle not rendering scripts that are in a VirtualDirectory

I have a modular asp.net app where the modules are deployed inside virtual directories underneath the primary .net web application. We have a common module with a lot of stuff. I tried to move all of the common script files out of each client specific project into a common module.
If I create a script bundle that references files at the root level, it renders the script tag into the html. But it won't render script tags for bundles that point to files in a sub virtual directory.
For example:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/App_Modules/Common/Scripts/jquery-1.*"));
no longer renders any script tag and now I get jquery errors client side. I looked at the resultant html, and now there's no more script tag to download the jquery library.
I had the same problem. The root cause was that I included only minified scripts in the bundle. Once I placed in the scripts directory the uncompressed scripts, it rendered them correctly.
Unfortunately bundling doesn't yet support VirtualPathProviders so if your virtual paths are relying on a VPP to serve the resource, bundling won't be able to find them. This is a scenario we are investigating currently and hopefully will support soon.

how to set directories js for javascript files, ui for interfaces and css directory for style in web.xml

I want to set web.xml for my first project. For managing project easily i want to arrange files in folders according to their extension in Web Content folder.
Anything wrong with just putting them in exactly those folders?
someapp/js/myscript.js
someapp/css/mystyles.css