JPOS / CATATAN</>↗jPOS02 Jun 2012
The code snippet below will show you how to unpack ISO 8583 message. package org.kodejava.jpos; import org.jpos.iso.ISOException; import org.jpos.iso.ISOMsg; import org.jpos.iso.packager.GenericPackager; import java.io.InputStream; public class UnpackISOMessage { public static void main(String[] args) { UnpackISOMessage iso = new UnpackISOMessage(); try { ISOMsg isoMsg = iso.parseISOMessage(); iso.printISOMessage(isoMsg); } catch (Exception e) { e.printStackTrace(); } } priva...
JPOS / CATATAN</>↗jPOS02 Jun 2012
The code snippet below show you how to pack an ISO 8583 message. package org.kodejava.jpos; import org.jpos.iso.ISOException; import org.jpos.iso.ISOMsg; import org.jpos.iso.packager.GenericPackager; import java.io.InputStream; public class PackISOMessage { public static void main(String[] args) { PackISOMessage iso = new PackISOMessage(); try { String message = iso.buildISOMessage(); System.out.printf("Message = %s", message); } catch (Exception e) { e.printStackTrace(); } [...
SERVLET / CATATAN</>↗Servlet01 Jun 2012
The following example show you how to create a servlet filter using the @WebFilter annotation. We will create a simple filter that will check whether an attribute is exists in the http session object. If no attribute found this filter will redirect user into a login page. package org.kodejava.filter; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; […]
2D API / CATATAN</>↗2D API23 Mei 2012
To draw a text / string vertically we need to do a transform on the Graphics2D object. First, create an instance of AffineTransform and set the rotation using the setToRotation() method. And then pass this transform object into g2.setTransform() method. package org.kodejava.awt.geom; import javax.swing.*; import java.awt.*; import java.awt.geom.AffineTransform; public class DrawVerticalText extends JPanel { public […]
2D API / CATATAN</>↗2D API23 Mei 2012
The code snippet below show you how to draw a string using Graphics2D. The drawString() method accept the string to be drawn and their x and y coordinate. Here you can also see how to set the antialiasing mode using the setRenderingHint() method. package org.kodejava.awt.geom; import javax.swing.*; import java.awt.*; public class DrawString extends JPanel { […]
SERVLET / CATATAN</>↗Servlet23 Mei 2012
Annotations is one new feature introduces in the Servlet 3.0 Specification. Previously to declare servlets, listeners or filters we must do it in the web.xml file. Now, with the new annotations feature we can just annotate servlet classes using the @WebServlet annotation. package org.kodejava.servlet; import javax.servlet.ServletException; import javax.servlet.annotation.WebInitParam; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import ja...