Obfuscating and reducing JavaScript using Trinidad plugin

Posted by Mike Haller on Tuesday, July 31. 2007 at 00:00 in Java
Apache MyFaces Trinidad's maven-javascript-plugin can be used to obfuscate and reduce JavaScript source code.

I let the plugin work on the JavaScript files coming with Mozilla Firefox 2, a total of 1.4 MB of source code.
The resulting files were reduced to 644 kilobyte.

I'll show you how to set up and run the maven-javascript-plugin. As your faces project might have a lot of JavaScript, this little helper could get handy some day.

maven-xrts-plugin - Generating Message Bundles from XML

Posted by Mike Haller on Monday, July 30. 2007 at 13:38 in Java
Apache MyFaces Trinidad is using its maven-xrts-plugin to generate Message Bundle classes out of a XML file for internationalization (i18n). (X)RTS is a proprietary XML format to represent key/value pairs with namespaces. I'll show how to add the plugin to your pom.xml and how to use the format to generate Message Bundle classes.

MyFaces Trinidad-related Maven Plugins

Posted by Mike Haller on Sunday, July 29. 2007 at 13:48 in Java
The Apache MyFaces project contains JSF-related (Java Server Faces) frameworks and tools.
One of these is Apache MyFaces Trinidad.
Trinidad contains several Maven plugins:


maven-faces-plugin
Generates source code for components, facelet taglibs, the faces config, jsp taglib and the renderkit

maven-i18n-plugin
Generates JavaScript Locales and Locale Elements

maven-javacc-plugin
Trinidad internal plugin, not to be used

maven-javascript-plugin
JavaScript Obfuscator and Optimizer

maven-jdev-plugin
Generates workspace for JDeveloper

maven-tagdoc-plugin
Generates JSF Tag documentation

maven-xrts-plugin
Generates Message Bundle classes from XML



I'll try to write something about each of these as I come along in our JSF project.

Java Object Serialization payload

Posted by Mike Haller on Thursday, July 19. 2007 at 17:27 in Java

In distributed systems, you will probably move a lot of Object forth and back between your systems.
Some developers never even though about the actual data sizes being transmitted in these cases.
To get a rough feeling about the data transferred when using RMI, think about the following figures:

A class file like Serializable.class takes up 41 bytes.
An empty String only uses 7 bytes.
A BigDecimal is one of the fattes: 293 bytes

In fact, Strings are the most space-saving data type you can use for remoting.

Here is a list I compiled for your convenience.

Serializable.class: 41
Class without any properties: 51
Integer 123456: 81
Long 123456: 82
Empty String: 7
String 'Hello World': 18
Char Array 'Hello World': 49
Byte Array 'Hello World': 38
BigDecimal 123456: 293
Empty HashMap: 82
HashMap with 123456='Hello': 167
Primitive boolean true: 47
Complex type Boolean.TRUE: 47
Enum RoundingMode.CEILING: 82
Class with 6 properties, all null: 185
Class with 6 properties, default values: 525
Class with 6 properties, with 'real' data: 635
Class with 7 properties, all properties null: 243
Class with 7 properties, all properties default values: 587
Class with 7 properties, all properties with 'real' Data: 746
List of 100 same instancec: 1295
List of 100 deep copies: 25847

About

My name is Mike Haller and I'm a software developer and architect at Bosch Software Innovations in Germany. I love programming, playing games and reading books. I like good food, making photos and learning and mentoring about the craftsmanship of commercial software development. Stack Overflow profile for mhaller

Quicksearch

Archives