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 "php". 96 entries found.

You can also try this same search on Google.

Maven Questions: Webapp best practices and local repositories

I can't seem to subscribe to the Maven User Mailing List for the life of me, so I'll ask my questions here, and hopefully get some answers. The first question is regarding local repositories. Ideally, I'd like to put this on a network drive, so all developers can get to it by mapping a drive or something. When I try to use a network drive, I get the following error (WinXP, Maven CVS pull from yesterday):

Artifact '\\server\share\repository\velocity\jars\velocity-1.4-dev.jar' 
    not found to add to classpath 
java.lang.ClassNotFoundException: velocity 
        at java.net.URLClassLoader$1.run(URLClassLoader.java:199) 

The reason I'd like to use a network share (over an FTP server or HTTP server) is because then we can easily add the .jar files to the classpath in Eclipse or JBuilder. If Maven downloads the files to each user's local hard driver - then we can use an FTP server. Another option is to use the default (~/.maven/repository), but then each developer has to copy javamail and our custom jars onto their hard drive.

My second question is regarding webapp best practices with Maven. The Maven Tomcat Plugin seems nice, but it mangles my server.xml file. I'd like a solution similar to the way I've done it with Ant. I use a context.xml file and place this in $CATALINA_HOME/webapps and then I "deploy" the expanded war into Tomcat. Tomcat detects when any files change under WEB-INF/ and reloads the app. Works great. A better solution would be to point the docBase to target/webappName. So I guess what I'm saying is - should I just create a context.xml file and make my own custom "setup-tomcat" task (which does an ant:copy)? Then use war:webapp to refresh the app's files from source? How are you experts doing it?

Posted in Java at Aug 22 2003, 11:51:35 AM MDT 3 Comments

Validation vs. Business Logic

In the manuscript I'm reading, I just ran into a diagram and overview of a layered architecture - and all of a sudden, it hit me. At work, most of our business rules are being implemented by Struts' Validator framework. In the case of indexed properties and more complicated rules, these reside in the validate() method of our action forms. So it's interesting to me that I'm using a business delegate to perform my business logic - when in actuality, all my delegates are doing is copying properties from a POJO to an ValidatorForm. So this begs the question - shouldn't validation (a.k.a business rules) be done wherever it is most convenient rather than only in the domain layer? Oh yeah, and most of this is just validation - our real business rules (comparing data for validation) takes place in Oracle stored procedures. And you know what - it works great!. So my opinion is - do whatever is easiest and makes the most sense.

Posted in Java at Apr 29 2003, 06:18:27 AM MDT 6 Comments

Simple Intentions turn into Remember Me Login

I woke up this morning, and had the simple intention of blogging about one of my favorite tools, The Color Schemer. If you're a wanna-be designer like me, it's awesome. It helps you match "like" colors and also allows you to select any color on your screen. It's one of my most invaluable web design tools. Putting a tip about this was my only hope at 4:30 when I sat down at this computer. Now it's 5:39.

Why am I still here? I got caught up in reading the Colorado Bloggers mailing list - which actually got some traffic yesterday. This is one of the first times I've received a message from the list. One of the members pointed me to a another Photo Album for the web. It's called Gallery and she has an example setup. Looks like it runs on PHP. Well that shouldn't have taken me an hour, right?

The activity that's filled my last hour has been wrestling with Erik Hatcher's request for "remember me" functionality in a J2EE app, using container-managed security. The good news is that I did get it working - here's how:

  1. First, I added a checkbox called "rememberMe" to my login.jsp. When the user clicks "submit", I do some JavaScript logic. This logic entails saving the username and password as cookies - but only if the rememberMe checkbox is checked. If rememberMe is checked, a cookie is set called "rememberMe" with a value of "true."
  2. Using Roller's BreadCrumbFiler (maps to /*), I added some logic to check for the existence of the "rememberMe" cookie, and if it exists, to route the user to "j_security_check?j_username="+usernameCookie+"&j_password="+passwordCookie.

This all worked fine and dandy right off the bat - took me about 10 minutes to implement. The problem was that a user couldn't "logout." So I've spent the last hour (now it's been an hour and 1/2) with my own ignorance trying to delete cookies (and doing null checks and such) so users could logout. And I just got it working - fricken sweet! What a way to start the day! The only problem I could see now is if a user tries a username/password and selects "remember me", but then closes their browser. The BreadCrumbFilter will keep trying to authenticate them - yep, I just verified that that's a problem. It's also a problem when they enter an invalid password and select rememberMe.

One way to solve this is to not set the "rememberMe" and "password" cookies until someone has successfully authenticated. Maybe I could use the breadcrumbs in the BreadCrumbFilter to check the last URL accessed, and if it's already j_security_check, don't do the routing. Anyway, here's the code that does the heavy lifting in BreadCrumbFilter:

Cookie rememberMe = RequestUtil.getCookie(request, "rememberMe");
// check to see if the user is logging out, if so, remove the
// rememberMe cookie and password Cookie
if (request.getRequestURL().indexOf("logout") != -1 && 
	(rememberMe != null)) {
    if (log.isDebugEnabled()) {
        log.debug("deleting rememberMe-related cookies");
    }

    response =
        RequestUtil.deleteCookie(response,
                                 RequestUtil.getCookie(request,
                                                       "rememberMe"));
    response =
        RequestUtil.deleteCookie(response,
                                 RequestUtil.getCookie(request,
                                                       "password"));
}

if (request.getRequestURL().indexOf("login") != -1) {
    // container is routing user to login page, check for remember me cookie
    Cookie username = RequestUtil.getCookie(request, "username");
    Cookie password = RequestUtil.getCookie(request, "password");

    if ((rememberMe != null) && (password != null)) {
        // authenticate user without displaying login page
        String route =
            "j_security_check?j_username=" +
            RequestUtils.encodeURL(username.getValue()) +
            "&j_password=" +
            RequestUtils.encodeURL(password.getValue());

        if (log.isDebugEnabled()) {
            log.debug("I remember you '" + username.getValue() +
                      "', authenticating...");
        }

        response.sendRedirect(response.encodeRedirectURL(route));

        return;
    }
}

I can post the code for RequestUtil if you need it. The class RequestUtils (for encoding URLs) is a Struts class.

Posted in Java at Jan 14 2003, 06:07:21 AM MST 4 Comments

Photo Albums Redux

Remember this post? I wrote about how much I liked Michael's photo album software. Well, lo and behold, he heard me and sent this e-mail:

Matt,

Hi, and thanks for the mention on your site. =)

My photo album stuff was a reworking in PHP of some other photo album/gallery things I'd seen. Of course everyone is looking for something specific, and I was no different, so I decided I needed to make one with what I wanted. That meant it also had to be XHTML and CSS compliant, and I decided on an all CSS layout for ease of updating (that, and I love CSS, heh).

It's basically a three-tiered approach, with thumbnails, medium-sized images and hi-res versions. It's just one main file in a root directory, and a CSS file, title file, and optional pic info/annotation file in each photo directory. Since the program uses the CSS file in each directory, I can create a different layout for each album. I did a couple of minor changes in some of them just to show that they don't all have to look the same.

What it doesn't do:

Currently it does not do any real image handling such as creating thumbnails. I do all the image editing manually and compile a directory of photos (with their respective subdirectories) and just upload it. The program sees the directory automatically.

Also currently, you have to have all 3 versions of photos. I haven't incorporated an option to replace thumnails with text links, or to use/not use hi-res images.

I plan on putting some of these things in before making the whole thing freely available for public consumption, but if you'd like a copy of it as it is, I'd be happy to send it along with a brief intro on how to use it.

Again, thanks for the mention and the kind words.

Take care.

--michael

I responded to his e-mail and I now have this software in my Inbox - what a guy, eh? Thanks Michael! Now if I can only find the time to experiment and (possibly) implement.

Posted in The Web at Nov 12 2002, 09:14:23 AM MST Add a Comment

Good Wiki vs. Good Java Wiki

I discovered yesterday that I have PHP installed on this server. Today I discovered Tiki. And I ask myself, "Are you looking for a good wiki, or a good java-based wiki?" If you've noticed Tiki's release date (1.0 Released Nov 28 2002), it appears to be ahead of it's time.

Posted in General at Oct 30 2002, 12:56:58 AM MST Add a Comment

Should I learn PHP?

It probably wouldn't take very long to learn, and it seems like a lot of folks like it. Is it worth it - a.k.a. will it get me more clients?

According to The FuzzyBlog!, Yahoo likes it. Read why Yahoo will use PHP over all other open source technologies. Personally, I think they chose PHP because they have the inventor working for them.

I think I'll pass on learning it at this time - I'm having to much fun with Java and all it's goodies.

Posted in General at Oct 28 2002, 05:38:15 AM MST Add a Comment