embedded-tomcat-7

How to check if app is running on Tomcat 7 embedded?

早过忘川 提交于 2020-03-05 04:22:48
问题 I have a application that runs as war or in standalone mode with tomcat embedded, I want to check if the application is running as a war within tomcat or if it is running with tomcat embedded. 回答1: This is my solution. String path = getClass().getProtectionDomain().getCodeSource().getLocation().getFile(); boolean onWar = path.contains("WEB-INF"); 来源: https://stackoverflow.com/questions/56587068/how-to-check-if-app-is-running-on-tomcat-7-embedded

Specify a custom web.xml to an embedded tomcat

做~自己de王妃 提交于 2019-12-28 12:42:48
问题 Is there a way to specify a different web.xml from the standard WEB-INF/web.xml when using an embedded tomcat instance? I would like to put a web.xml in my src/test/resources (or some other area) and refer to that web.xml when starting the embedded tomcat. Here is my existing code to start the tomcat instance tomcat = new Tomcat(); String baseDir = "."; tomcat.setPort(8080); tomcat.setBaseDir(baseDir); tomcat.getHost().setAppBase(baseDir); tomcat.getHost().setAutoDeploy(true); tomcat

Where the embedded Tomcat extracts?

淺唱寂寞╮ 提交于 2019-12-25 06:45:14
问题 Where the embedded in executable jar Tomcat archive extracts? In memory or in the some folder on hard drive? How many resources it requires compared with ordinary Tomcat? 回答1: This probably won't be a complete answer, but just as much as I can explain. I too was wondering, so I did a little digging. tomcat-embed-core With spring boot, we usually include spring-boot-starter-tomcat (through spring-boot-starter-web ), which includes tomcat-embed-core . If you were to create a normal main method,

Programmatically enable GZIP Tomcat 7 (embedded)

依然范特西╮ 提交于 2019-12-24 07:04:37
问题 I am using Tomcat7 (embedded) Something like this... String APP_DIR = "ROOT"; Tomcat current = new Tomcat(); File file = new File(APP_DIR); if (file.isDirectory() && file.canRead()) { ctx = current.addWebapp(null, "", file.getAbsolutePath()); ctx.setSessionCookiePathUsesTrailingSlash(false); } current.start(); ctx.addServletMapping("*.pdf", "jsp", true); I have enabled the *.pdf mapping to jsp servlet (some issue I had with IE) is there a way to enable GZIP with this config (I have no web.xml

Non-ASCII symbols in path variable of Spring MVC application on embedded Tomcat server setup using Spring Boot

大兔子大兔子 提交于 2019-12-20 03:17:05
问题 I am building a service using Spring MVC set up using Spring Boot where I want to be able to have arbitrary unicode characters in the URLs. By looking around the web I end up with @Configuration @ComponentScan @EnableAutoConfiguration public class Main { public static void main(String... args) throws Exception { SpringApplication.run(Main.class, args); } @Bean public Filter characterEncodingFilter() { CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();

Gradle Spring Boot project not working in Tomcat as a WAR

北战南征 提交于 2019-12-18 06:49:21
问题 I have a simple sample application written in Spring Boot using Gradle dependency. It says helloworld on calling localhost:8080/greetings. I packaged it as WAR and deployed it to a Tomcat as a myWebApp.war. When i call localhost:8080/myWebApp/greetings i get 404. What am i supposed to infer from the below catalina.log Sep 17, 2014 1:43:09 AM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.54 Sep 17, 2014 1:43:09 AM org.apache.catalina

Gradle Spring Boot project not working in Tomcat as a WAR

徘徊边缘 提交于 2019-12-18 06:49:02
问题 I have a simple sample application written in Spring Boot using Gradle dependency. It says helloworld on calling localhost:8080/greetings. I packaged it as WAR and deployed it to a Tomcat as a myWebApp.war. When i call localhost:8080/myWebApp/greetings i get 404. What am i supposed to infer from the below catalina.log Sep 17, 2014 1:43:09 AM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.54 Sep 17, 2014 1:43:09 AM org.apache.catalina

Reverse Proxy Java

扶醉桌前 提交于 2019-12-12 10:06:40
问题 I am working with a Java web application and I would like to have a reverse proxy masking some of my internal endpoints. Requirements 1. The reverse proxy maps need to be modifiable at runtime e.g if we move some components to another server we should be able to modify the mapping such that new requests are routed to this endpoint. 2. This must be embeddable to a standard servlet container like Jetty. Most of the Java Reverse Proxies out there such as J2EP require mapping information

Embedded Tomcat + Spring file-upload: HTTP 404

旧巷老猫 提交于 2019-12-11 23:26:43
问题 I can open myApp throw Internet Browser if I start it via Eclipse, but, although I can start the Embedded server throw command line (java -jar myApp.jar) I am getting HTTP Status 404. Probably some issue with context but I can't figure out what is wrong. Kindly, see below the structure in Eclipse and in myApp.jar. The application is basically compound by 5 files: two placed in com.mycompany.myapp.batchs.AuthFileUpload (App.class with main method and FileUploadController.class as a very simple

Configuring Logging for Grails Standalone App Runner

。_饼干妹妹 提交于 2019-12-11 16:08:39
问题 I am writing a Grails app and would like to use the Grails Standalone App Runner that packages your Grails app into a fat JAR with an embedded Tomcat container. I would like to configure logging for the embedded Tomcat container will use to store and read SSL certs from. I want to specify log levels for different catalina components, and also replace log4j with logback using SyslogAppender . How/where do I make such configurations? Is this documented anywhere? 回答1: If you want to replace