Upgrading from JSON-RPC-Java to jabsorb
jabsorb 1.1 is completely compatible with JSON-RPC-Java.
There are only a few changes you need to make to your web application to upgrade to jabsorb:
- Replace json-rpc.jar with jabsorb-1.1.jar
- Replace jsonrpc.js with the new copy from jabsorb.
- change all references to the com.metaparadigm.jsonrpc package space in your web.xml, JSPs and java code to org.jabsorb.
for example, in your web.xml file, the servlet previously under
com.metaparadigm.jsonrpc.JSONRPCServlet
should be changed to
org.jabsorb.JSONRPCServlet
and any references in your JSPs or Servlets under
com.metaparadigm.jsonrpc.JSONRPCBridge
should be changed to
org.jabsorb.JSONRPCBridge
This can be handled with a global replace in most editors/IDE's. Make sure you update any other code that references com.metaparadigm.jsonrpc to org.jabsorb as well, including any custom serializers you might have created.
Any references to the org.json classes will be the same, however jabsorb is running a much newer version of the core json classes. In many cases, these classes, if used directly can throw a new checked exception, org.json.JSONException that wasn't previously thrown in the older org.json classes that were used in the JSON-RPC-Java library (which also threw exceptions, however they were unchecked exceptions in that version.)
If you have any code that uses the JSONObject or JSONArray or other org.json classes, you may need to modify it to handle the new checked exception that can be thrown.
jabsorb uses the Simple Logging Facade for Java to handle server side logging (actually JSON-RPC-Java does as well, if you are running off the SVN trunks.)
You will need to choose which Java logging system you will use.
In many cases, you already know this, because it is dictated by your existing application. SLF4J lets you pick among many common java logging systems:
- Log4j
- java.util logging in JDK 1.4
- logback
- Jakarta Commons Logging
SLF4J is designed to de-couple your application from the java logging system so you can choose any one you want.
Make sure you include the latest slf4j-api jar in your web application, as well as the slf4j jar specific to the logging system you are using.
The two .jar files that come with the jabsorb distribution (in the lib/ folder) are sufficient to get things working with the java.util logging system, if you don't already have any other logging system in place.
Please refer to the SLF4J Web site and the specific web site for the logger you are using, for more information.
Previously, in JSON-RPC-Java, many classes had a debug flag that could be turned on or off by calling a setDebug method directly on various classes. This has been removed in jabsorb and is now instead controlled by standard logger level setting mechanisms. Each class has a logger under it's class name (as under standard logging practices) and classes typically log debugging information at the FINE/DEBUG level, only if the logger is turned on at that level.
So, for example, to turn on debugging for all of jabsorb using java.util logging, you might place a line like this into your logging.properties configuration file:
org.jabsorb.level=FINE
Or to turn on debugging just for the JSONRPCServlet you might use a line like this:
org.jabsorb.JSONRPCServlet.level=FINE
Note that the terminology for the logging level would be different if you were using some other logging system, such as log4j (DEBUG) instead of java.util logging (FINE).