Matt RaibleMatt Raible is a writer with a passion for software. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.
You searched this site for "matt". 663 entries found.

You can also try this same search on Google.

AppFuse on DB2 and WebSphere

I did some trial-and-error this morning, and with the help of a lot of handy-dandy unit tests, I got [Appuse working on DB2|AppFuseOnDB2]. I learned that I need to figure out how to create a database with page size = 8 by default - anyone got a SQL script to create DB2 databases (with reasonably sized table spaces) lying around?

Next up: Getting AppFuse running on WebSphere 5.1, this should be fun. Especially considering that they only seem to support .ear files, not .war files. I've only glanced at the thing for 5 minutes - any advice/links would be awesome.

Posted in Java at Jan 12 2004, 10:23:11 AM MST 9 Comments

The Battle of the GZip Filters

When I first added a Compression/GZip filter to AppFuse, I used the one from Roller, which I believe Lance found in this book. This has worked fairly well since I added it in July last year. When I discovered that there were issues with it on Resin, I chaulked it up as "no big deal" since I don't use Resin anyway. But yesterday, when I discovered that it stopped my apps from displaying my 403 <error-code> page, that was the last straw. I remembered seeing the "Two Servlet Filters Every Web Application Should Have" article on ONJava.com about a different implementation, so decided to download the source and try it out.

I quickly discovered that this Filter does work on Resin, so that's quite a bonus. I've had issues getting Roller to work on Resin with the Filter enabled, so I might have to replace Roller's CompressionFilter. However, I did still have to change a few things to convince this Filter to satisfy my needs.

Here are a few things I discovered about this GZIPFilter vs. Roller's CompressionFilter:

  • Don't download the GZIPFilter from the article. There is a newer version of the code. Not much has changed, save for an almost completely re-written GZipResponseStream.java file. This one supposedly does better handling of large files.
  • This Filter has the same problem I experienced with Roller's CompressionFilter: JSP pages don't finish rendering when running my Canoo WebTests. I'm assuming that this is because the buffer hasn't finished spitting out HTML. I ended up writing a new isGZIPSupported() method (in GZIPFilter.java) to do the check for GZip support. This allows my webtests to run smoothly by disabling the filter for HttpUnit.
  • This Filter shares another issue that I found in the CompressionFilter yesterday. When my webapp returns an HttpServletResponse.SC_FORBIDDEN error code (from trying to access a method that denies the users role), the Filter suppresses the error and the user is not served up the 403 error page defined in my web.xml. To fix this, I overrode sendError() in GZIPResponseWrapper.java and added a check for this error code in the getWriter() method.

Overall, I'm pleased with this code because I love the concept of GZip Filtering, and now it's not causing any conflicts in my app or targeted appservers.

GZIPFilter.isGZIPSupported(HttpServletRequest):

    private boolean isGZIPSupported(HttpServletRequest req) {
        String browserEncodings = req.getHeader("accept-encoding");
        boolean supported =
            ((browserEncodings != null&&
            (browserEncodings.indexOf("gzip"!= -1));

        String userAgent = req.getHeader("user-agent");

        if (userAgent.startsWith("httpunit")) {
            if (log.isDebugEnabled()) {
                log.debug("httpunit detected, disabling filter...");
            }

            return false;
        else {
            return supported;
        }
    }

GZIPResponseWrapper.sendError(int, java.lang.String):

    public void sendError(int error, String messagethrows IOException {
        super.sendError(error, message);
        this.error = error;

        if (log.isDebugEnabled()) {
            log.debug("sending error: " + error + " [" + message + "]");
        }
    }

GZIPResponseWrapper.getWriter():

    public PrintWriter getWriter() throws IOException {
        // If access denied, don't create new stream or write because
        // it causes the web.xml's 403 page to not render
        if (this.error == HttpServletResponse.SC_FORBIDDEN) {
            return super.getWriter();
        }

        if (writer != null) {
            return (writer);
        }

Posted in Java at Jan 09 2004, 11:30:43 AM MST 15 Comments

[IDEA 4.0] Favorite Feature = Package View

IDEA 4 Package View My favorite feature of IDEA 4.0 is the package view. Since I keep my src and test trees separate, but their package structures identical, this is the view I've been longing for. Hopefully it's possible with Eclipse and I just haven't figured it out. What it does is allow me to see tests right next to my classes. In Eclipse, I have to constantly navigate between the two trees to edit tests and such.

Does this mean I like IDEA better than Eclipse? No, it simply means that I wish Eclipse had this feature, and I appreciate IDEA for adding it.

Posted in Java at Jan 05 2004, 12:18:42 PM MST 4 Comments

A little EL Lovin' for the DisplayTag

Tim McCune submitted a patch for the Display Tag Library to add Expression Language support. I committed it today, along with a few other enhancements. You can read more on the displaytag-devel mailing list. Tim's patch was a nice clean approach to adding EL support. He just subclassed the existing tags and then evaluated the expressions. All I did to integrate was to create an "el" package under "tags" and added an additional .tld file. So there's really nothing that's taken away from the original tag library, and if you want EL support, you simply need to use the "*-el.tld" in your web.xml or change your URI to "http://jakarta.apache.org/taglibs/display-el". Of course, you'll need to include JSTL's JARs (standard.jar and jstl.jar) in your WEB-INF/lib to make this work. This patch included the ability to specify a titleKey attribute - a much asked-for feature.

I like Tim's approach so much, I might have to use it for Struts Menu. It's a slick way of supporting JSP 1.1 containers, and adding optional EL support for JSP 1.2 containers. I haven't had any feedback from the dev team, but hopefully this will make it into the next release.

Posted in Java at Jan 02 2004, 10:52:46 PM MST 10 Comments

Send a Fax from Java?

I'm looking for a (hopefully free) way to send a Fax from a Java program. I think the easiest way would be to send an e-mail to some sort of service that processes it and faxes it the recipient. Any suggestions?

Posted in Java at Dec 31 2003, 11:37:12 AM MST 7 Comments

Useless Tag Library?

Inspired by this post, I wrote a tag library to expose the fields of my Contants.java class to my JSPs. It allows a user to specify a single variable using:

<appfuse:constants var="USER_KEY"/>

Or all variables:

<appfuse:constants/>

By default, it exposes the values from the Contants class imported into the tag library, but also allows a className variable to specify a different class. The main reason I wrote this was to prove it was possible. The second reason was to get around importing my Contants class (and using <%=Contants.VARNAME%>).

Interested? Read More ...

Posted in Java at Dec 31 2003, 08:25:57 AM MST 1 Comment

[ANNOUNCE] Ant 1.6 Released!

Big news baby - the best Java tool in the world has a new release. I don't know that I'll use any of the new features (such as antlib, macrodef, presetdef, ssh tasks), but I do love to upgrade. Downloading now...

Later: It looks like Canoo's WebTest is not compatible with Ant 1.6. Reverting back to 1.5.4.

C:\Source\appfuse\test\web\web-tests.xml:29: Task must be of type "Step": invoke at 
C:\Source\appfuse\test\web\login.xml:1:  is of type org.apache.tools.ant.UnknownElement

Line 29 is: <canoo name="login">. I've notified the webtest mailing list, hopefully there will be a resolution shortly.

Posted in Java at Dec 18 2003, 08:17:01 PM MST 3 Comments

Interested in Java ISP Options

I'm not exactly looking for a new ISP, but I am interested in exploring my options. I'm currently averaging about 10 GB of bandwidth usage per month, and it's unlikely to go down. I only pay around $50/month, so it's not bad, but I wouldn't mind some more RAM. I don't want to administer the server per say - I'd like backups and e-mail setup/config done for me. I don't think I want my own server b/c I don't want to be a sysadmin - I only want to worry about the Java server setup. Below is my ideal setup - please let me know if you think there's other things I should be looking for.

  • Linux
  • 512 MB RAM
  • 1 GB disk space
  • A Fat Pipe (100 MB+)
  • 25-50 GB traffic
  • Tomcat or Resin (Servlet 2.3 and JSP 1.2 at a minimum)
  • MySQL databases (2-5)

Posted in Java at Dec 18 2003, 02:09:30 PM MST 12 Comments

Hibernate's AdminApp - a demo of WW2 and Hibernate

After looking at Hibernate's AdminApp, as well as other WW2 apps - I've noticed something. WW2 developers don't seem to give a rats ass about referencing their POJOs in their Actions, or using Hibernate directly in their actions. At first glance, I think to myself, "boy that sure makes things easier." But then again - doesn't that tightly couple your web layer to your persistence layer?

I can understand the POJO reference in Actions - I'm about to give up on doing a parent/child relationship with Hibernate where the children are converted to ActionForms and then converted back (Hibernate loves to tell me "a different object with the same identifier value was already associated with the session: 1").

It would be SO much easier (with this particular problem) if I could just toss up POJOs to my view. The thought of importing "persistence.User" into my Action makes me cringe though. I don't know why, it just does. I need to get out of this patterns mindset I've been in for the last couple of years and get back to what really matters - simple, easy to learn, and fast to develop. I'm tired of banging my head against the wall with Struts and Hibernate.... I've been doing it for two days. It's not Hibernate, and it's not Struts, it's me... (thud, thud, thud).

Posted in Java at Dec 17 2003, 02:35:09 PM MST 15 Comments

Denver JUG: XSLT and New EJB 2.0 Certification

Tonight I attented the Denver Java User Group meeting. Tom McQueeney did a nice basic concepts meeting on XSLT. Tom's presentation was a nice refresher on XSL and I learned a few things I hope I can remember the next time I use it. I've used XSL a couple of times in the last few years, and for those applications that I still maintain - I'm very glad I did. The e-learning app I developed last year uses JSTL's XML Transformation tags to render assets with different HTML (i.e. Flash, QuickTime, Image). It's worked great, and has always been very easy to add a new asset type to the XSL stylesheet.

The main speaker tonight was Kathy Sierra, the founder of JavaRanch. Her presentation was supposed to be on the new EJB 2.0 Certification, but it turned out to be a explanation of how EJBs work. Only about 1/3 of the room (approx. 40 attendees) had used EJBs, so I guess that's why she went that route. She didn't ask if we weren't using them by choice. ;-).

She started off her presentation talking about how the brain works and how it fights all day long to forget stuff. Your brain has a built-in crap filter. It only remembers those things that it needs to survive. It will only automatically remember those events that spark high emotions - fear, humor, arousal - because the chemicals caused by the emotions help you remember better. So when you're studying for your Java Certification (or any certification), the brain is going "screw this shit, I can survive without it." Repetition is a way to convince your brain that it is important. Another way is to get involved with your learning - be the EJB. Kathy did a captivating one-hour presentation with a number of audience members who acted out how EJBs work.

It was a very humorous presentation and great fun. An EJB presentation that was fun - WTF?! At one point, I looked around the room and almost everyone was learning forward and smiling. This lady is a captivating speaker, one of the best I've ever seen. I was very impressed with her teaching/learning techniques and I might just have to buy her book, Head First Java. Another highlight of the evening was that I actually won a free book.

Later: I forgot to mention what Kathy said about upcoming Sun Certifications. A couple new ones are coming: Mobile Application Developer, Web Services and an update to the Web Component Developer exam. She mentioned that the EJB 2.0 exam would probably remain at 2.0 for at least another year - until all the vendors caught up and support EJB 2.1. She said the Web Services one is going to be hard as will the next Web Component Developer Exam. The Web Component Developer exam will cover JSP 2.0 and Servlet 2.4. She also mentioned that she was reading Pro JSP to help create the WCD exam. How's that for an endorsement?!

Posted in Java at Dec 11 2003, 12:17:08 AM MST 5 Comments