Search in sources :

Example 1 with NotifyRequest

use of org.cybergarage.upnp.event.NotifyRequest in project felix by apache.

the class MyCtrlPoint method httpRequestRecieved.

public synchronized void httpRequestRecieved(HTTPRequest httpReq) {
    Activator.logger.DEBUG("[Importer] httpRequestRecieved event");
    Activator.logger.PACKET(httpReq.toString());
    if (httpReq.isNotifyRequest() == true) {
        Activator.logger.DEBUG("[Importer] Notify Request");
        NotifyRequest notifyReq = new NotifyRequest(httpReq);
        String uuid = notifyReq.getSID();
        long seq = notifyReq.getSEQ();
        PropertyList props = notifyReq.getPropertyList();
        // int propCnt = props.size();
        // Hashtable hash = new Hashtable();
        // for (int n = 0; n < propCnt; n++) {
        // Property prop = props.getProperty(n);
        // String varName = prop.getName();
        // String varValue = prop.getValue();
        // hash.put(varName, varValue);
        // }
        newEventArrived(uuid, seq, props);
        httpReq.returnOK();
        return;
    }
    Activator.logger.DEBUG("BAD Request");
    httpReq.returnBadRequest();
}
Also used : PropertyList(org.cybergarage.upnp.event.PropertyList) NotifyRequest(org.cybergarage.upnp.event.NotifyRequest)

Example 2 with NotifyRequest

use of org.cybergarage.upnp.event.NotifyRequest in project i2p.i2p by i2p.

the class Service method notify.

private boolean notify(Subscriber sub, StateVariable stateVar) {
    String varName = stateVar.getName();
    String value = stateVar.getValue();
    String host = sub.getDeliveryHost();
    int port = sub.getDeliveryPort();
    NotifyRequest notifyReq = new NotifyRequest();
    notifyReq.setRequest(sub, varName, value);
    HTTPResponse res = notifyReq.post(host, port);
    if (res.isSuccessful() == false)
        return false;
    sub.incrementNotifyCount();
    return true;
}
Also used : HTTPResponse(org.cybergarage.http.HTTPResponse) NotifyRequest(org.cybergarage.upnp.event.NotifyRequest) SSDPNotifyRequest(org.cybergarage.upnp.ssdp.SSDPNotifyRequest)

Example 3 with NotifyRequest

use of org.cybergarage.upnp.event.NotifyRequest in project i2p.i2p by i2p.

the class ControlPoint method httpRequestRecieved.

public void httpRequestRecieved(HTTPRequest httpReq) {
    if (Debug.isOn() == true)
        httpReq.print();
    // Thanks for Giordano Sassaroli <sassarol@cefriel.it> (09/08/03)
    if (httpReq.isNotifyRequest() == true) {
        NotifyRequest notifyReq = new NotifyRequest(httpReq);
        String uuid = notifyReq.getSID();
        long seq = notifyReq.getSEQ();
        PropertyList props = notifyReq.getPropertyList();
        int propCnt = props.size();
        for (int n = 0; n < propCnt; n++) {
            Property prop = props.getProperty(n);
            String varName = prop.getName();
            String varValue = prop.getValue();
            performEventListener(uuid, seq, varName, varValue);
        }
        httpReq.returnOK();
        return;
    }
    httpReq.returnBadRequest();
}
Also used : PropertyList(org.cybergarage.upnp.event.PropertyList) NotifyRequest(org.cybergarage.upnp.event.NotifyRequest) Property(org.cybergarage.upnp.event.Property)

Aggregations

NotifyRequest (org.cybergarage.upnp.event.NotifyRequest)3 PropertyList (org.cybergarage.upnp.event.PropertyList)2 HTTPResponse (org.cybergarage.http.HTTPResponse)1 Property (org.cybergarage.upnp.event.Property)1 SSDPNotifyRequest (org.cybergarage.upnp.ssdp.SSDPNotifyRequest)1