background preloader


Facebook Twitter

The Death of XSLT in Web Frameworks. Several years ago there was a trend in Java web frameworks to use XML processing as a foundation for the framework logic: take the data from database and present it as XML document (either convert it from relational data, or use XML capable database), and transform it to HTML using XSLT. There were some books written about it, and some frameworks created (like Cocoon).

After some time the hype started to decline, and currently virtually no modern web framework apply this approach, I think. Actually I've never used it on myself, but I liked the idea at that time. It seemed to be clear and powerful. Funny that only now I have a chance to check how it works in practice. And at least now I know why this approach failed. For two weeks, I'm outsourced to help some company in their web project. XSLT bloat I won't dare to say that XSLT is worthless - perhaps in some contexts it can be useful, especially for transforming one document tree into another (valid) document tree, i.e. from DOM to DOM.

A Webapp Makeover with Spring 4 and Spring Boot. A typical Maven and Spring web application has a fair amount of XML and verbosity to it. Add in Jersey and Spring Security and you can have hundreds of lines of XML before you even start to write your Java code. As part of a recent project, I was tasked with upgrading a webapp like this to use Spring 4 and Spring Boot. I also figured I'd try to minimize the XML. This is my story on how I upgraded to Spring 4, Jersey 2, Java 8 and Spring Boot 0.5.0 M6. When I started, the app was using Spring 3.2.5, Spring Security 3.1.4 and Jersey 1.18. Upgrading to Spring 4 Upgrading to Spring 4 was easy, I changed the version property to 4.0.0.RC2 and added the new Spring bill of materials to my pom.xml. Next, I removed all the references to ${spring.framework.version} in dependencies since it'd be controlled by Maven's dependency management feature.

I also changed to use Maven 3's wildcard syntax to exclude multiple dependencies. You might ask "why Jersey? " JAX–WS with Spring and Maven Tutorial. Spring framework provides remoting support for web services via JAX–WS, in fact, as stated in Spring reference documentation, there are three ways of exposing Spring POJO services as a JAX–WS web services : Exposing Servlet – based web services (suitable for Java EE 5 environments)Exporting standalone web services (suitable when utilizing Sun’s JDK 1.6 build–in JAX–WS provider)Exporting web services using the JAX–WS RI’s Spring support (similar to the standalone approach, but this time in a Servlet environment. Suitable for non – Java EE environments such as Tomcat, embedding the JAX–WS RI as part of the web application) Selecting one of the three approaches mentioned above depends mainly on your execution environment. Having said that, we will show you how to setup and expose a simple Spring service using all of the above approaches.

Our preferred development environment is Eclipse, so as a prerequisite you must have Eclipse with Maven support installed. Lets begin, “HelloWorld!” Introduction to Spring's Aspect Oriented Programming(AOP) Java SE 7 and JDK 7 Compatibility. Compatibility is a complex issue. This document discusses three types of potential incompatibilities relating to a release of the Java platform: Source: Source compatibility concerns translating Java source code into class files including whether or not code still compiles at all.

Binary: Binary compatibility is defined in The Java Language Specification as preserving the ability to link without error. Behavioral: Behavioral compatibility includes the semantics of the code that is executed at runtime. For more information, see Kinds of Compatibility, a section in the OpenJDK Developer's Guide. The following compatibility documents track incompatibility between adjacent Java versions. The following documents have information on changes to the Java Language Specification (JLS) and the Java VM Specification (JVMS). Binary Compatibility Java SE 7 is binary-compatible with Java SE 6 except for the incompatibilities listed below.

Source Compatibility Some APIs in the sun.* packages have changed. Feed yourself for free: the 12 'Survival Plants' Part 1. Out of the many hundred edible British foods detailed in the best 'wild plant' guides, just these 12 will provide all you truly need, and more, for a continual fresh food supply. The advantage these 12 have over their 400 edible wild cousins is abundance, resilience, versatility and ease of recognition. Dandelion (Taraxacum officinale) Compared with an equal weight of lettuce, dandelion has three times the vitamin C, four times the protein, carbohydrate, fat, calcium, iron and vitamin B, five times the phosphorous - and an astounding 12 times the vitamin A.

After that shopping list, it's almost surprising to hear it's good to eat as well. Its leaves and roots are available the year round although, like all greens, the young leaves gathered in the spring make the best eating. You can spur its leaf production, by cutting off the flower heads before they unfurl and, in winter, by covering the plant with a flowerpot and sacking, or otherwise protecting from frost. Berries Seeds and nuts Resources. Chapter 6. Aspect Oriented Programming with Spring. Everything we've covered so far in this chapter is pure Spring AOP.

In this section, we're going to look at how you can use the AspectJ compiler/weaver instead of, or in addition to, Spring AOP if your needs go beyond the facilities offered by Spring AOP alone. 6.8.1. Using AspectJ to dependency inject domain objects with Spring The Spring container instantiates and configures beans defined in your application context. It is also possible to ask a bean factory to configure a pre-existing object given the name of a bean definition containing the configuration to be applied.

The @Configurable annotation marks a class as eligible for Spring-driven configuration. Package; import org.springframework.beans.factory.annotation.Configurable; @Configurable public class Account { // ... } If you want to explicitly specify the name of the prototype bean definition to use, you can do so directly in the annotation: Using the annotation on its own does nothing of course. Introduction to Spring AOP. Contents Introduction This is my second article about Spring Aspect Oriented Programming. This article will show the basics and how to use Spring AOP easily, by using some tools such Eclipse, Maven, Spring AOP version 2.5, etc.

Wait! Why Spring AOP and not full AspectJ? “Use the simplest thing that can work. After reading the above, you will know the answer to the question! Let's start on Aspect Oriented Programming! What is Aspect Oriented Programming “Aspect-oriented programming entails breaking down program logic into distinct parts (so-called concerns, cohesive areas of functionality). Distinct parts? AOP is like Triggers in programming languages such as Perl, .NET, Java and others. That's easy, right? Maybe you have learned a bit about SQL and you've heard about Procedures and Triggers: In SQL, you create a Trigger for a table or view.

AOP has similar things: You create something called “Aspect”. Terms & Definitions Pointcut! Pointcut is a predicate that matches Join Points. . /! Finally! Spring: A Quick Journey Through Spring AOP. SLF4J | Java and Spring development. More and more frameworks logs with the SLF4J framework. Many applications must relate to several different logging frameworks. This tutorial shows how one logger framework can handle log messages from other logging frameworks with SLF4J as the central part. The demo application used in this tutorial logs with Log4J and have dependencies to Spring and Hibernate. Here’s the different loggers and where they are used: JCL SpringSLF4J Hibernate 3.3+Log4J Demo application Log4J integrates well with JCL, but can’t handle log messages from SLF4J. A description of SLF4J from their homepage: The Simple Logging Facade for Java or (SLF4J) serves as a simple facade or abstraction for various logging frameworks, e.g. java.util.logging, log4j and logback, allowing the end user to plug in the desired logging framework at deployment time.

In addition to the extra flexibility, the API also contains a nice feature with support for arguments. The old way with Log4J: Both examples prints: Logback A simple example: Log4j Bridge. Bridging legacy APIs Often, some of the components you depend on rely on a logging API other than SLF4J. You may also assume that these components will not switch to SLF4J in the immediate future. To deal with such circumstances, SLF4J ships with several bridging modules which redirect calls made to log4j, JCL and java.util.logging APIs to behave as if they were made to the SLF4J API instead. The figure below illustrates the idea. Please note that for source code under your control, you really should use the slf4j-migrator. The binary-based solutions described in this page are appropriate for software beyond your control.

Gradual migration to SLF4J from Jakarta Commons Logging (JCL) jcl-over-slf4j.jar To ease migration to SLF4J from JCL, SLF4J distributions include the jar file jcl-over-slf4j.jar. Our JCL over SLF4J implementation will allow you to migrate to SLF4J gradually, especially if some of the libraries your software depends on continue to use JCL for the foreseeable future. TcServer Logging with Logback & SLF4J. We Recommend These Resources Logback and SLF4J provide better logging for java applications. To configure VMware vFabric tcServer to take advantage of the speed and flexibility of Logback use the following steps as a starting point. Download the tcServer Developer Edition free: This comes with Spring Insight: an awesome tool for inspecting application performance, see those expensive sql queries, etc. 1. Add JMX options File: <appname>/bin/ 1.CATALINA_OPTS="" 2.CATALINA_OPTS="$CATALINA_OPTS" 3.CATALINA_OPTS="$CATALINA_OPTS" 2.

File: <appname>/conf/server.xml # In the <service> section: 1. 2. handler.list="mx" 3. mx.enabled="true" 4. mx.httpHost="localhost" 5. mx.httpPort="8082" 6. protocol="AJP/1.3" /> 3. 1.JAVA_OPTS="$JAVA_OPTS -Dlogback.ContextSelector=JNDI" 4. #In the <Hosts> Section: 1. 5. [#GLASSFISH-11446] JAX-WS annotation processing aborts when class fails to load - JIRA.

[#HHH-2225] NPE when eager fetching joined component with native SQL query - Hibernate JIRA. JPA 2.0/glassfish. From Eclipsepedia You can run JPA 2.0 including everything in the JPA 2.0 XSD for persistence.xml in Glassfish V3 You can run JPA 2.0 - but you are limited to the JPA 1.0 XSD for persistence.xml in Glassfish V2.1 Test Conditions - verify JPA 2.0 interface call with implementation shipped in EclipseLink 1.2 = entityManager.getMetamodel() - verify JPA 2.0 interface call with implementation only in EclipseLink 2.0 = entityManager.getCriteriaBuilder() - verify use of JPA 2.0 XSD and properties like <shared-cache-mode>NONE</shared-cache-mode> in persistence.xml Glassfish V3 EclipseLink 1.2 and 2.0+ fully implement the JPA 2.0 specification via enhancement # 248291 and are the RI for the GlassFish V3 JEE6 server. Glassfish V2 Glassfish V2.1.1 ships with JPA 1.0 support - in order to use JPA 2.0 on this older server some overrides will be required.

V2.1 Results Matrix The following table summarizes the type of test, Glassfish V2.1 server modifications and results Problem Analysis Use Cases Design. HOW-TO: Method-level validation in Spring 3.1 with @Validated annotation. Spring MVC 3.1 Bean Validation support has been extended with @Validated annotation. The annotation is a Spring's specific variant of JSR-303's javax.validation.Valid, supporting the specification of validation groups. @Validated may be used either with Spring's @Controller method arguments or with with method-level validation. In order to indicate that a specific class is supposed to be validated at the method level it needs to be annotated with @Validated annotation at type level: Methods applicable for validation must have JSR-303 constraint annotations on their parameters and/or on their return value: Beans annotated with @Validated annotation will be detected by MethodValidationPostProcessor and validation functionality is delegetated to Hibernate's MethodValidator that requires Hibernate Validator 4.2 or higher.

When the validation fails MethodConstraintViolationException, with a set of contraint violations, is thrown. Resources. Chapter 3. Writing Contract-First Web Services. Chapter 3. Writing Contract-First Web Services This tutorial shows you how to write contract-first Web services, that is, developing web services that start with the XML Schema/WSDL contract first followed by the Java code second. Spring-WS focuses on this development style, and this tutorial will help you get started. Note that the first part of this tutorial contains almost no Spring-WS specific information: it is mostly about XML, XSD, and WSDL. The second part focuses on implementing this contract using Spring-WS .

The most important thing when doing contract-first Web service development is to try and think in terms of XML. In this tutorial, we will define a Web service that is created by a Human Resources department. In this section, we will focus on the actual XML messages that are sent to and from the Web service. In the scenario, we have to deal with holiday requests, so it makes sense to determine what a holiday looks like in XML: We have used the same namespace as before. 3.5. Spring by Example. Hibernate/JPA Identity Generators. Introduction As usually it has been a long time since I have last posted in my blog, and even longer (about half a year) since the last time I wrote about Hibernate but finally I have fond the tome for that.

This post is about Hibernate standard compatible (TABLE, SEQUENCE, IDENTITY, and AUTO) identity generators: it explains what the identity generators are and illustrated the different considerations need to be taken when choosing identity generation strategy. Environment Hibernate - 3.5.6-FinalPostgreSQL - 8.4 What are Surrogate Keys and Identity Generators?

Each persistent entity must have a primary key by which it can be identified in the database. A common pattern, called surrogate keys, is to make a these surrogate keys totally independent from the application data – usually by automatically generate their values. <A HREF=" The @GeneratedValue and @GenericGenerators Annotations The HiLo Algorithm Hibernate has several HiLo based generators: Hibernate JPA Setup and configuration. When Persistence.createEntityManagerFactory() is called, the persistence implementation will search your classpath for any META-INF/persistence.xml files using the ClassLoader.getResource("META-INF/persistence.xml") method. Actually the Persistence class will look at all the Persistence Providers available in the classpath and ask each of them if they are responsible for the creation of the entity manager factory manager1.

Each provider, from this list of resources, it will try to find an entity manager that matches the name you specify in the command line with what is specified in the persistence.xml file (of course the provider element must match the current persistent provider). If no persistence.xml with the correct name are found or if the expected persistence provider is not found, a PersistenceException is raised. Note that you can mix XML <class> declaration and hibernate.ejb.cfgfile usage in the same configuration. Here is a typical configuration in a Java SE environment. Batoo JPA. JPA patterns: Saving (detached) entities. Merge versus SaveOrUpdate: Understanding the NonUniqueObjectException in Hibernate | Moving the Curve.

Ippclient. Cups4J - Java printing library for CUPS/IPP. Internet Printing Protocol (IPP) Registrations. Download Center | ServiceWorld | KYOCERA Document Solutions - laserprinter, printer, copier, multifunctionals. iReport Guide: preventing blank pages. Bug 203124 – copylibs doesn't support the "rebase" attribute. A Perch in the Spanish Pyrenees. Aging of Eyes Is Blamed in Circadian Rhythm Disturbances. The Audition. Java - MyBatis mapper injected directly into service class. What about exceptions. Be Recursive. Easy and beautiful documentation with Sphinx. Email upload Picasa Web Albums. Dojo HTML5 Data-Attribute Support. Load external JavaScript libraries on demand with Dojo 1.5. Alex014/bootstrap.validate. Edit this Fiddle. TwitterBootstrapjQueryValidate/Content/Scripts/jquery.validate.bootstrap.js at master · theonlylawislove/TwitterBootstrapjQueryValidate. Html - Bootstrap typeahead ajax result format - Example. Theonlylawislove/TwitterBootstrapjQueryValidate.

TUBE+ Watch full length TV Shows and Movies online for free. iStopOver. Airbnb. Handlers_introduction.html — — — Extend your Web Service applications with the new efficient Handlers in JAX-WS RI. Adding JAX-WS handlers to web services and SOAP clients. MediaWiki. Manual:Preventing access. LDAP Authentication. Integrating MediaWiki with LDAP. Enable LDAP Windows Active Directory Authentication with MediaWiki | Debian Ubuntu Linux Solutions Blog. Help:Installing HaloACL 1.5. Trail: Learning the Java Language (The Java™ Tutorials) Core J2EE Patterns - Data Access Object. HttpComponents Connection management. PKIX path building failed: SunCertPathBuilderException: unable to find valid certification path to requested target. |

Microdata. Simple Email Service (Amazon SES) How to Locate Your Unprotected Android Device. Scalable Vector Graphics in HTML5. Out of memory reading images. Jasper Report- JRException: Image read failed (Open Source Projects forum at JavaRanch) TOra [About] JDBC Drivers release - Production README. Index Tuning Wizard for Microsoft SQL Server 7.0.

Request Processing (Sun GlassFish Enterprise Server 2.1 Performance Tuning Guide) Configure Log4J for use in GlassFish 3.1 (Naman Mehta) GlassFish Tuning - HTTP Thread Pool. Tuning. Build Your Own SaaS using Docker. Docker - the Linux container runtime. HotSpot GC Thread CPU footprint on Linux. Linux Increase The Maximum Number Of Open Files / File Descriptors (FD) Vmstat. GlassFish Tuning - HTTP Connection Queue & Keep Alive. Understanding Caching in Hibernate – Part Three : The Second Level Cache about. Eliminating Web Development Waste - Nefarious Designs. Prevent DOS with iptables. (D)DoS Deflate - Mod_evasive | Jonathan Zdziarski's Domain. Limiting brute-force attacks with IPTables. OAuth for Spring Security - Tutorial.

HDIV (HTTP Data Integrity Validator) Linux System Administration: iptables hashlimit. True Crime Finance Stories.