Skip to Content »

Tech Life of Recht » archive for November, 2006

 SSL certificates

  • November 3rd, 2006
  • 7:16 pm

It's always a mess to create self-signed certificates and managing them correctly. Instead, I've used CAcert where you can get free certificates without too much trouble. You just have to import their root certificate, which isn't that bad.
However, you're out of luck if you're stuck with Java 1.4, as the CAcert certificates are in 4096 bits, which Java 1.4 can't handle, it just dies with

CODE:
  1. keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect

or some other variation of the same error. Nothing can solve that besides upgrading to 5.0, which would be a good choice, but at the moment, I'm stuck with a 1.4 app server.

Instead, I found StartCom Free SSL, which provides more or less the same service, just with lower-grade certificates. And as an extra bonus, their root certificate is already included in Firefox.

 GWT XDoclet with upload support

  • November 2nd, 2006
  • 12:57 am

In celebration of the new GWT 1.2 release candidate, I've released a new version of the GWT XDoclet module.

The most prominent change is support for file uploads. Instead of configuring web.xml and upload paths manually, client classes which need upload capability are annotated:

CODE:
  1. package dk.contix.gwt.client;
  2.  
  3. /**
  4. * @gwt.upload path="/upload" servlet="dk.contix.gwt.service.FileUpload"
  5. * @gwt.upload path="/jpegUpload" servlet="dk.contix.gwt.service.FileUpload"
  6. */
  7. public class UploadPanel extends Composite {
  8.   public UploadPanel() {
  9.     VerticalPanel p = new VerticalPanel();
  10.     final FormPanel fp1 = UploadFactory.createUpload();
  11.     fp1.setWidget(p);
  12.     fp1.addFormHandler(...);
  13.  
  14.     final FormPanel fp2 = UploadFactory.createJpegUpload();
  15.     fp2.setWidget(p);
  16.     ...
  17.   }
  18. }

You still need to implement the servlet yourself. The GWT group has plenty of suggestions for that.

To activate the code generation, add the following to the ant target:

CODE:
  1. <gwtdoclet ...>
  2.  ...
  3.   <uploadfactory class="dk.contix.gwt.client.UploadFactory"/>
  4. </gwtdoclet>

This will generate the factory class and add servlet definitions in web.xml and the GWT module xml file.