1 18 19 20 package sync4j.server.engine; 21 22 import java.util.logging.Logger ; 23 import java.util.logging.Level ; 24 25 import sync4j.framework.core.SyncML; 26 import sync4j.framework.core.Sync4jException; 27 import sync4j.framework.config.Configuration; 28 import sync4j.framework.config.ConfigurationConstants; 29 import sync4j.framework.logging.Sync4jLogger; 30 import sync4j.framework.logging.Sync4jLoggerName; 31 32 import sync4j.framework.engine.pipeline.OutputMessageProcessor; 33 import sync4j.framework.engine.pipeline.MessageProcessingContext; 34 35 40 public class RespURISynclet 41 implements OutputMessageProcessor { 42 44 public static final String PARAM_SESSION_ID = "sid"; 45 46 48 private static final Logger log = Sync4jLogger.getLogger(Sync4jLoggerName.ENGINE); 49 50 52 53 55 public void postProcessMessage(MessageProcessingContext processingContext, 56 SyncML message ) 57 throws Sync4jException { 58 Configuration config = Configuration.getConfiguration(); 59 60 String sessionId = 61 (String )processingContext.getProperty(processingContext.PROPERTY_SESSIONID); 62 63 if (sessionId == null) { 64 if (log.isLoggable(Level.INFO)) { 65 log.info(processingContext.PROPERTY_SESSIONID + " is null! Synclet ignored"); 66 } 67 return; 68 } 69 70 String serverUri = 71 config.getStringValue(ConfigurationConstants.CFG_SERVER_URI); 72 73 message.getSyncHdr().setRespURI( 74 serverUri + 75 '?' + 76 PARAM_SESSION_ID + 77 '=' + 78 sessionId 79 ); 80 } 81 } | Popular Tags |