Compiling and Packaging a DCN Filter Into a Jar File


  1. Create a CustomDCNFilter.java file:
     
    import java.util.Map;
    import com.onepage.fw.uwp.shared.uwp.UWPLogger;
    import com.sybase.sup.dcn.DCNFilter;
    public class CustomDCNFilter implements DCNFilter
    {
      public String  preprocess(String blobDCNRequest, Map<String,String> headers) {
                     String result = blobDCNRequest.replace('~',':');
                     return result;
      }
      public String postprocess(String jsonDCNResult, Map<String,String> responseHeaders) {
                     String result = jsonDCNResult.replace(':','~');
                     return result;
      }
            public static void main( String[] args ) { }
    }
  2. Create a DCN.bat file:
     
    @echo off
    setlocal
    set SUP=C:\<UnwiredPlatform_InstallDir>\UnwiredPlatform-1_2\Servers\UnwiredServer
    C:\Sybase\UnwiredPlatform-1_2\JDK1.6.0_12\bin\javac -classpath %SUP%\lib\onepage.jar CustomDCNfilter.java
    echo Return code: %errorlevel% > "C:\<UnwiredPlatform_InstallDir>\UnwiredPlatform-1_2"\Servers\UnwiredServer\CustomDCNfilter\returnCode.log
    "C:\<UnwiredPlatform_InstallDir>\UnwiredPlatform-1_2\JDK1.6.0_12"\bin\jar cvf ..\lib\CustomDCNfilter.jar CustomDCNfilter.class > returnJar.log
    endlocal
    
    
  3. Place both files in the C:\<UnwiredPlatform_InstallDir>\UnwiredPlatform-1_2\Servers\UnwiredServer\CustomDCNfilter directory.