Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


Java Programming Code Examples

Java > Other Code Examples

Counter handler

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Counter handler package com.ack.webservices.soap.examples.handlers; import org.apache.axis.AxisFault; import org.apache.axis.MessageContext; import org.apache.axis.handlers.BasicHandler; public class CounterHandler extends BasicHandler { public void invoke( MessageContext msgContext ) throws AxisFault { try { String thePrefix = (String) getOption( "prefix" ); Integer accessCount = (Integer) msgContext.getProperty( "accesses" ); if( accessCount == null ) { accessCount = new Integer( 1 ); } else { accessCount = new Integer( accessCount.intValue() + 1 ); } msgContext.setProperty( "accesses", accessCount ); System.out.println( thePrefix + " " + accessCount ); } catch( Exception e ) { throw AxisFault.makeFault( e ); } System.out.println( "hash code for counter: " + hashCode() ); } public void undo( MessageContext msgContext ) { } }