headers.setObjectForKey(Boolean.TRUE, InstantMessengerAdaptor.IS_IM_KEY); headers.setObjectForKey(_buddyName, InstantMessengerAdaptor.BUDDY_NAME_KEY); headers.setObjectForKey(_message, InstantMessengerAdaptor.MESSAGE_KEY); headers.setObjectForKey(conversation, InstantMessengerAdaptor.CONVERSATION_KEY); WORequest request = myApplication.createRequest("GET", uri.toString(), "HTTP/1.0", headers, null, null);
NSMutableDictionary userInfo = new NSMutableDictionary(); userInfo.setObjectForKey(Boolean.TRUE, InstantMessengerAdaptor.IS_IM_KEY); userInfo.setObjectForKey(_buddyName, InstantMessengerAdaptor.BUDDY_NAME_KEY); userInfo.setObjectForKey(_message, InstantMessengerAdaptor.MESSAGE_KEY); userInfo.setObjectForKey(conversation, InstantMessengerAdaptor.CONVERSATION_KEY);  WORequest request = myApplication.createRequest("GET", uri.toString(), "HTTP/1.0", headers, null, userInfo);
  public synchronized void messageReceived(IInstantMessenger _instantMessenger, String _buddyName, String _message) {    Conversation conversation;    synchronized (myConversations) {      conversation = (Conversation) myConversations.get(_buddyName);      if (conversation == null || conversation.isExpired(myConversationTimeout)) {        conversation = new Conversation();        conversation.setBuddyName(_buddyName);        myConversations.put(_buddyName, conversation);      }      else {        conversation.ping();      }    }    StringBuffer uri = new StringBuffer();    String requestUrl = conversation.getRequestUrl();    if (requestUrl == null) {      String webserverConnectUrl = myApplication.webserverConnectURL();      WODynamicURL imConversationUrl = new WODynamicURL();      imConversationUrl.setRequestHandlerKey(myApplication.directActionRequestHandlerKey());      imConversationUrl.setPrefix(myApplication.applicationBaseURL());      imConversationUrl.setApplicationName(myApplication.name());      imConversationUrl.setApplicationNumber(myApplication.number());      imConversationUrl.setRequestHandlerPath(myConversationActionName);      uri.append(imConversationUrl.toString());    }    else {      uri.append(requestUrl);    }    uri.append("?");    uri.append(InstantMessengerAdaptor.BUDDY_NAME_KEY);    uri.append("=");    uri.append(WOURLEncoder.encode(_buddyName));    uri.append("&");    uri.append(InstantMessengerAdaptor.MESSAGE_KEY);    uri.append("=");    uri.append(WOURLEncoder.encode(_message));    String sessionID = conversation.getSessionID();    if (sessionID != null) {      uri.append("&wosid=" + sessionID);    }    NSMutableDictionary headers = new NSMutableDictionary();    headers.setObjectForKey(Boolean.TRUE, InstantMessengerAdaptor.IS_IM_KEY);    headers.setObjectForKey(_buddyName, InstantMessengerAdaptor.BUDDY_NAME_KEY);    headers.setObjectForKey(_message, InstantMessengerAdaptor.MESSAGE_KEY);    headers.setObjectForKey(conversation, InstantMessengerAdaptor.CONVERSATION_KEY);    WORequest request = myApplication.createRequest("GET", uri.toString(), "HTTP/1.0", headers, null, null);    WOResponse response;    try {      response = myApplication.dispatchRequest(request);      String newSessionID = request.sessionID();      if (newSessionID != null) {        conversation.setSessionID(newSessionID);      }      String nextRequestUrl = response.headerForKey(InstantMessengerAdaptor.IM_ACTION_URL_KEY);      conversation.setRequestUrl(nextRequestUrl);      String responseMessage = response.contentString();      if (responseMessage != null) {        responseMessage = responseMessage.trim();      }      myInstantMessenger.sendMessage(_buddyName, responseMessage);    }    catch (Throwable t) {      NSLog.err.appendln(toString() + " Exception occurred while responding to client: " + t.toString());      if (NSLog.debugLoggingAllowedForLevelAndGroups(2, 0L)) {        NSLog.debug.appendln(t);      }    }    NSDelayedCallbackCenter.defaultCenter().eventEnded();  }