Resources. Commons JXPath - JXPath User's Guide. What's JXPath JXPath provides APIs for traversal of graphs of JavaBeans, DOM and other types of objects using the XPath syntax. If you are not familiar with the XPath syntax, start with XPath Tutorial by W3Schools. Also see XML Path Language (XPath) Version 1.0 - that's the official standard. XPath is the official expression language of XSLT. In XSLT, you mostly use XPath to access various elements of XML documents. You can also have JXPath create new objects if needed. The central class in the JXPath architecture is JXPathContext. Object Graph Traversal JXPath uses JavaBeans introspection to enumerate and access JavaBeans properties.
The interpretation of the XPath syntax in the context of Java object graphs is quite intuitive: the "child" axis of XPath is mapped to JavaBean properties. JavaBean Property Access JXPath can be used to access properties of a JavaBean. public class Employee { public String getFirstName(){ ... }} Employee emp = new Employee();... Lenient Mode Collection Subscripts <? Mirror - Because Java Reflection must be easy. | Mirror. Mirror was created to bring light to a simple problem, usually named ReflectionUtil, which is on almost all projects that rely on reflection to do advanced tasks.Dealing with Java Reflection API is painful. Ask anyone you know that uses reflection and he will tell you it's really unpleasant getting yourself around it.Take a look at the following code: //Let's just set a field value.
Should be a simple task, right? //"target" is the object containing the field whose value you want to set. Field toSet = null;for (Field f : target.getClass().getDeclaredFields()) { //Get all fields DECLARED inside the target object class if (f.getName().equals("field")) { toSet = f; } }if (toSet !
= null && (toSet.getModifiers() & Modifier.STATIC) == 0) { toSet.setAccessible(true); toSet.set(target, value);} Ah! ReflectionUtil.setField(target, fielName, value); Better, but completely procedural. Dear program, On a target object, set fieldName with value. Beautiful, isn't? RESTEasy. RESTEasy RESTEasy is a JBoss project that provides various frameworks to help you build RESTful Web Services and RESTful Java applications. It is a fully certified and portable implementation of the JAX-RS specification.
JAX-RS is a new JCP specification that provides a Java API for RESTful Web Services over the HTTP protocol. RESTEasy can run in any Servlet container, but tighter integration with the JBoss Application Server is also available to make the user experience nicer in that environment. Features Fully certified JAX-RS implementation Portable to any app-server/Tomcat that runs on JDK 6 or higher Embeddedable server implementation for junit testing Client framework that leverages JAX-RS annotations so that you can write HTTP clients easily (JAX-RS only defines server bindings) Client "Browser" cache. News. RESTful web services with RestEasy and MongoDB. A few tutorials ago,in the tutorial about RestEasy and Hibernate, we saw how we could integrate RESTEasy with Hibernate.Now in this tutorial we will see how can we create Restful web services with RestEasy and MongoDB.
As an example we will see how to expose the documents of collection named Categories.The service class will be: Since our service class is ready we now need to create the Application class: package com.javaonly.service; import java.util.HashSet; import java.util.Set; import javax.ws.rs.core.Application; public class CategoryApplication extends Application { private Set<Class<? >> classes=new HashSet<Class<? >>(); private Set<Object> singletons = new HashSet<Object>(); public TutorialApplication() { singletons.add(new CategoryService()); } public Set<Object> getSingletons() { return singletons; } } Finally, in order to configure RESTEasy we must add the following snippet in the web.xml: Now every DAO class will extend AbstractDAO class.So in the case of categoryDAO we will have:
Joox - A fluent XML builder library to construct DOM documents and elements. This project has moved to GitHub Please obtain the sources from there! jOOX stands for Java Object Oriented XML. It is a simple wrapper for the org.w3c.dom package, to allow for fluent XML document creation and manipulation where DOM is required but too verbose. jOOX only wraps the underlying document and can be used to enhance DOM, not as an alternative. jOOX's fluency is inspired by jRTF, a very nice fluent API for the creation of RTF documents in Java. jOOX's API itself is inspired by jQuery, an excellent JavaScript library for efficient DOM manipulation of HTML and XML. jOOX's name is inspired by jOOQ, a fluent API for SQL building and execution. Scope jOOX is currently in beta-mode. Help in completing this endeavour is very welcome! Dependencies None! Simple example // Find the order at index 4 and add an element "paid"$(document).find("orders").children().eq(4).append("<paid>true</paid>"); XML document Java code accessing that document import static org.joox.JOOX.
Jerry. Jerry is a jQuery in Java. Jerry is a fast and concise Java Library that simplifies HTML document parsing, traversing and manipulating. Jerry is designed to change the way that you parse HTML content. Jerry belongs to module and has no dependencies other then Jodd's. What does Jerry code look like? Import static jodd.jerry.Jerry.jerry; ... Jerry doc = jerry(html); doc. $("div#jodd p.neat").css("color", "red").addClass("ohmy"); How Jerry works?
We tried to keep Jerry API identical to jQuery as much as possible; in some cases you can simply copy some jQuery code and paste it in Java! Creating document In Java we do not have the document context as in browsers and javascript, so we need to create one first. Jerry.jerry(html) contains a set with just one node - root Document node of parsed HTML content. What happens in the background is that Lagarto parser (default implementation: LagartoDOMBuilder) is invoked to build a DOM tree. It is possible to set different implementation of DOM builder.
Doc. Jsoup Java HTML Parser, with best of DOM, CSS, and jquery. Gwtquery - A jQuery clone for GWT, and much more. Introduction GwtQuery a.k.a. GQuery is a jQuery-like API written in GWT, which allows GWT to be used in progressive enhancement scenarios where perhaps GWT widgets are too heavyweight. It can also be used to complement your normal GWT development giving you powerful tools which are not present in GWT-core: find and enhance your GWT widgets, promote dom elements to widgets, decouple UI parts, useful methods to access js functions and properties without writing jsni, Promises and much more.
GwtQuery is easy to learn for those using jQuery as they share the same api, aditionally gquery adds nice features like type-safe css, compile time optimisations, etc. Currently, almost the jQuery API is written and all CSS3 selectors should be supported. GwtQuery in action Enhance existing html by adding some nice effects using a syntax almost identical to jQuery: import static com.google.gwt.query.client.GQuery.
Watch this code in action in this page Documentation Plugins Contributions welcomed! Gwtquery-plugins - Repository for GwtQuery plugins. GwtQuery is a jQuery-like API written in GWT, which allows GWT to be used in progressive enhancement scenarios where perhaps GWT widgets are too heavyweight. Gwtquery-plugins is thought to be a repository for people who want contribute with plugins for GQuery. If you have a plugin and you want to share it, feel free to ask for commit access sending an email to the gwtquery mailing list . Read this wiki page to learn about how to create and release a plugin. If you need a plugin or think it should be great to have it in gquery, open an issue and label it as !
Type-NewPlugin. Then you can vote for it clicking on the star. Hosted plugin list External plugin list.
Security/Authentication | Java - Libraries. Apache Commons | Java - Libraries. Google Guava | Java - Libraries. Date4J | Java - Libraries. Joor - A fluent reflection API for Java.