Debugging And Logging Java RMI Calls

If you ever need to debug Java RMI, then add these properties to the VM configuration: -Djava.rmi.server.logCalls=true -Dsun.rmi.server.logLevel=VERBOSE -Dsun.rmi.client.logCalls=true -Dsun.rmi.transport.tcp.logLevel=VERBOSE

Implementing Ajax push with RichFaces

The following snippets illustrates how to implement an ajax push in a JSF application where RichFaces is set up. I am using this with a JSF application with Tomahawk extensions and RichFaces just for Ajax and Menus Add the following in the XHTML: <!– Register an ajax listener on the bean –> <a4j:push interval=”1000″ eventProducer=”#{bean.addPushListener}”… Continue reading “Implementing Ajax push with RichFaces”

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();

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);… Continue reading “Java RMI quick and dirty”

Apache Tomcat 6.0 configuration for developers

Just a quick blog on configuring some specific Tomcat 6.0 settings: Memory Heap Size on a unix based system Open the file %tomcat_install_folder%/bin/startup.sh Add the line: export CATALINA_OPTS=”-Xms256m -Xmx512m” before the line: exec “$PRGDIR”/”$EXECUTABLE” start “$@” to have a memory heap of at least 256mb and max of 512mb. Memory Heap Size on a Windows… Continue reading “Apache Tomcat 6.0 configuration for developers”