Tuesday, April 2, 2013

Maven YUI Compressor: how to remove line breaks

I have used YUI Compressor for Maven for my jQuery Vortex project. Although the files were correctly minified and obfuscated, the plugin kept all the line breaks, like this:
var k=0;
var m=false;
var w=b(d);
var j=[];
var c=[];
var e=this;
var l=-1;
var h=[];
var v=false;
var g=[];
If you want all the output being written on a single line, the plugin must be configured with:
which produces the wanted output:
var k=0;var m=false;var w=b(d);var j=[];var c=[];var e=this;var l=-1;var h=[];var v=false;var g=[];

Friday, February 15, 2013

Java: how to receive unsigned values from a socket connection

Most of developers know that one of the biggest criticism of Java is the lack of native unsigned integer types. For a short discussion about it, see Criticism of Java: Unsigned integer types.

When interfacing a socket connection with a C or C++ written client, you may need to deal with unsigned values, which are widely used in such languages.

It would be nice to (almost) transparently receive UnsignedLong and UnsignedInteger and use it in our Java application.

Apache CXF and WS-Security: how to encrypt a SOAP client request using an X.509 certificate

There are cases where communication data are too sensitive to travel over the network in a plain form, exposing them to the risk of being intercepted by a packet analyzer.

In such a case, a Web Service may require that the communication between client and server should be encrypted.

The WS-Security standard protocol allows a variety of encryption formats and algorithms, and is open to various security token models.

This article tries to explain how to achieve such a level of confidentiality using a X.509 certificate.

Monday, February 11, 2013

Apache CXF: how to consume a Web Service through HTTPS

When the web service has to be consumed through an SSL network connection, it is not enough to change the endpoint prefix of the soap client, but some configuration is needed.

This article tries to explain how to configure your soap client to consume a Web Service with CXF through HTTPS.

Apache CXF and WS-Security: how to authenticate your client when a password is not required

When dealing with WS-Security, you might need to face a situation when your client needs to authenticate itself with a Username Token, but a password is not required.