Wire Hibernate Transactions in Spring
This article is intended to show how Spring can be used to assemble components, including their transaction contexts. Connecting to a single data store from within a J2EE application is not a big hurdle. But when it comes to assembly and integration of enterprise-class components, the scenario gets complicated. A single component would be backed up by a single data store or a number of data stores. So, when we speak of assembling two or more components, we are expected to maintain the atomicity
Parsing an XML Document with XPath
The getter methods in the org.w3c.dom package API are commonly used to parse an XML document. But J2SE 5.0 also provides the javax.xml.xpath package to parse an XML document with the XML Path Language (XPath) . The JDOM org.jdom.xpath.XPath class also has methods to select XML document node(s) with an XPath expression, which consists of a location path of an XML document node or a list of nodes. Parsing an XML document with an XPath expression is more efficient than the getter methods, because w
Java object queries using JXPath
In a recent project, I needed an easy way to traverse Java object trees and extract values from the objects. Instead of continually going through huge iterator-if-else setups, I wanted a tool that would allow me to simply say, "I want the object with id=X, and from that object, I need the value of property A." In essence, I needed an object-querying tool. [@more@]JXPath is such an object-query tool. It is an Apache Commons component that enables you to query complex object trees using
Should you go with JMS?
Distributed system development is growing rapidly as software developers build systems that must keep up with the ever-increasing requirements imposed by e-business. But, never before has the design and implementation of a message-processing layer within a distributed system been as complex as it is today. This is mostly due to the dramatic increase in potential functionality enabled by standards like Java Message Service (JMS) that connect many vendors' technologies in a single system. In addit
From Java EE security to Acegi
Protecting sensitive data and data transportation is a preliminary but critical requirement for application developers. The Internet is a public and insecure infrastructure connecting millions of computers world-wide for data interchange. Any device connected to the Internet faces various types of security threats, such as eavesdropping, masquerading, message tampering, replaying, infiltration, traffic analysis, or denial-of-service. Web applications generally deal with sensitive and valuable da
REST easy with the JavaBeans Activation Framework
Find out what makes the JavaBeans Activation Framework a perfect vehicle for RESTful data transmission, then put JAF to work in a sample Web application that tracks requests and responses through a Java Servlet-based system[@more@]Representational State Transfer, also known as REST, is a style of software architecture defined by a collection of architectural principles. REST is applied specifically to such distributed systems as the Web, and stipulates mechanisms for defining and accessing resou
Scripting on the Java platform
It has recently become popular to differentiate between the Java platform and the Java language, but many Java developers still are unsure of how to incorporate scripting into Java application development. In this article, Gregor Roth introduces you to scripting on the Java platform. Learn when and how to use scripts in your Java applications, whether you are gluing together various Java application modules with Groovy or Jython, or writing your first JRuby-based application for the Java platfor
JBoss, Geronimo, or Tomcat?
Open source Java EE application servers like JBoss, Tomcat, and Apache Geronimo easily stand up to their commercial counterparts, and actually lead the market in innovation. All open source Java EE application servers are not created equal, however. In this article, Jonathan Campbell compares JBoss 4.2, Geronimo 2, and Tomcat 6 based on features, deployment, and performance. [@more@]Java Enterprise Edition (Java EE) application servers are the Web-enabled standard when it comes to application de
The AjaxComponent strategy for JSF: The best of both worlds
Adding Ajax capability to JSF applications is easy to talk about but not so simple to do. Developing a custom lifecycle phase is too complex for most needs; putting the handler code in the component's decode() method doesn't give you enough control; and using a phase listener by itself breaks encapsulation. In this article, Matt Tyson demonstrates the AjaxComponent strategy -- an effective and practical way of integrating Ajax into your JSF applications, and easily extensible to boot. [@more@]If
JAVA泛型浅析
本文主要列举了在使用Java泛型时应该注意的问题。Java泛型是Java5的一个重要特性,它和自动装箱、变长参数等新特性一起,提升了Java代码的健壮性和易用性,但SUN本身过分强调向前的兼容性,也引入了不少问题和麻烦。[@more@]JAVA泛型和C++泛型的区别: Java的泛型被定义成擦除,而C++的泛型则是扩展; 对于C++模板,当参数类型为不同的类型时,生成的模板实例也是不同的类型,如:定义类模板 Template <typename T> class A : public B<T>; 当实例化模板时 A<int> a;
Modularizing and Code Reuse Using AOP
Aspect-Oriented Programming (AOP) is a new exciting paradigm. It is not a competitor to the famous Object-Oriented Programming (OOP), they actually complement each other. It can be considered an extension to OOP. AOP modularizes software applications based on loosely coupled aspects, whereas OOP does it by using Encapsulation, Inheritance, and Polymorphism.AOP is a concept and not bound to any programming language. Software vendors can provide implementation for AOP in any programming language a
OpenSSL Command-Line HOWTO
The openssl command-line binary that ships with the OPENSSL libraries can perform a wide range of cryptographic operations. It can come in handy in scripts or for accomplishing one-time command-line tasks.Documentation for using the openssl application is somewhat scattered, however, so this article aims to provide some practical examples of its use. I assume that you’ve already got a functional OpenSSL installation and that the openssl binary is in your shell’s PATH.Just to be clear, this ar