JAVA and JAR’s from the command line

This is a small little tutorial which will explain how to create your own little Java application which have dependencies which are in other JAR files First create the following directory structure: java_test | |__myapp | |__src | | |__ch | | |__eitchnet | | |__java | | |__Main.java | |__META-INF | | |__MANIFEST.MF | […]

JSF and PDF’s

This is a quick snipped on transmitting a PDF in a JSF context: byte[] bytes = getPDFStreamAsArray(); FacesContext faces = FacesContext.getCurrentInstance(); HttpServletResponse response = (HttpServletResponse) faces.getExternalContext() .getResponse(); response.reset(); response.setContentType(“application/pdf”); response.setContentLength(bytes.length); response.setHeader(“Content-disposition”, “inline;filename=”file.pdf””); // inline or attachment response.setHeader(“Cache-Control”, “cache, must-revalidate”); ServletOutputStream out = response.getOutputStream(); out.write(bytes); faces.responseComplete();

JSF and EL (Expression Language) rant !

Beware people… Referring to missing methods in a Bean from a XHTML page using the expression language yields an exception, but referring to a *private* method, doesn’t to nothing. No exception, no message, just plain and simply nothing. I spent hours trying to understand why my application didn’t work, and now I know it: Be […]

Java RMI quick and dirty

Your object which will be accessible through RMI must meet the following requirements: have its own interfaces which extends java.rmi.Remote all methods must “throws RemoteException“ all returned returned objects must implement java.io.Serializable Starting a RMI server: Set system property: System.setProperty(“java.rmi.server.hostname”, “hostname”); create registry: Registry registry = LocateRegistry.createRegistry(1099); export Object: RemotableObject stub = (RemotableObject) UnicastRemoteObject.exportObject(remoteObject, 0); […]