J2EE explore the state of the J2EE technology network
Abstract: J2EE explore the state of the J2EE technology network
A state application management
You may recall, in the article, Web applications agreement was divided into two categories: state (stateless) and the state (stateful), the agreement states that it is "Memory" from a transmission to the next a transmission of information. Because of the state of connectivity in enterprise applications is the most basic needs of one, and because Web applications rely on HTTP (the internal state without agreement), the smart developers have already found a lot of skills to the simulation in a state of HTTP connections . A status information can be stored in the HTML form fields, in addition to hyperlinks or stored in the client side of the cookie.
Between the client and the server can be in a state of interactive Web-layer or business management. Web layer in the state management, we use the combination of servlet HTTPSession API. In the business of managing state, we use a state session EJB components. In the next chapter, we will explore the development of these two options.
Web -
Servlet Architecture HTTPSession API allows application development management across the network client / server interaction (or spoken) state. HTTPSession HTTPSession API interface defines the core functionality. It J2EE application provides a method, it can be identified across multiple pages of individual client requests, as well as the data stored in the client and that the associated server. Through the interface, servlet containers creation and management between the client and server's session. HTTPSession object from the conversation that it can be cross-from the same client and the number of pages linking persistent request a specific time. Servlet use of the interface to view and deal with the conversation of information, such as time and on the creation of a visit conversation time. The interface also allows servlet session will be bound to the object, thereby connecting to a cross-over (from the same client) the persistence of the way information and specific client connections.
Servlet Architecture
Servlet architecture and not because of the use of HTTPSession API and change. As in the absence of the state network, servlet implementation of the business on behalf of the client request and act as controller, view, or both at the same time. Servlet can also effectively handle user interaction, such as the format and content of that request processing and basic security requests, and more. As in the absence of the state network, servlet best for the management of client interaction, it is usually to use assistant category (such as JavaBeans) to cope with the treatment or operation and mutual back-end components (interface).
Therefore, the servlet containers HTTPSession interface allows the creation and management of customer opportunities, and to make conversation with the servlet can visit the relevant information will be targeted to bind the previous session and a visit to bind target. Up to now, has been good. But how servlet container tracking through the state without the agreement (such as HTTP) communications client? To achieve this, each HTTPSession object to provide a unique identification to ensure that each customer with the opportunity and if the session relevant information can be unique identifier. HTTP take into account the inherent nature of a state in each request, the session logo must be transmitted to the client server, servlet containers will be to facilitate the client and correct associated conversation. Conversation logo can be used in three ways for a transfer: As HTML form parameters (usually hidden field); as additional query string parameters after, or as a cookie attributes. No matter how the conversation logo transmission servlet containers will intercept it, check it, and find it linked HTTPSession object.
Servlet performance Servlet architecture created by the lightweight threading model will not be servlet or JSP document creation, to read or modify HTTPSession object has been destroyed. The object is to save it as a simple object reference bond - on the value of the hash table or similar set. Similarly, the realization of HTTPSession memory space itself is lightweight, only need to store (perhaps serialization) Conversation object identification and the corresponding session. In short, and can support HTTP servlet client interaction with the state, and the use of program design or containers with a minimum of resources.
A state application management
You may recall, in the article, Web applications agreement was divided into two categories: state (stateless) and the state (stateful), the agreement states that it is "Memory" from a transmission to the next a transmission of information. Because of the state of connectivity in enterprise applications is the most basic needs of one, and because Web applications rely on HTTP (the internal state without agreement), the smart developers have already found a lot of skills to the simulation in a state of HTTP connections . A status information can be stored in the HTML form fields, in addition to hyperlinks or stored in the client side of the cookie.
Between the client and the server can be in a state of interactive Web-layer or business management. Web layer in the state management, we use the combination of servlet HTTPSession API. In the business of managing state, we use a state session EJB components. In the next chapter, we will explore the development of these two options.
Web -
Servlet Architecture HTTPSession API allows application development management across the network client / server interaction (or spoken) state. HTTPSession HTTPSession API interface defines the core functionality. It J2EE application provides a method, it can be identified across multiple pages of individual client requests, as well as the data stored in the client and that the associated server. Through the interface, servlet containers creation and management between the client and server's session. HTTPSession object from the conversation that it can be cross-from the same client and the number of pages linking persistent request a specific time. Servlet use of the interface to view and deal with the conversation of information, such as time and on the creation of a visit conversation time. The interface also allows servlet session will be bound to the object, thereby connecting to a cross-over (from the same client) the persistence of the way information and specific client connections.
Servlet Architecture
Servlet architecture and not because of the use of HTTPSession API and change. As in the absence of the state network, servlet implementation of the business on behalf of the client request and act as controller, view, or both at the same time. Servlet can also effectively handle user interaction, such as the format and content of that request processing and basic security requests, and more. As in the absence of the state network, servlet best for the management of client interaction, it is usually to use assistant category (such as JavaBeans) to cope with the treatment or operation and mutual back-end components (interface).
Therefore, the servlet containers HTTPSession interface allows the creation and management of customer opportunities, and to make conversation with the servlet can visit the relevant information will be targeted to bind the previous session and a visit to bind target. Up to now, has been good. But how servlet container tracking through the state without the agreement (such as HTTP) communications client? To achieve this, each HTTPSession object to provide a unique identification to ensure that each customer with the opportunity and if the session relevant information can be unique identifier. HTTP take into account the inherent nature of a state in each request, the session logo must be transmitted to the client server, servlet containers will be to facilitate the client and correct associated conversation. Conversation logo can be used in three ways for a transfer: As HTML form parameters (usually hidden field); as additional query string parameters after, or as a cookie attributes. No matter how the conversation logo transmission servlet containers will intercept it, check it, and find it linked HTTPSession object.
Servlet performance Servlet architecture created by the lightweight threading model will not be servlet or JSP document creation, to read or modify HTTPSession object has been destroyed. The object is to save it as a simple object reference bond - on the value of the hash table or similar set. Similarly, the realization of HTTPSession memory space itself is lightweight, only need to store (perhaps serialization) Conversation object identification and the corresponding session. In short, and can support HTTP servlet client interaction with the state, and the use of program design or containers with a minimum of resources.
Choosing the right technology and the non-state J2EE architecture different J2EE application procedures do not provide the typical configuration to act as guides or blueprint. State management, appropriate architecture depend on the following factors:
Client is based on the Web (HTTP)?
State the need to include dialogue in the GUI?
Which will be in a server load conditions?
A state in the server components need to be able to continue to be effective after the collapse?
Affairs of the component which needs context?
How important is a state data?
Although some of these issues seems to be obviously one of the preferred technology, but many state programme actually need to use both servlet also need to use EJB components. The decision is crucial in determining the Web layer or in the management of state business, or at the same time in the two state management layer. In the next section, we will examine some possible enterprise applications programmes, and the most appropriate solution.
Application of the standard procedures client application with another client systems or components interoperable client. We will examine three typical client application programmes, and discuss each client with the most suitable state solution:
If the client is based on Java, and in the same server and firewall, then you should first decide whether the state interactive model is essential. Management of state session bean is resource-intensive, so you should consider a more lightweight alternative to. The best solution is to use RMI directly with the application server in the non-state dialogue session bean. If state solution is necessary, please consider using a simple affairs of the state without conversation bean, or in the business of the servlet to create thin layers. Spend any of the solutions can provide some of the costs of state experience. Finally, if your client must request and across multiple business processes of the state of tight coupling, and can not accept add Web layer, then a state of the session bean is obvious choice.
If you are using non-Java client and the server or use a firewall is not the same after the client, then the state management issues slightly different. In this package, you should first set the goal of state management. If the goal is through a GUI provides the user experience smoother, so that you can manage state Web layer. If the goal is to the complex across multiple requests linked to the business process, then the state management should be carried out in the business layer. Stress once again that you should always explore other options, such as the use of a non-state affairs session bean.
Some applications in a server vendors such as IIOP accept the call of the open EJB containers, thereby allowing the CORBA client will EJB component of the cost of CORBA applications. This allows the use of non-Java client agreements and IIOP stateless session bean communication. In this setting, bypassing the Web client layer, and use IIOP agreement directly with the business layer (session bean) communications. Then, in the architecture of firewalls and the Java-based application analysis is the same. Please refer to the first option, in order to understand the business of state management.
E-business on demand environment, as we discussed last month, non-state session bean demand for e-commerce (e-business on demand) applications carefully designed. They are very lightweight, it's easy to convergence for the pool, to ensure that the excellent scalability. Instead, the session bean is not a state for such applications and carefully designed. E-business on demand applications usually need to state management, but the best by a dedicated mechanism or through J2EE Service for processing. Another possibility is called EJB components, as if it is like CORBA components. When one or more integrated applications is CORBA components, the option particularly useful.
"Rich" GUI client has three basic "rich" GUI (HTML is not, nor is it the command line) client types: Java applet, independent applications and Java Web Start. The following solutions are applicable to this "rich" GUI components in any type:
If your client and server firewall was separated, you should be allowed to clients via HTTP servlet and direct communications. The servlet layer can be used to type simple assistant business processing. If your applications are more complex needs, or for enterprise resource at the request of a higher frequency, you should use the session bean to handle business processes. Here to emphasize once again, you should be a model state of the need for interaction as part of the decision-making process be considered.
If your client and server in the same firewall, direct RMI call may be your best choice. In such circumstances, servlet will bring additional costs and unnecessary complexity of the architecture. In applet or Java Web Start cases, through the provision of a applet or Java Web Start application links the first HTML document, servlet can activate affairs. Then, the best the client with one or more bean session of the RMI to establish direct connections. The programme set up with a typical application client programme (with the server with a firewall is not after) the same settings.
If you are using this machine GUI clients, and the need to manage complex business or affairs series, then you should consider once again calling EJB component, as it is like CORBA components. If can not do that, you can always let the client via HTTP servlet and communications, management and the corresponding session.
Web applications in a standard, Web-based application cases, the client side of the firewall which is not important; use servlet is essential. Because you will use HTTP as a transport protocol, it will be working on the Web layer. The only practical decision whether or not to use EJB component behind the scenes? EJB containers will depend on the relevant service demand. First of all, you will choose a common component type (such as servlet and session bean). Next, you choose some matching the application's user interface display and processing needs of the business request more specific types (such as JSP pages and state session bean). On the concerns of state management, Web applications in the client and other similar types of issues. Some standards (and answers) will help you for your Web application procedures for determining the appropriate state management solution:
Need to have direct experience with the state of the user interface with? If so, must use servlet HTTPSession API management and the state.
Your business processes from the client needs across a number of calls? If so, you have three options:
Use of state session bean to provide state business processes.
The use of non-state session bean, and that the persistent data in the cache server. Then the application of the cache can be stored in the client's HTTPSession object.
By calling the bean JavaBean method appointed as business (see reference), making bean batch from all client data, and only in the client business process to be submitted to the state when no contact session EJB components. Again used the HTTPSession API to persistent JavaBean examples.
You have the state of business process needs fault protection? If so, you have three options:
Use of the application server, the server for the state of the state resumed session bean provides automatic support.
SessionSycnhronization interface allows stateless session bean or state failure to respond to the Panel. This will allow you to roll back services, the implementation of persistent data or you may need to remove any other function. Usually, the server failure will not impede the transfer containers statement from the callback interface methods.
Many Web servers to provide fault protection HTTPSession achieve. If your server can do this, then you can use JavaBean as a business appointment.
Multi-client type
Finally the situation requires a combination of types of clients, such as Web-based browser and standard "rich" GUI desktop. In such circumstances, a state with no state Options Options no difference. Please refer to the first of this series of articles for more information.
Concluding remarks in this part (J2EE Pathfinder series of the second part), we explore the use of Java servlet session bean and the state to implement client request and provide the state of the relative merits of experience. This paper discusses the programme did not include all cases, but they represent a state of the communications environment in the servlet session EJB components and some of the most common usage.
In the next part, we will begin on persistent data management of the two parts, first of all entities will be relatively bean and JDBC. Wish us to "explore" happy!
↑ Back






