Embedded Tomcat

  • Beitrags-Autor:
  • Beitrags-Kategorie:JavaEE

github.com/apache/tomcat

a static resource servlet, siehe auch BalusC

addContext() vs. addWebapp()
DefaultServlet + JspServlet

Wrapper defaultServlet = rootContext.createWrapper();
defaultServlet.setName("default");
defaultServlet.setServletClass("org.apache.catalina.servlets.DefaultServlet");
defaultServlet.addInitParameter("debug", "0");
defaultServlet.addInitParameter("listings", "false");
defaultServlet.setLoadOnStartup(1);
rootContext.addChild(defaultServlet);
rootContext.addServletMapping("/", "default");

web.xml

metadata-complete=“false“
org.apache.myfaces.annotation.USE_CDI_FOR_ANNOTATION_SCANNING = true

Navigation

https://stackoverflow.com/

The returned String from action method specifies the page which will be redirected.

public String myAction() {
return "navigatedPage";
}

If you want to redirect an exact URL you can use the following code snipped.

ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
ec.redirect("URL");

Sonstiges

Tomcat 10.1 is available and supports EE 10
Tomcat 10.1, which implements Servlet 5.0 specification, is supported.
Tomcat 10.1.x, which is based on Servlet 6.0, JSP 3.1, EL 5.0, WS 2.1 and JASIC 3.0

Embedded Tomcat : Tips, Tricks and Hacks

https://devcodef1.com/news/1250996/cdi-issue-with-tomcat-10-1-17-and-weld-5-1-2

https://jakarta.ee/xml/ns
https://weld.cdi-spec.org/documentation
https://docs.jboss.org/weld/reference/latest-5.1

Creating a Web App with Bootstrap and Tomcat Embedded

bean-discovery-mode

How do I add to a project with JSF 3.0 an embedded tomcat server 10.1.5 that runs from a main?
Identifying and solving javax.el.PropertyNotFoundException: Target Unreachable
How to properly install and configure JSF libraries via Maven?
How file upload works in apache tomcat using primefaces?

Basic Weld example with Embedded Tomcat not working
ctx.setResources(webResourceRoot)

https://hantsy.gitbook.io/java-ee-8-by-example/jsf/jsf-activation

https://balusc.omnifaces.org/2013/10/how-to-install-cdi-in-tomcat.html

https://www.codejava.net/servers/tomcat/how-to-embed-tomcat-server-into-java-web-applications

https://www.theserverside.com/tutorial/How-to-embed-Tomcat-and-Java-web-apps-in-an-executable-JAR

How to configure JDBC Resource in Embedded Tomcat 8?
Tomcat DataSource JNDI Example in Java
JavaMail Example – Send Mail in Java using SMTP