Error 404 Not Found Loading Bootstrap Glyphicons with Spring MVC - angularjs

I'm building a maven web application using Spring 3.0.5 MVC, AngularJS 1.5 and Boostrap 3.3.6.
All front-end resources are under webapp/resources/[js,css,fonts].
I've add <mvc:resources mapping="/resources/**" location="/resources/" /> to my spring configuration file.
My issue is that i'm not able to get glyphicons-halflings-regular.xxx files. I got a 404 not found error. (exemple with http://localhost:8080/my-app/resources/fonts/glyphicons-halflings-regular.woff)
I run my app with maven jetty plugin.
any hints?
Thanks in advance

Check that your font files are being copied to the target folder you expect them to be copied to. In your case, you should end up with the *.woff files under ~target/my-app/resources/fonts.
If the files are not in the correct/expected target location, check that you have correctly defined the resources element in your pom, and you're including the *.woff files.
Based on what you've said, I would expect your files to be placed into ~/target/my-app/[js,css,fonts] rather than ~/target/my-app/resources/[js,css,fonts]. If you see them there, then you can either remove the /resources portion of the links, or move the resources under /src/main/resources/resources.
If there are no *.woff files in the target folder at all, check the <resource> element of your pom and make sure you're including all the file types you want. If you need more control, take a look at the copy-resources goal of the maven-resources-plugin here: https://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html
Edit
I just noticed that you put your resources under /src/main/webapp/resources. Since this isn't the standard resource source folder, you can either move the resources into /src/main/resources or add the directory /src/main/webapp/resources to your resource list in the pom.

Related

Deploying Angular Application to GitPages - Not Routing Properly

Disclaimer: I am not a frontend guy by trade. I am being asked to deploy an Angular application other engineers have created.
I have gone through the process of deploying an Angular application to GitPages and have also tried the handy Angular CLI GH Pages library. However, they both have the same issue, and I'm not sure if it's the application itself or how I am deploying it.
The base page loads fine, but all other resources (image/font files, links to other pages, etc.) do not load properly. This is because they are not using the proper base URL; our corporate GitHub makes us use https://....com/<org>/<repo> as the URL. All resources outside of the base page are not prepending the /<org>/<repo>/ part to the URL, so they are all returning 404s.
My index.html file in docs/ contains the proper base href="/<org>/<repo>/" and the docs/ folder contains all needed images and font files in its assets/ subdirectory, so I'm not sure what gives. I have also copied index.html to 404.html.
Am I missing something? Or is it possible that this web application was not created correctly for GH Pages?
Thanks in advance :-)
Change the base href to index.html only and all will work from there
base href="index.html"
From there it will take the path properly

DNN - How can I edit Client Dependency files to change mappings for a specific JQuery resource file?

I have a Dot Net Nuke (DNN 9.1) site which is hosted on IIS. I have located some resources that have made the website very slow, mostly JS / CSS files. I traced these files are referenced in resource files like below:
Website\App_Data\ClientDependency\DNNWeb-someGUIDaaarfgxetrrcxxdrwdc-map.xml
which has entriees like below:
<item key="678f2dbfsdg- some key -dtgsdt54fdfgy7" file="" compression="" version="180">
<files>
<file name="/Resources/libraries/jQuery/01_09_01/jquery.js" />
<file name="/Resources/libraries/jQuery-UI/01_11_03/jquery-ui.js" />
</files>
</item>
I need to modify mapings so the minimized version of JS files may be used, to enhance performance (e.g. jquery.min.js), however, its being said that this XML file gets regenerated if modified manually, and my changes will be lost.
Any thoughts or help will be appreciated.
Thank you.
DNN loads minified CSS and JS files based on user config. you need to enable this options, the options are
Enable Composite Files
Minify CSS
Minify JS
In order to change above settings go to Settings (gear icon) -> Servers -> Server Settings Tab -> Performance tab, then find Client Resources Management Mode section (at the bottom of this tab (as of v9.5)) and change the options as you prefer.
The following setting allows CDN references for JavaScript libraries. Thanks to Michael Tobisch
Settings >> Extensions, select JavaScript Libraries from the dropdown list, click the pencil next to the JavaScript jQuery library, select the Extension Settings tab and enter the Url in the Custom CDN setting.

Spring Devtools triggers restart when changing excluded files

I have a Spring Boot Web Project that uses Joinfaces and Primefaces. The application extends from SpringBootServletInitializer and also generates a war file.
For development I start my Project (in Eclipse) using RunAs -> Spring Boot App. I've added the spring-boot-devtools dependency as described in the Developer Tools Docu. Everything seems to work, except that changes in a xhtml file also triggers the restart.
I've added the spring.devtools.restart.additional-exclude property in my application.yml to exclude also webapp/**. But this seems to have no effect, because a change still triggers the restart.
spring:
devtools:
restart:
additional-exclude: webapp/**
My Project structure looks like:
src
-main
-java
-resources
-webapp
- *.xhtml
But maybe I do not understand how to use the DevTools correct - Starting the application as Spring Boot App might not be the correct usage? Because if I place a file e.g. foo.txt under src/main/resources and update its content the application is also restarted (using the DevTools defaults (which should exclude /resources)).
Using:
Eclipse Oxygen.3a Release (4.7.3a)
Joinfaces 3.2.1 -> Spring Boot 2.0.2.RELEASE
The solution to my main problem might be relatively easy.
I've added the webapp folder as Source Folder in Eclipse. As soon as I've removed the folder from the list of source folders, the reload was no longer triggered when I changed something in the xhtml files.
This answer gave me the idea, that the source folder might be the problem.
My exclude also did not work. What I did as a workaround is slowing the reload down like this:
poll-interval: 6000
quiet-period: 5000

Grails 3.0 static html in run-app

similar questions have been asked before, regarding grails 2(.3, .4). I find it strange that i could not find a way to do this, as it seems a standard use-case to me.
I simply want to serve html-pages, including their linked .css and .js (angular and jquery content) when i run grails run-app.
I want to check if my http-calls are handeled correctly on both sides - without needing to deploy a .war and configuring a database.
afaik grails run-app simply starts a jetty/tomcat - both of which can obviously serve .html pages. What do i have to do to make the grails development-tooling deploy my files?
I need to make http-requests,
so using a different Server would violate JS-SOP,
while deploying the .war would greatly slow down the development process
I've so far only found clunky jsonp, proxy, .war deployment solutions, or solutions for grails 2.x
I tried placing the files literally everywhere in the projects' structure (/src/main, /src/main/resources, /src/main/public, the assets folder and its subfolders, created web-app directories in every subdirectory, the Init, domain, conf directories - you name it)
Add the index.html to src/main/resources/public
Then add this to UrlMappings.groovy:
"/"(redirect:"/index.html")
For grails >= 3.0.12
Location of static resources
In order to resolve an issue around how POST requests are treated for
REST applications on non-existent resources, static resources located
in src/main/resources/public are now resolved under the /static/** URI
by default, instead of the base URI /**. If you wish to restore the
previous behaviour add the following configuration:
grails.resources.pattern = '/**'
https://github.com/grails/grails-core/releases/tag/v3.0.12
Contrary to the accepted answer, you don't need a redirect. I have made able to make this work with the following config:
UrlMappings.groovy
"/"(uri: "/index.html")
application.yml
grails:
resources:
pattern: '/**'
Finally, you just need to have your index.html file located under src/main/webapp

ExpressionEngine - Not sure how to fix this 404 not found error

I am trying to setup a localhost version of our site and have a problem getting this setup correctly.
Both our live and localhost site have this directory structure:
/na_cms/expressionengine/templates/default_site/c.group
/na_cms/expressionengine/templates/default_site/j.group
/na_cms/expressionengine/templates/default_site/default.group
/na_cms/expressionengine/templates/default_site/inc.group
On our live site, CSS files in our templates are accessed like this:
href=“css/c/modal.css”
src=“j/jquery-ui-1.8.4.custom.min.js”
How do I get rid of the 404 not found errors for the CSS and javascript files on the localhost site?
My config file has
$config[‘rewrite_short_tags’] = TRUE;
I'm obviously using assumptions here until further information gleamed...
You're using templates to hold your JS and CSS, rather than external files (Nothing wrong with that), so they're not technically relative URLs - it's pulled from the database so you won't have any more of a path than template group and template. The browser will not be targeting these template files directly, it will be EE providing them.
In your j.group folder I'm assuming you have a file called "jquery-ui-1.8.4.custom.min.js.js", which relates to a template group called "j" and a template called "jquery-ui-1.8.4.custom.min.js"?
What I'm a bit confused at is "css/c/modal.css", as this is indicating a template group called css, but you've stated your template group is called "c" and the template is "modal.css". Possibly this was a mistake, or you've got a "css" template group and falling into the index template...?
Firstly, check your template folder settings in EE, Design -> Templates -> Template Manager, then "Global Template Preferences". Look for "Basepath to Template File Directory". I'm assuming that you copied the online database to your local, rather than a new fresh install?
If you're using htaccess rewriting, check that is working on your local.
Failing that, try changing the paths to the CSS and JS to use the path variable:
src=“{path='j/jquery-ui-1.8.4.custom.min.js'}”
http://expressionengine.com/user_guide/templates/globals/path.html

Resources