The problem is not with the servlet API. There is already a mechanism for querying the value of an arbitrary header. The problem is (as Tony points out in his first sentence) that the browser just doesn't send that information to the server.
Sure JavaScript can find it out, but JavaScript is running in the browser. Any server-side system can only know what it has been told over its socket connection from the browser. If the browser doesn't tell the server what it's screen size is, then the server can't pass it to your servlet.
If you really need this information, then you could consider passing it from JavaScript by building a URL such as /servlets/size?x=1024&y=768 or by using an
applet which opens a socket connection to your server.