Table of contents
Open Table of contents
Reading Notes on the Official Java EE Documentation
This post records some reading notes from the official Java EE 8 documentation.
Documentation Links
Interesting Quotes
Reality:
In the world of information technology, enterprise applications must be designed, built, and produced for less money, with greater speed, and with fewer resources
Java EE Components
The Java EE specification defines the following Java EE components:
- Application clients and applets are components that run on the client.
- Java Servlet, JavaServer Faces, and JavaServer Pages (JSP) technology components are web components that run on the server.
- EJB components (enterprise beans) are business components that run on the server
Java EE Container
Containers are the interface between a component and the low-level, platform-specific functionality that supports the component.
Before it can be executed, a web, enterprise bean, or application client component must be assembled into a Java EE module and deployed into its container
The container also manages nonconfigurable services, such as enterprise bean and servlet lifecycles, database connection resource pooling, data persistence, and access to the Java EE platform APIs
Web Container
A web container provides such services as request dispatching, security, concurrency, and lifecycle management
JSF
In JSF 2.3, managed bean annotations are deprecated; CDI is now the preferred approach.
RESTful Web Services
The REST architectural style is designed to use a stateless communication protocol, typically HTTP. In the REST architecture style, clients and servers exchange representations of resources by using a standardized interface and protocol.
EJB
Written in the Java programming language, an enterprise bean is a server-side component that encapsulates the business logic of an application.
JPA
An entity is a lightweight persistence domain object. Typically, an entity represents a table in a relational database, and each entity instance corresponds to a row in that table
Security
A realm is a complete database of users and groups identified as valid users of one or more applications and controlled by the same authentication policy.
A principal is an entity that can be authenticated by an authentication protocol in a security service that is deployed in an enterprise. A principal is identified by using a principal name and authenticated by using authentication data.
A credential is an object that contains or references security attributes used to authenticate a principal for Java EE services. A principal acquires a credential upon authentication or from another principal that allows its credential to be used
When you design an enterprise bean or web component, you should always think about the kinds of users who will access the component
CDI
Beans that use session, application, or conversation scope must be serializable, but beans that use request scope do not have to be serializable.
JTA
The Java™ Transaction API (JTA) allows applications to perform distributed transactions, that is, transactions that access and update data on two or more networked computer resources
Common Terms
- Java EE - Java Enterprise Edition - the enterprise edition of Java
- Java SE - Java Standard Edition - the standard edition of Java
- Java Specification Requests - JSR - specification requests for Java
- Enterprise JavaBeans - EJB - enterprise-grade Java beans
- Enterprise information system - EIS - enterprise information system; here it usually refers to where data is stored, such as a DB
- Graphical User Interface - GUI - graphical user interface
- Java Persistence API - JPA
- Java Transaction API - JTA
- Java API for RESTful Web Services - JAX-RS
- Contexts and Dependency Injection for Java EE - CDI
- Java Archive - JAR
- Web Archive - WAR
- Enterprise Archive -EAR
- World Wide Web Consortium - W3C - the World Wide Web Consortium
- Uniform Resource Identifiers - URI
- Java Persistence Query Language - JPQL
Chapters Worth Reading
Java EE Architecture
- Introduction to Java EE
- Introduction to Distributed Multitiered Applications
- Introduction to the Java EE Container
- Overview of Java EE Technologies
- Overview of Packaging in Java EE
- Web Applications Overview
JSF
- What Is a JSF Application
- The Role of the Development Setting in web.xml in JSF
- Tags Supported by JSF
- The JSF Lifecycle
- Accessing Web Resources in JSF
- Overview of Ajax in JSF
- Internationalization in JSF
- JSF Tags
CDI
- CDI Overview
- Scopes in CDI, and Which Scope-Annotated Beans Need to Implement Serializable
- Scenarios and Usage of @Alternative in CDI
Web Services
JAX-RS
EJB
JPA
- Introduction to Entities
- Some persistence.xml Configuration
- Getting Started with JPQL
- Explanation of java:app/global/module
- Explanation of java:comp/env/jdbc
- JPA Embedded Objects with @Embeddable
Java EE Security
Issues Encountered
Garbled Output When Starting Tomcat on Windows
This happens because on a Chinese-locale Windows system, the console encoding should be set to GBK.
- Go to the conf folder in the Tomcat installation directory
- Open the logging-properties file
- Find java.util.logging.ConsoleHandler.encoding = UTF-8 and change the UTF-8 in it to GBK
- Save and exit
- Start it again and you’re done
Installing Multiple Tomcat Instances on Windows
Just download the versions you need.
Issues with Installing Multiple Tomcat Instances on Windows
After installing Tomcat, we usually set environment variables. With multiple Tomcat instances, each Tomcat should have its own corresponding environment variables. Otherwise, the startup scripts of all the Tomcat instances pick up the same environment variables.
Solution
You just need to change the value read in the startup script. For detailed steps, see here.
Running Java EE Projects on Windows
The most straightforward approach is to download a Tomcat EE and configure it in IDEA. Don’t use Tomcat — it’s quite troublesome to configure, and you’ll run into all kinds of problems.
Hibernate
https://www.cnblogs.com/sundaysjava/p/10328299.html
Resources
Some Java EE Examples
Interesting Thoughts?
How to Choose Between POST and PUT in RESTful?
The highly upvoted answer. My rough understanding: use PUT when the operation you want to perform on the resource is idempotent, and POST when the operation on the resource is not idempotent. It’s not “POST is for creating resources, PUT is for modifying resources,” nor “PUT is for creating resources, POST is for modifying resources.” Both of these claims are wrong.