Embedded Tomcat

  • Beitrags-Autor:
  • Beitrags-Kategorie:JavaEE

Web server, Web container and Application server

Creating a Web App with Bootstrap and Tomcat 7 Embedded
Embedded Tomcat 7 server in an executable JAR
Embed Tomcat 8 Server into Java Web Applications
Using Embedded Tomcat 8.5
Application with Embedded Tomcat 9
Embedded Tomcat 10 Example
JSF 3.0 an embedded tomcat server 10.1.5
install and configure JSF libraries



github.com/apache/tomcat
Apache Tomcat 10.1 – Configuration Reference
Apache Tomcat 10.1 – API
Setup your own Tomcat security realm
Tomcat REALMS
Configuring HTTPS on Tomcat
Apache Tomcat 10 on Ubuntu 20.04
Configure SSL on Tomcat
Embedded Tomcat : Tips, Tricks and Hacks

siehe auch: Java Debugging

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");

Weld

https://weld.cdi-spec.org/documentation
Tomcat 10.1 is available and supports EE 10
https://docs.jboss.org/weld/reference/latest-5.1
Tomcat 10.1, which implements Servlet 5.0 specification, is supported.
https://devcodef1.com/news/1250996/cdi-issue-with-tomcat-10-1-17-and-weld-5-1-2

Basic Weld example with Embedded Tomcat not working

WebResourceRoot webResourceRoot = new StandardRoot(ctx);
webResourceRoot.addPreResources(
        new DirResourceSet(webResourceRoot, "/WEB-INF/classes", additionWebInfClasses.getAbsolutePath(), "/"));
ctx.setResources(webResourceRoot); // this was missing

Jakarta EE

Tomcat 10.1.x, which is based on Servlet 6.0, JSP 3.1, EL 5.0, WS 2.1 and JASIC 3.0
https://jakarta.ee/xml/ns
Playlist: Getting Started with Jakarta EE 9
Starter Guides
About EL

CDI + JAX-RS

Getting Started: Contexts and Dependency Injection (CDI)
Getting Started with CDI + Jakarta EE Tutorial
Tomcat 10: CDI 2, JAX-RS and dependent libraries support
https://balusc.omnifaces.org/2013/10/how-to-install-cdi-in-tomcat.html
CDI in JSF 2.3, Java EE 7 to Java EE 8

OpenWebBeans in Java SE

PrimeFaces

Grundlagen JavaServer Faces (JSF)
PrimeFaces 8 mit JSF 2.3
Process GET parameters + Performing business action on GET parameters


bean-discovery-mode

Identifying and solving javax.el.PropertyNotFoundException: Target Unreachable
How file upload works in apache tomcat using primefaces?

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