cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco Share :- JAVA SCRIPT PATH Doubt

nirvanvjain
Champ on-the-rise
Champ on-the-rise
Dear Team,

I explored Alfresco Share for Customization. I found that to refer  (or LOAD )JavaScript path at some location ; Alfresco have nicely used src="${page.url.context}/res/modules/simple-dialog.js" while rendering it will be
<serverName>: <port>/share/<your component or etc…>

I understood the {page.url.context} but what about /res/. I am not able find this folder any where in Alfresco or Alfresco Share.

Please guide me.

Thanks!
-Nirvan
5 REPLIES 5

ddraper
World-Class Innovator
World-Class Innovator
Hi Nirvan,

Any URL beginning /share/res is initially converted via the URLRewriter to /share/page/resource (which maps it to the Spring MVC dispatcher servlet) which then maps the request to the "resourceController" bean. This controller attempts to locate the resource defined by the remainder of the URL from a number of locations. Resources that are typically loaded are images, CSS, JavaScript, etc (but could be anything) and will be resolved to various locations available to the application (all of which are configurable through Spring application context changes). Typically this allows you to reference resources from anywhere within the application or the classpath.  It also allows you to reference resources that are stored under the META-INF directory of JARs on the classpath.

Regards,
Dave

nirvanvjain
Champ on-the-rise
Champ on-the-rise
Dear Dave Sir,

Thanks a billion for your answer.

Your Answer is so perfect but For such a naive user like me needs some example.

Sir, can you please give me some very small example and guide me if possible ?

Thanks!
-Nirvan

ddraper
World-Class Innovator
World-Class Innovator
Example: In then opening post on this topic you're asking where ${page.url.context}/res/modules/simple-dialog.js is located.

Well… ${page.url.context} is the application context (i.e. share).
/res maps to the resourceController bean.
This bean looks in a number of locations for /modules/simple-dialog.js
It locates this under webapps/share and returns it. If you look in your exploded "share" WAR file under the webapps directory you will see the "modules" folder which contains the "simple-dialog.js" file… this is the file that is getting returned.

nirvanvjain
Champ on-the-rise
Champ on-the-rise
Dear Sir,

Again thanks for your reply. I understand now and If I am not wrong then for all other path (for components/JavaScript etc) ; it refers the same way and pick the path. Am I correct sir ?

Thanks!
-Nirvan

ddraper
World-Class Innovator
World-Class Innovator
Yes, you're correct.