標籤: j2ee
J2EE Design Pattern – Context Object
Problem
Avoid Protocol-specific outsides its context
Solution
A context object encapsulate protocol-specific information.
Example
Spring
- ApplicationContext (Per Application)
- SecurityContext (Per Request)
Java Server Face
- FacesContext (Per Request)
Servlet
- ServletContext
J2EE Design Pattern – Intercepting Filter
Problem
Preprocessing and post-processing of a request and response are required.
Solution
Pluggable filter is applied in information system.
Reference
http://www.oracle.com/technetwork/java/interceptingfilter-142169.html
WildFly – Standard J2EE
- Java API for RESTful Web Services (JAX-RS)
- Java Servlet Technology
- Java Server Faces Technology (JSF)
- Java Persistence API (JPA)
- Java Transaction API (JTA)
- Managed Beans
- Contexts and Dependency Injection (CDI)
- Bean Validation
- Java Message Service API (JMS)
- JavaEE Connector Architecture (JCA)
- JavaMail API
- Java Authorization Contract for Containers (JACC)
- Java Authentication Service Provider Interface for Containers (JASPIC)
- Enterprise JavaBeans Technology (EJB)
- Java API for XML Web Services (JAX-WS)
web.xml Template
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Spring MVC Application</display-name> <servlet> <servlet-name>HelloWeb</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>HelloWeb</servlet-name> <url-pattern>*.jsp</url-pattern> </servlet-mapping> </web-app>
J2EE: Web Service
Web Service is services provided by electronic device in the World Wide Web. In J2EE, it provides two types of web services.
Example:
Web Service Example with JBoss
IDE: Eclipse
Application Server: JBoss 7.1
Testing Tools: SoapUI 5.2.1
Steps:
- Create a J2EE Web Project: Name: HelloWorld
- Create a Java Class named: Hello. The Code is in the below
- Run in Server
Test Steps
- Visit http://localhost:8080/HelloWorld/Hello?wsdl
- Use Soap UI to call web service
Source Code
import javax.jws.WebMethod; import javax.jws.WebService; @WebService public class Hello { @WebMethod public void print(){ System.out.println("Hello"); } }
Websphere Overview
WebSphere Application Server
- Family Editions
- WAS Network Deployment
- WAS
- WAS Liberty Core
Liberty Profile
It is new capacity since 8.5. It is lightweight profile for web, mobile, OSGi applications.
Profiles
Websphere Application Server can obtain various profiles for different purpose. Each profile have unique config for the run-time environment.
Node and Cell
Cell is deployment unit for a profile. A cell can contain one or more nodes for deployment.
- Websphere – Creating profile by Command Untity
- WebSphere – Start Server
- Websphere – Eclipse Integration
- Wasadmin
Reference
- WebSphere Home Page: http://www-03.ibm.com/software/products/en/appserv-was
- IBM Knowleget Center: http://www.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/welcome_nd.html
- WebSphere – Enable / Disable Security and then Change User Password
- Websphere Application Sever (WASdev)
- WAS ND Delete Profile
J2EE API
Relationship among the J2EE Containers.
API Summary
- Enterprise JavaBeans Technology
- Servlet Technology
- Java Server Face Technology
- JavaServer Pages Technology
- JavaServer Pages Standard Tag Library
- Java Persistence API
- Java Transaction API
- Java API for RESTful Web Services
- Managed Beans
- Contexts and Dependency Injection for the Java EE Platform (JSR 299)
- Dependency Injection for Java (JSR 330)
- Bean Validation
- Java Message Service API
- Java EE Connector Architecture
- JavaMail API
- Java Authorization Contract for Containers
- Java Authentication Service Provider Interface for Containers
- Java Database Connectivity API
- Java Naming and Directory Interface API
- JavaBeans Activation Framework
- Java API for XML Processing
- Java Architecture for XML Binding
- SOAP with Attachments API for Java
- Java API for XML Web Services
- Java Authentication and Authorization Service