September 15th, 2013 by Lincoln Baxter III

Rewrite 2.0.7.Final Released – Bug fixes and enhancements

We are glad to announce the latest version of [[Rewrite]], servlet toolkit and URL-rewriting extensions. This release includes serveral bug fixes and enhancements:

Simplified Configuration

We heard you! It is now much easier to register ConfigurationProvider objects. You can forget about creating a service file, and simply use the convenient @RewriteConfiguration annotation:

import org.ocpsoft.logging.Logger.Level;
import org.ocpsoft.rewrite.annotation.RewriteConfiguration;
import org.ocpsoft.rewrite.config.Configuration;
import org.ocpsoft.rewrite.config.ConfigurationBuilder;
import org.ocpsoft.rewrite.config.Log;
import org.ocpsoft.rewrite.servlet.config.HttpConfigurationProvider;

@RewriteConfiguration
public class ApplicationConfigurationProvider extends HttpConfigurationProvider
{
   @Override
   public Configuration getConfiguration(ServletContext context)
   {
      return ConfigurationBuilder.begin()
         .addRule()
         .perform(Log.message(Log.message(Level.INFO, "Rewrite is active.")))
      ;
   }

   @Override
   public int priority()
   {
      return 0;
   }
}

Issues resolved

Upgrade to 2.0.7.Final

Read the installation guide, or configuration manual.

<dependency>
   <groupId>org.ocpsoft.rewrite</groupId>
   <artifactId>rewrite-servlet</artifactId>
   <version>2.0.7.Final</version>
</dependency>
September 11th, 2013 by Lincoln Baxter III

OpenShift Pro-tip – scaling: tail server logs on all gears of your app at once

UPDATE: I’ve filed an issue for this feature request. Until it is completed, you will need to use the command below.

So i’ve recently started working on making http://redoculous.io function better in a cluster, to support scaling out for large-scale use, and I’ve been working with http://openshift.com/ as my PaaS hosting provider. I started to run into some problems where I wasn’t sure if the cluster was responding how I wanted to.

Being a good developer, my application has logging, so I know that if I can just watch the logs as they occur (or sift through them after the fact), I can probably figure out what is wrong, and fix it.

Unfortunately, running rhc tail will tail the gear running HA-proxy, but not the gears running the actual application, or any of the duplicate gears if HA-proxy is sharing a gear with an app! You’ll just get HA-proxy logs or maybe one of your application gears if you are lucky. What to do? I ran crying for help to the #openshift channel on IRC, where the openshift gurus quickly set me straight. This is all you need to do (for the ‘jbosseap’ cartridge, at least):

rhc ssh <app> --gears 'tail -f jbosseap/logs/*';

The rhc ssh command will execute a command on each of your gears simultaneously, and stream the output to your termainal, which is just an absolute perfect match for tail -f. Note, though, that you’ll need to pass in your application name, and the path to your logs on each gear (which should be fairly easy to find out if you ssh in and take a look around. The log location is even documented for your cartridge on the openshift site: ) I retrieved it using the same rhc ssh command:

sharktop:gems lb3$ rhc ssh redoculous --gears 'echo $OPENSHIFT_JBOSSEAP_LOG_DIR';
[gear1name jbosseap-6+haproxy-1.4] /var/lib/openshift/gear1name/jbosseap/logs/
[gear2name jbosseap-6+haproxy-1.4] /var/lib/openshift/gear2name/jbosseap/logs/
[gear3name jbosseap-6+haproxy-1.4] /var/lib/openshift/gear3name/jbosseap/logs/

So in this case, the log-dir relative to the home directory is just, jbosseap/logs. Good to go!


Now, I do think that this would be much better suited as rhc tail-all (DOES NOT CURRENTLY WORK), but I’ll just have to file an issue request, or maybe take a stab at the code here if nobody beats me to it:

https://github.com/openshift/rhc/blob/master/lib/rhc/commands/tail.rb#L18
https://github.com/openshift/rhc/blob/master/lib/rhc/commands/ssh.rb#L37

I hope this helps. Good luck, openshifters!

September 9th, 2013 by Lincoln Baxter III

160+ Java EE 7 Samples and Quickstarts

If you are looking for examples on how to use some of the new or improved features of Java EE 7, I highly recommend checking out this git repository from Arun Gupta. https://github.com/arun-gupta/javaee7-samples

He has created over 160 samples that should work on every EE application server. If you find a bug, it’s likely a bug in the particular container you are using, but Arun is also welcoming feedback on these examples. So if there’s something you’d like to see that isn’t there, let him know. Additionally, if there’s something there that isn’t done right, speak up and he’ll fix it!

This is a great resource for the Java Enterprise Ecosystem 🙂

~Lincoln

August 12th, 2013 by Lincoln Baxter III

Rewrite – Servlet Toolkit and Java URL-rewriting library featured on MasterTheBoss.com

Just in case you would like to see a little tutorial of using [[Rewrite]], our friends over at mastertheboss.com have written up a quick tutorial explaining how to use Rewrite and get started using CDN relocation to save server bandwidth. Be sure to check out the tutorial to see some very interesting use-cases that can be solved simply with Rewrite.

Rewrite is a URL-rewriting and Servlet application framework intended to simplify tasks such as inbound request redirection, url-mapping, and outbound response modification. It provides a simple configuration API and annotation framework that makes customizing your Servlet applications simple.

July 26th, 2013 by Lincoln Baxter III

Rewrite 2.0.5.Final Released

We are pleased to announce the release of Rewrite 2.0.5.Final, which includes several bug fixes and enhancements.

Rewrite is an OpenSource, Filter-based Servlets extension for Java – enabling creation of bookmark-able, pretty URLs. Rewrite solves the “RESTful URL” problem elegantly, including features such as: page-load actions, managed parameter parsing, seamless integration with CDI, Spring, and configuration-free compatibility with other web frameworks.

Bug fixes in 2.0.5.Final

Issue #109 – Context root is appended twice when using Navigate.to() class
Issue #110 – View IDs with hard-coded query parameters were working in PrettyFaces 3, but no longer in PrettyFaces with Rewrite.

Other critical issues fixed in prior releases have continued to be tested for security holes. If you use container-based security, and have not yet upgraded from Rewrite 2.0.3.Final, you should Immediately upgrade to 2.0.4 or 2.0.5.Final because of the following issue:

Critical issue in 2.0.0.Final -> 2.0.3.Final

Issue 111 – Container based security is circumvented when Rewrite is installed

Documentation improvements

Additionally, we (mostly Christian) have put a good deal of work into the documentation and migration guide from Rewrite 1.x and PrettyFaces to Rewrite 2.x: You can find that guide here: http://ocpsoft.org/rewrite/docs/migration/prettyfaces3 – which is part of a larger effort to improve our documentation entirely. And of course, if you have any questions or concerns, please let us know on the forums, or submit an issue to our issue tracker.

Go get Rewrite now!

We hope you enjoy this latest release of Rewrite!
~Lincoln and the Rewrite Team

July 23rd, 2013 by Lincoln Baxter III

Guide to Regular Expressions in Java (Part 2)

Often unknown, or heralded as confusing, regular expressions have defined the standard for powerful text manipulation and search. Without them, many of the applications we know today would not function. This two-part series explores the basics of regular expressions in Java, and provides tutorial examples in the hopes of spreading love for our pattern-matching friends. (Read part one.)
July 22nd, 2013 by Lincoln Baxter III

Guide to Regular Expressions in Java (Part 1)

Often unknown, or heralded as confusing, regular expressions (regex) have defined the standard for powerful text manipulation and search. Without them, many of the applications we know today would not function. This two-part series explores the basics of regular expressions in Java, and provides tutorial examples in the hopes of spreading love for our pattern-matching friends. (Read part two.)
July 4th, 2013 by Lincoln Baxter III

An even better visual regular expression tester

For those of you who have not seen the Visual Regex Tester yet, this video should be informative, and for those of you who have, make sure to check out the new reverse-syntax highlighting features that I’ve recently added. My goal is to make this tester as useful and fun as possible; it should be a regular stable of regular expression development.

June 14th, 2013 by Lincoln Baxter III

Drop-in migration from MySQL to Percona DB in two minutes

Percona DB is a drop-in replacement for the MySQL database, and as you’d hope for a business model based on providing out-of-box performance enhancements, the install is a complete breeze.

June 4th, 2013 by Lincoln Baxter III

Upcoming Conference Appearances for OCPsoft

I’d like to take a brief moment to let everyone know that we’re going on a Conference Tour! I’ll be presenting on [[Rewrite]] at South-east Linux Fest (FREE) in Charlotte, North Carolina at the Blake Hotel (June 7-9).

I’ll also be presenting [[Rewrite]], Errai, and JBoss Forge at JUDCon Boston 2013 (June 9-11):

So please come join me for a fun and hopefully informative few sessions!