Changing default welcome-page for spring-boot application deployed as a war

It’s not too hard to do… you just need to forward the default mapping… @Configuration public class DefaultView extends WebMvcConfigurerAdapter{ @Override public void addViewControllers( ViewControllerRegistry registry ) { registry.addViewController( “https://stackoverflow.com/” ).setViewName( “forward:/yourpage.html” ); registry.setOrder( Ordered.HIGHEST_PRECEDENCE ); super.addViewControllers( registry ); } }

CORS – Tomcat – Geoserver

I need to do the same to avoid the usage of a proxy in OpenLayers. Since I’m running Ubuntu 12.04, I’ve installed Tomcat 7.0.55, instead of the default 7.0.26 (installed from packages). To add CORS headers, I simply added to $CATALINA_HOME/conf/web.xml the following lines: <filter> <filter-name>CorsFilter</filter-name> <filter-class>org.apache.catalina.filters.CorsFilter</filter-class> <init-param> <param-name>cors.allowed.origins</param-name> <param-value>*</param-value> </init-param> </filter> <filter-mapping> <filter-name>CorsFilter</filter-name> <url-pattern>/*</url-pattern> … Read more

Tomcat 7 – Servlet 3.0: Invalid byte tag in constant pool

Adding metadata-complete=”true” to your web.xml should sort the issue <web-app version=”3.0″ xmlns=”http://java.sun.com/xml/ns/javaee” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd” metadata-complete=”true”> This tells tomcat not to scan classes for annotations: https://web.archive.org/web/20180510163848/http://www.tomcatexpert.com/blog/2011/10/12/how-use-fragments-and-annotations-configure-your-web-application

Jersey 2 injection source for multipart formdata

You need to enable MultiPart feature on your application. Enabling this feature injects necessary message body readers, writers to your Jersey 2 application. Here is how you register them: On the server-side (http-server): final ResourceConfig resourceConfig = new ResourceConfig(MultiPartResource.class); resourceConfig.register(MultiPartFeature.class); On the server-side (servlet deployment): import org.glassfish.jersey.filter.LoggingFilter; import org.glassfish.jersey.media.multipart.MultiPartFeature; import javax.ws.rs.core.Application; import java.util.HashSet; import java.util.Set; … Read more

Tomcat 7 – Maven Plugin?

It work for me as the following. My setting.xml <server> <id>local_tomcat</id> <username>ray</username> <password>password</password> </server> My plugin configuration <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> <configuration> <server>local_tomcat</server> <url>http://localhost:8080/manager/text</url> </configuration> </plugin> My tomcat-users.xml <role rolename=”manager-gui”/> <role rolename=”manager-script”/> <user password=”password” roles=”manager-gui, manager-script” username=”ray”/>