static-content
Spring Boot project with static content generates 404 when running jar
It turns out that whilst Spring Boot is being clever at adding the various resource directories to the classpath, Maven is not and it’s up to you to deal with that part. By default, only src/main/resources will be included in your JAR. If you create a folder called /static in the root of your project … Read more
How to configure Wildfly to serve static content (like images)?
Add another file handler and another location to the undertow subsystem in standalone.xml: <server name=”default-server”> <http-listener name=”default” socket-binding=”http”/> <host name=”default-host” alias=”localhost”> <location name=”https://stackoverflow.com/” handler=”welcome-content”/> <location name=”/img” handler=”images”/> </host> </server> <handlers> <file name=”welcome-content” path=”${jboss.home.dir}/welcome-content” directory-listing=”true”/> <file name=”images” path=”/var/images” directory-listing=”true”/> </handlers>
How to do static content in Rails?
For Rails6, Rails5 and Rails4 you can do the following: Put the line below at the end of your routes.rb get ‘:action’ => ‘static#:action’ Then requests to root/welcome, will render the /app/views/static/welcome.html.erb. Don’t forget to create a ‘static’ controller, even though you don’t have to put anything in there. Limitation: If somebody tries to access … Read more
How do I use Spring Boot to serve static content located in Dropbox folder?
You can add your own static resource handler (it overwrites the default), e.g. @Configuration public class StaticResourceConfiguration extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler(“/**”).addResourceLocations(“file:/path/to/my/dropbox/”); } } There is some documentation about this in Spring Boot, but it’s really just a vanilla Spring MVC feature. Also since spring boot 1.2 (I think) you … Read more
Simplest way to serve static data from outside the application server in a Java web application
I’ve seen some suggestions like having the image directory being a symbolic link pointing to a directory outside the web container, but will this approach work both on Windows and *nix environments? If you adhere the *nix filesystem path rules (i.e. you use exclusively forward slashes as in /path/to/files), then it will work on Windows … Read more
Best lightweight web server (only static content) for Windows [closed]
You can use Python as a quick way to host static content. On Windows, there are many options for running Python, I’ve personally used CygWin and ActivePython. To use Python as a simple HTTP server just change your working directory to the folder with your static content and type python -m SimpleHTTPServer 8000, everything in … Read more
Event handler not working on dynamic content [duplicate]
You have to add the selector parameter, otherwise the event is directly bound instead of delegated, which only works if the element already exists (so it doesn’t work for dynamically loaded content). See http://api.jquery.com/on/#direct-and-delegated-events Change your code to $(document.body).on(‘click’, ‘.update’ ,function(){ The jQuery set receives the event then delegates it to elements matching the selector … Read more