Package org.cipango.kaleo.presence

Examples of org.cipango.kaleo.presence.SoftState


        if (content == null)
        {
          publish.createResponse(SipServletResponse.SC_BAD_REQUEST).send();
          return;
        }
        SoftState state = presentity.addState(contentType, content, now + expires*1000);
       
        if (_log.isDebugEnabled())
          _log.debug("added state {} to presentity {}", state.getETag(), presentity);
       
        SipServletResponse response = publish.createResponse(SipServletResponse.SC_OK);
        response.setExpires(expires);
        response.setHeader(Constants.SIP_ETAG, state.getETag());
        response.send();
      }
      else
      {
        SoftState state = presentity.getState(etag);
        if (state == null)
        {
          publish.createResponse(SipServletResponse.SC_CONDITIONAL_REQUEST_FAILED).send();
          return;
        }
        if (expires == 0)
        {
          if (_log.isDebugEnabled())
            _log.debug("removed state {} from presentity {}", state.getETag(), presentity);
         
          presentity.removeState(etag);
        }
        else
        {
          if (content != null)
          {
            presentity.modifyState(state, contentType, content, now + expires*1000);
           
            if (_log.isDebugEnabled())
              _log.debug("modified state {} (new etag {}) from presentity {}",
                  new Object[] {etag, state.getETag(), presentity});
          }
          else
          {
            presentity.refreshState(state, now + expires*1000);
            if (_log.isDebugEnabled())
              _log.debug("refreshed state {} (new etag {}) from presentity {}",
                  new Object[] {etag, state.getETag(), presentity});
          }
        }
        SipServletResponse response = publish.createResponse(SipServletResponse.SC_OK);
        response.setExpires(expires);
        response.setHeader(Constants.SIP_ETAG, state.getETag());
        response.send();
      }
    }
    finally
    {
View Full Code Here

TOP

Related Classes of org.cipango.kaleo.presence.SoftState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.