cancel
Showing results for 
Search instead for 
Did you mean: 

How to apply css style from 'web' folder in html of a webscript

mbel
Star Contributor
Star Contributor

Hello,

I have generated maven alfresco amp project and I have folder web with css,scrips and so on.

In order to import some css file in webscript html, what exactly the path to this directory should be?

I tried with some variants but ...nothing is found.

And is this content public how can I reach it in the browser?

Thank you in advance.

1 ACCEPTED ANSWER

ycoulon
Employee
Employee

Hi,

Just create an AIO maven project.

The alfresco amp is created with a demoamp.css file.

I manage to access it using that URL : http://localhost:8080/alfresco/css/demoamp.css

View answer in original post

20 REPLIES 20

ycoulon
Employee
Employee

Hi,

Just create an AIO maven project.

The alfresco amp is created with a demoamp.css file.

I manage to access it using that URL : http://localhost:8080/alfresco/css/demoamp.css

mbel
Star Contributor
Star Contributor

No need of AIO project.

I wanted to reach the created demoamp.css file.

so I just imported href="${url.context}/css/demoamp.css in my html file.

That's the URL which I needed. Thanks!

mbel
Star Contributor
Star Contributor

I installed my custom AMP to alfresco system and now the CSS is not working and I can't access it with the above url.

  1. Request URL:
  2. Request Method:
    GET
  3. Status Code:
    404 Not Found

While I was running it through my IDE , everything was ok and it managed to access the above url

Do you know what the reason could be ? What have I missed?

Hi,

Can you list the files in the alfresco/css folder ($ALF_HOME/tomcat/webapps/alfresco) ?

After applying the AMP against the war, did you clear that folder ? If you didn't maybe tomcat did not re-deploy the war with your customisation.

For more information about applying an AMP : Installing an Alfresco Module Package | Alfresco Documentation 

Yann

mbel
Star Contributor
Star Contributor

Yes, I did clear the alfresco folder in tomcat/webapps before install the amp.

In general in tomcat\webapps\alfresco\css I should see my custom CSS or ?

I just install an AMP against Alfresco.war with '-verbose'. From what I saw the web folder is not mapped in the war as the documentation said : AMP to WAR mapping | Alfresco Documentation 

Adding files relating to version '1.0-SNAPSHOT' of module 'test'
- File '/WEB-INF/lib/test-1.0-SNAPSHOT.jar' added to war from amp
- File '/WEB-INF/classes/alfresco/extension/templates/webscripts/helloworld.get.desc.xml' added to war from amp
- File '/WEB-INF/classes/alfresco/extension/templates/webscripts/helloworld.get.html.ftl' added to war from amp
- File '/WEB-INF/classes/alfresco/extension/templates/webscripts/helloworld.get.js' added to war from amp
- Directory '/WEB-INF/classes/alfresco/extension/templates/webscripts' added to war
- Directory '/WEB-INF/classes/alfresco/extension/templates' added to war
- Directory '/WEB-INF/classes/alfresco/extension' added to war
- File '/WEB-INF/classes/alfresco/module/test/context/webscript-context.xml' added to war from amp
- File '/WEB-INF/classes/alfresco/module/test/context/service-context.xml' added to war from amp
- File '/WEB-INF/classes/alfresco/module/test/context/bootstrap-context.xml' added to war from amp
- Directory '/WEB-INF/classes/alfresco/module/test/context' added to war
- File '/WEB-INF/classes/alfresco/module/test/model/content-model.xml' added to war from amp
- File '/WEB-INF/classes/alfresco/module/test/model/workflow-model.xml' added to war from amp
- Directory '/WEB-INF/classes/alfresco/module/test/model' added to war
- File '/WEB-INF/classes/alfresco/module/test/module-context.xml' added to war from amp
- File '/WEB-INF/classes/alfresco/module/test/alfresco-global.properties' added to war from amp
- File '/WEB-INF/classes/alfresco/module/test/log4j.properties' added to war from amp

In order to fix, you need to add a file-mapping.properties file with the following content :

include.default=true
/web=/

PS : Maybe you don't need to update 2 thread.

Yann

mbel
Star Contributor
Star Contributor

Hi,
I created the property file - file-mapping.properties in src/main/amp directory and added the above properties.

However, again it couldn't find the css and receive 404 error.

PS: I don't understand what you mean in your PS.

ycoulon
Employee
Employee

Hi,

Could you apply your AMP with -verbose option and put the output here ?

Can you see something like according to your AMP name/version/content : 

Adding files relating to version '1.0-SNAPSHOT' of module 'test'
- File '/css/demoamp.css' added to war from amp
- File '/jsp/demoamp.jsp' added to war from amp
- Directory '/jsp' added to war
- File '/licenses/README-licenses.txt' added to war from amp
- Directory '/licenses' added to war
- File '/scripts/demoamp.js' added to war from amp
- File '/scripts/demoamp.js' added to war from amp
- File '/jsp/demoamp.jsp' added to war from amp

I was just saying that After installing custom AMP to Alfresco system - custom CSS, JS alerts and WebScript Exception handl... seems to be about the same issue we discuss here.

Yann

mbel
Star Contributor
Star Contributor

How did you install only /web content ?

As in general I uninstall the whole amp and re-install it again.