If you have access to client side Javascript in your application then you can use:
// attempt to get the size from the window object
// otherwise fallback to the document body.
var size = {
width: window.innerWidth || document.body.clientWidth,
height: window.innerHeight || document.body.clientHeight
}
If you're looking to find a server side solution in java(?) then see here for an example.