JavaEENotesForProfessionals.pdf

(622 KB) Pobierz
Java EE
Java EE
Notes for Professionals
®
Notes for Professionals
of professional hints and tricks
20+ pages
GoalKicker.com
Free Programming Books
Disclaimer
This is an unocial free book created for educational purposes and is
not aliated with ocial Java
®
EE group(s) or company(s).
All trademarks and registered trademarks are
the property of their respective owners
Contents
About
................................................................................................................................................................................... 1
Chapter 1: Getting started with Java EE
........................................................................................................... 2
Section 1.1: What is Java EE?
........................................................................................................................................ 2
Section 1.2: Installation
.................................................................................................................................................. 3
Section 1.3: Installing Payara Server Full
..................................................................................................................... 3
Section 1.4: Building my First JavaEE Application (Hello World)
.............................................................................. 4
Chapter 2: Java RESTful Web Services (JAX-RS)
......................................................................................... 6
Section 2.1: Simple Resource
........................................................................................................................................ 6
Section 2.2: GET method types
.................................................................................................................................... 6
Section 2.3: POST Method
............................................................................................................................................ 7
Section 2.4: Name binding
............................................................................................................................................ 8
Section 2.5: Exception Mapper
..................................................................................................................................... 9
Section 2.6: DELETE method
........................................................................................................................................ 9
Section 2.7: Custom parameter converters
.............................................................................................................. 10
Section 2.8: SubResources
......................................................................................................................................... 11
Section 2.9: UriInfo
...................................................................................................................................................... 11
Chapter 3: The WebSockets API
.......................................................................................................................... 13
Section 3.1: Creating a WebSocket communication
................................................................................................ 13
Section 3.2: Encoders and Decoder: Object-Oriented WebSockets
...................................................................... 14
Chapter 4: Java Messaging Service (JMS)
.................................................................................................... 21
Section 4.1: Using ActiveMQ library for messaging (activemq jms provider specific implementations)
................................................................................................................................................................................ 21
Section 4.2: Creating ConnectionFactory
................................................................................................................. 23
Section 4.3: Using jndi based lookup for messaging (Non-implementation-specific example)
......................... 24
Chapter 5: Java Connector Architecture (JCA)
........................................................................................... 26
Section 5.1: Example Resource Adapter
.................................................................................................................... 26
Chapter 6: The JavaMail API
................................................................................................................................. 27
Section 6.1: Send HTML Formatted Mail
.................................................................................................................... 27
Section 6.2: Send Simple Email
.................................................................................................................................. 27
Credits
.............................................................................................................................................................................. 29
You may also like
........................................................................................................................................................ 30
About
Please feel free to share this PDF with anyone for free,
latest version of this book can be downloaded from:
https://goalkicker.com/JavaEEBook
This
Java® EE Notes for Professionals
book is compiled from
Stack Overflow
Documentation,
the content is written by the beautiful people at Stack Overflow.
Text content is released under Creative Commons BY-SA, see credits at the end
of this book whom contributed to the various chapters. Images may be copyright
of their respective owners unless otherwise specified
This is an unofficial free book created for educational purposes and is not
affiliated with official Java® EE group(s) or company(s) nor Stack Overflow. All
trademarks and registered trademarks are the property of their respective
company owners
The information presented in this book is not guaranteed to be correct nor
accurate, use at your own risk
Please send feedback and corrections to
web@petercv.com
GoalKicker.com – Java® EE Notes for Professionals
1
Chapter 1: Getting started with Java EE
Section 1.1: What is Java EE?
Java EE stands for Java Enterprise Edition. Java EE extends the Java SE (which stands for Java Standard Edition). Java
EE is a set of technologies and related specifications that are oriented towards the development of large-scale
enterprise applications. Java EE is developed in a community driven process. So far the following versions of Java EE
have been released:
J2EE 1.2 (December12, 1999)
J2EE 1.3 (September 24, 2001)
J2EE 1.4 (November 11, 2003)
Java EE 5 (May 11, 2006)
Java EE 6 (December 10, 2009)
Java EE 7 (April 5, 2013)
Java EE 8 (August 31, 2017)
A key concept of the Java EE is that every Java EE version is comprised by a set of specific technologies. These
technologies address specific JSRs (Java Specification Requests). In order for a programmer to use these
technologies he needs to download an implementation of the Java EE technology specifications. The Java
Community provides a reference implementation for each technology but other Java EE compliant technologies are
developed and can also be used. The community provides a set of tests, namely the Java Compatibility Kit (JCK) that
can be used by the developers of a JSR implementation to check if it is compliant or not with the JSR. The following
table gives an overview of the technologies that comprise Java EE 7 and the related JSR that define the specs.
Java EE 7 Technology
Java Platform, Enterprise Edition 7 (Java EE 7)
Java API for WebSocket
Java API for JSON Processing
Java Servlet 3.1
JavaServer Faces 2.2
Expression Language 3.0
JavaServer Pages 2.3
Standard Tag Library for JavaServer Pages (JSTL) 1.2
Batch Applications for the Java Platform
Concurrency Utilities for Java EE 1.0
Contexts and Dependency Injection for Java 1.1
Dependency Injection for Java 1.0
Bean Validation 1.1
Enterprise JavaBeans 3.2
Interceptors 1.2 (Maintenance Release)
Java EE Connector Architecture 1.7
Java Persistence 2.1
Common Annotations for the Java Platform 1.2
Java Message Service API 2.0
Java Transaction API (JTA) 1.2
JavaMail 1.5
Java API for RESTful Web Services (JAX-RS) 2.0
JSR
JSR 342
JSR 356
JSR 353
JSR 340
JSR 344
JSR 341
JSR 245
JSR 52
JSR 352
JSR 236
JSR 346
JSR 330
JSR 349
JSR 345
JSR 318
JSR 322
JSR 338
JSR 250
JSR 343
JSR 907
JSR 919
JSR 339
GoalKicker.com – Java® EE Notes for Professionals
2
Implementing Enterprise Web Services 1.3
Java API for XML-Based Web Services (JAX-WS) 2.2
Web Services Metadata for the Java Platform
Java API for XML-Based RPC (JAX-RPC) 1.1 (Optional)
Java APIs for XML Messaging 1.3
Java API for XML Registries (JAXR) 1.0
Java Authorization Contract for Containers 1.5
Java EE Application Deployment 1.2 (Optional)
J2EE Management 1.1
Debugging Support for Other Languages 1.0
Java Architecture for XML Binding (JAXB) 2.2
Java API for XML Processing (JAXP) 1.3
Java Database Connectivity 4.0
Java Management Extensions (JMX) 2.0
JavaBeans Activation Framework (JAF) 1.1
Streaming API for XML (StAX) 1.0
JSR 109
JSR 224
JSR 181
JSR 101
JSR 67
JSR 93
JSR 115
JSR 88
JSR 77
JSR 45
JSR 222
JSR 206
JSR 221
JSR 003
JSR 925
JSR 173
Java Authentication Service Provider Interface for Containers 1.1 JSR 196
Section 1.2: Installation
First of all, you cannot "install" Java EE. Java EE consists of a number of specifications. You can install
implementations of those specifications however.
Depending on your needs, there are lots of possibilities. To install most (or all) of the specifications, you can choose
a Java EE 7 compatible Application Server. Depending on your needs, you can choose between application servers
that implement the web profile or application servers that implement the full profile. For a list of Java EE7
compatible application servers see
Java EE Compatibility.
Section 1.3: Installing Payara Server Full
Prerequisites
JDK 1.7 or later installed. You can find the Oracle JDK's
here.
Steps
Download
Payara Server Full.
Unzip the Payara Server at some location on your computer. We will use
C:\payara41
as INSTALL_DIR for
Windows users and
/payara41
for Linux/Mac users.
Starting / stopping Payara from the command prompt
Windows: Open a command prompt and execute the following command to start/stop Payara:
"C:\payara41\bin\asadmin"
start-domain
"C:\payara41\bin\asadmin"
stop-domain
Linux/Max: Open a terminal and execute the following command to start/stop Payara:
GoalKicker.com – Java® EE Notes for Professionals
3
Zgłoś jeśli naruszono regulamin