Browsing articles in "Java"
Oct
12
2006

Doing bytecode Kungfu with Javassist

Came across a situation today where I need to mock out a static method on one of Websphere’s classes to simulate a certain test case. Normally this kind of bad boy is pretty tricky since you’ve either got to wrap the vendor’s class with your own injectable wrapper, or provide your own impl for their interface. The call in question was: WSSubject.getCallerSubject(); with WSSubject being a static and final class for good measure. No mocking of the [...]

Oct
3
2006

Twofish, Cipher Block Chaining, and Bouncy Castle…

I’ve been hard at work on the lastest release of PasswordSafeSWT, my Java port of the popular Win32 password manager PasswordSafe. The biggest change in the new version is a completely overhauled file crypto (which, in part, uses 256bit TwoFish in Chaining Block Cipher mode, along with some HMAC-SHA256, and some standard SHA256). Now, I’ve never been exposed to CBC before, so it was quite an interesting bit of work. With a chaining block cipher, [...]

Sep
19
2006

In-Browser functional testing with Selenium

I’ve been wanting to get into functional testing for a while, but have just never worked up the enthusiasm for the whole "writing clicks as code" deal that you get with the current crop of http-based junit-like test frameworks. But the other day a workmate put me onto Selenium, and I’ve got to say that its just sensational. I can record my scripts straight in the browser (screencast), do the level of asserts I need [...]

Sep
15
2006

Implementing SAML 2.0 on the cheap…

This last year I’ve done more SAML than any man should. I’ve had a couple of clients doing federated identity and single signon stuff, and SAML is all the rage (actually, I’ve found it pretty great to work with once I got my head around XML C14N). SAML 2.0 is new and shiny and vendors are still scrabling to build libraries to handle it, so to test interop, I built a little test harness. Originally it just [...]

Sep
12
2006

Grails: Sending a file to the browser

I recently wanted to add the ability to export CSV files from my little Grails app directly to the browser with one of those "Save As…" numbers. Makes it very easy for clients to save a copy of their addressbook directly to their local disk, and reimport it later on. I’m using opencsv for the heavy lifting so the CSV bit was a snack. The tricky bit was getting the browser to popup as a [...]

Aug
23
2006

Feeling a little comma-separated? Try opencsv 1.6…

Thanks to user-supplied patches, I’ve just uploaded opencsv 1.6 to Sourceforge – my Apache licensed two-class library for reading and writing CSV files. If you’re in the market for a CSV library and can’t be bothered with dealing with unusual edge cases, this might be the library for you. This new release adds custom line terminators (which is pretty useful if you’re exporting CSV from your linux web server to Win32 clients). Thanks to Klaus [...]

Aug
12
2006

Making the switch to Glassfish

I’m a longtime Jetty user and a huge fan (it’s always been my appserver of choice and the stuff coming in Jetty 6.0 looks just amazing), but for my own sites (including this one), I’ve made the switch to Glassfish. I’ve heard so much good stuff about it lately it was time to take it for a proper workout. The install was painless, and I had my apps redeployed on the appropriate virtual servers inside [...]

Aug
11
2006

Grails + Yahoo Autocomplete = Giddy Up

My little grails SMS gateway is powering along. I’ve now integrated Yahoo autocomplete into my "New SMS" page and it works just great. Now my users can begin typing entries from their addressbook, and get that snazzy dropdown happening as they type. Even works with multiple elements when you type in a comma. Sample below: I’ve been really impressed with how customisable Yahoo have made it. You can wire up the datasource to be Ajax [...]

Aug
4
2006

Grails = Productivity++ (maybe even Productivity*=)

For my "teach yourself Grails" project I’m building a little SMS Website gateway which I’m calling CyaThen. The idea is to be able to logon, select a bunch of users from your addressbook, and send them an SMS (or schedule one for later). Turns out that this is quite a good little tester for grails, since I’m needing to: Write a ton of simple forms for create/edit/delete messages, history, addressbook – all with database integration [...]

Jul
22
2006

Starting to look at Grails…

After spending the last couple of weeks tinkering with Groovy, I figured it was time to have a closer look at Grails to see what it had to offer. I’ve gotta say that my first impressions are very positive. First of all, the user guide has increased out of sight – with tons of coverage on the stuff you want to know about (how controllers work, dynamic tag libraries, ORM integration, all very cool). Follow [...]

Glen Smith

About Glen

Co-author Grails in Action