org.fourthline.cling.model.message.header.UpnpHeader Java Examples

The following examples show how to use org.fourthline.cling.model.message.header.UpnpHeader. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: DroidDLNA   Author: offbye   File: ProtocolFactoryImpl.java    License: GNU General Public License v3.0 6 votes vote down vote up
protected boolean isSupportedServiceAdvertisement(IncomingDatagramMessage message) {
    ServiceType[] exclusiveServiceTypes = getUpnpService().getConfiguration().getExclusiveServiceTypes();
    if (exclusiveServiceTypes == null) return false; // Discovery is disabled
    if (exclusiveServiceTypes.length == 0) return true; // Any advertisement is fine

    String usnHeader = message.getHeaders().getFirstHeader(UpnpHeader.Type.USN.getHttpName());
    if (usnHeader == null) return false; // Not a service advertisement, drop it

    try {
        NamedServiceType nst = NamedServiceType.valueOf(usnHeader);
        for (ServiceType exclusiveServiceType : exclusiveServiceTypes) {
            if (nst.getServiceType().implementsVersion(exclusiveServiceType))
                return true;
        }
    } catch (InvalidValueException ex) {
        log.finest("Not a named service type header value: " + usnHeader);
    }
    log.fine("Service advertisement not supported, dropping it: " + usnHeader);
    return false;
}
 
Example #2
Source Project: DroidDLNA   Author: offbye   File: OutgoingRenewalRequestMessage.java    License: GNU General Public License v3.0 6 votes vote down vote up
public OutgoingRenewalRequestMessage(RemoteGENASubscription subscription,
                                     UpnpHeaders extraHeaders) {

    super(UpnpRequest.Method.SUBSCRIBE, subscription.getEventSubscriptionURL());

    getHeaders().add(
            UpnpHeader.Type.SID,
            new SubscriptionIdHeader(subscription.getSubscriptionId())
    );

    getHeaders().add(
            UpnpHeader.Type.TIMEOUT,
            new TimeoutHeader(subscription.getRequestedDurationSeconds())
    );

    if (extraHeaders != null)
        getHeaders().putAll(extraHeaders);
}
 
Example #3
Source Project: DroidDLNA   Author: offbye   File: OutgoingNotificationRequest.java    License: GNU General Public License v3.0 6 votes vote down vote up
protected OutgoingNotificationRequest(Location location, LocalDevice device, NotificationSubtype type) {
    super(
            new UpnpRequest(UpnpRequest.Method.NOTIFY),
            ModelUtil.getInetAddressByName(Constants.IPV4_UPNP_MULTICAST_GROUP),
            Constants.UPNP_MULTICAST_PORT
    );

    this.type = type;

    getHeaders().add(UpnpHeader.Type.MAX_AGE, new MaxAgeHeader(device.getIdentity().getMaxAgeSeconds()));
    getHeaders().add(UpnpHeader.Type.LOCATION, new LocationHeader(location.getURL()));

    getHeaders().add(UpnpHeader.Type.SERVER, new ServerHeader());
    getHeaders().add(UpnpHeader.Type.HOST, new HostHeader());
    getHeaders().add(UpnpHeader.Type.NTS, new NTSHeader(type));
}
 
Example #4
Source Project: TVRemoteIME   Author: kingthy   File: IncomingActionRequestMessage.java    License: GNU General Public License v2.0 6 votes vote down vote up
public IncomingActionRequestMessage(StreamRequestMessage source,
                                    LocalService service) throws ActionException {
    super(source);

    SoapActionHeader soapActionHeader = getHeaders().getFirstHeader(UpnpHeader.Type.SOAPACTION, SoapActionHeader.class);
    if (soapActionHeader == null) {
        throw new ActionException(ErrorCode.INVALID_ACTION, "Missing SOAP action header");
    }

    SoapActionType actionType = soapActionHeader.getValue();

    this.action = service.getAction(actionType.getActionName());
    if (this.action == null) {
        throw new ActionException(ErrorCode.INVALID_ACTION, "Service doesn't implement action: " + actionType.getActionName());
    }

    if (!QueryStateVariableAction.ACTION_NAME.equals(actionType.getActionName())) {
        if (!service.getServiceType().implementsVersion(actionType.getServiceType())) {
            throw new ActionException(ErrorCode.INVALID_ACTION, "Service doesn't support the requested service version");
        }
    }

    this.actionNamespace = actionType.getTypeString();
}
 
Example #5
Source Project: TVRemoteIME   Author: kingthy   File: IncomingSearchResponse.java    License: GNU General Public License v2.0 6 votes vote down vote up
public UDN getRootDeviceUDN() {
    // This processes the headers as specified in UDA 1.0, tables in section 1.1.12

    UpnpHeader<UDN> udnHeader = getHeaders().getFirstHeader(UpnpHeader.Type.USN, USNRootDeviceHeader.class);
    if (udnHeader != null) return udnHeader.getValue();

    udnHeader = getHeaders().getFirstHeader(UpnpHeader.Type.USN, UDNHeader.class);
    if (udnHeader != null) return udnHeader.getValue();

    UpnpHeader<NamedDeviceType> deviceTypeHeader = getHeaders().getFirstHeader(UpnpHeader.Type.USN, DeviceUSNHeader.class);
    if (deviceTypeHeader != null) return deviceTypeHeader.getValue().getUdn();

    UpnpHeader<NamedServiceType> serviceTypeHeader = getHeaders().getFirstHeader(UpnpHeader.Type.USN, ServiceUSNHeader.class);
    if (serviceTypeHeader != null) return serviceTypeHeader.getValue().getUdn();

    return null;
}
 
Example #6
Source Project: DroidDLNA   Author: offbye   File: IncomingActionRequestMessage.java    License: GNU General Public License v3.0 6 votes vote down vote up
public IncomingActionRequestMessage(StreamRequestMessage source,
                                    LocalService service) throws ActionException {
    super(source);

    SoapActionHeader soapActionHeader = getHeaders().getFirstHeader(UpnpHeader.Type.SOAPACTION, SoapActionHeader.class);
    if (soapActionHeader == null) {
        throw new ActionException(ErrorCode.INVALID_ACTION, "Missing SOAP action header");
    }

    SoapActionType actionType = soapActionHeader.getValue();

    this.action = service.getAction(actionType.getActionName());
    if (this.action == null) {
        throw new ActionException(ErrorCode.INVALID_ACTION, "Service doesn't implement action: " + actionType.getActionName());
    }

    if (!QueryStateVariableAction.ACTION_NAME.equals(actionType.getActionName())) {
        if (!service.getServiceType().implementsVersion(actionType.getServiceType())) {
            throw new ActionException(ErrorCode.INVALID_ACTION, "Service doesn't support the requested service version");
        }
    }

    this.actionNamespace = actionType.getTypeString();
}
 
Example #7
Source Project: DroidDLNA   Author: offbye   File: StreamClientImpl.java    License: GNU General Public License v3.0 6 votes vote down vote up
protected void applyRequestHeaders() {
    // Headers
    UpnpHeaders headers = getRequestMessage().getHeaders();
    if (log.isLoggable(Level.FINE))
        log.fine("Writing headers on HttpContentExchange: " + headers.size());
    // TODO Always add the Host header
    // TODO: ? setRequestHeader(UpnpHeader.Type.HOST.getHttpName(), );
    // Add the default user agent if not already set on the message
    if (!headers.containsKey(UpnpHeader.Type.USER_AGENT)) {
        setRequestHeader(
            UpnpHeader.Type.USER_AGENT.getHttpName(),
            getConfiguration().getUserAgentValue(
                getRequestMessage().getUdaMajorVersion(),
                getRequestMessage().getUdaMinorVersion())
        );
    }
    for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
        for (String v : entry.getValue()) {
            String headerName = entry.getKey();
            if (log.isLoggable(Level.FINE))
                log.fine("Setting header '" + headerName + "': " + v);
            addRequestHeader(headerName, v);
        }
    }
}
 
Example #8
Source Project: TVRemoteIME   Author: kingthy   File: OutgoingSearchResponse.java    License: GNU General Public License v2.0 6 votes vote down vote up
public OutgoingSearchResponse(IncomingDatagramMessage request,
                              Location location,
                              LocalDevice device) {

    super(new UpnpResponse(UpnpResponse.Status.OK), request.getSourceAddress(), request.getSourcePort());

    getHeaders().add(UpnpHeader.Type.MAX_AGE, new MaxAgeHeader(device.getIdentity().getMaxAgeSeconds()));
    getHeaders().add(UpnpHeader.Type.LOCATION, new LocationHeader(location.getURL()));
    getHeaders().add(UpnpHeader.Type.SERVER, new ServerHeader());
    getHeaders().add(UpnpHeader.Type.EXT, new EXTHeader());

    if (location.getNetworkAddress().getHardwareAddress() != null) {
        getHeaders().add(
                UpnpHeader.Type.EXT_IFACE_MAC,
                 new InterfaceMacHeader(location.getNetworkAddress().getHardwareAddress())
        );
    }
}
 
Example #9
Source Project: TVRemoteIME   Author: kingthy   File: StreamClientImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
protected void applyRequestHeaders() {
    // Headers
    UpnpHeaders headers = getRequestMessage().getHeaders();
    if (log.isLoggable(Level.FINE))
        log.fine("Writing headers on HttpContentExchange: " + headers.size());
    // TODO Always add the Host header
    // TODO: ? setRequestHeader(UpnpHeader.Type.HOST.getHttpName(), );
    // Add the default user agent if not already set on the message
    if (!headers.containsKey(UpnpHeader.Type.USER_AGENT)) {
        setRequestHeader(
            UpnpHeader.Type.USER_AGENT.getHttpName(),
            getConfiguration().getUserAgentValue(
                getRequestMessage().getUdaMajorVersion(),
                getRequestMessage().getUdaMinorVersion())
        );
    }
    for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
        for (String v : entry.getValue()) {
            String headerName = entry.getKey();
            if (log.isLoggable(Level.FINE))
                log.fine("Setting header '" + headerName + "': " + v);
            addRequestHeader(headerName, v);
        }
    }
}
 
Example #10
Source Project: DroidDLNA   Author: offbye   File: IncomingNotificationRequest.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * @return The UDN value after parsing various USN header values, or <code>null</code>.
 */
public UDN getUDN() {
    // This processes the headers as specified in UDA 1.0, tables in section 1.1.12

    UpnpHeader<UDN> udnHeader = getHeaders().getFirstHeader(UpnpHeader.Type.USN, USNRootDeviceHeader.class);
    if (udnHeader != null) return udnHeader.getValue();

    udnHeader = getHeaders().getFirstHeader(UpnpHeader.Type.USN, UDNHeader.class);
    if (udnHeader != null) return udnHeader.getValue();

    UpnpHeader<NamedDeviceType> deviceTypeHeader = getHeaders().getFirstHeader(UpnpHeader.Type.USN, DeviceUSNHeader.class);
    if (deviceTypeHeader != null) return deviceTypeHeader.getValue().getUdn();

    UpnpHeader<NamedServiceType> serviceTypeHeader = getHeaders().getFirstHeader(UpnpHeader.Type.USN, ServiceUSNHeader.class);
    if (serviceTypeHeader != null) return serviceTypeHeader.getValue().getUdn();

    return null;
}
 
Example #11
Source Project: portmapper   Author: kaklakariada   File: ClingRouterFactory.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
protected List<IRouter> findRoutersInternal() throws RouterException {
    final UpnpServiceConfiguration config = new DefaultUpnpServiceConfiguration();
    final ClingRegistryListener clingRegistryListener = new ClingRegistryListener();
    final UpnpService upnpService = new UpnpServiceImpl(config, clingRegistryListener);
    shutdownServiceOnExit(upnpService);

    final UpnpHeader<?> searchType = new UDADeviceTypeHeader(ClingRegistryListener.IGD_DEVICE_TYPE);
    log.info("Start searching {} for device type {}", DISCOVERY_TIMEOUT, searchType);
    upnpService.getControlPoint().search(searchType, (int) DISCOVERY_TIMEOUT.toSeconds());
    return clingRegistryListener
            .waitForServiceFound(DISCOVERY_TIMEOUT) //
            .map(service -> (RemoteService) service)
            .map(service -> createRouter(service, upnpService)) //
            .collect(toList());
}
 
Example #12
Source Project: DroidDLNA   Author: offbye   File: StreamClientImpl.java    License: GNU General Public License v3.0 6 votes vote down vote up
protected HttpParams getRequestParams(StreamRequestMessage requestMessage) {
    HttpParams localParams = new BasicHttpParams();

    localParams.setParameter(
        CoreProtocolPNames.PROTOCOL_VERSION,
        requestMessage.getOperation().getHttpMinorVersion() == 0 ? HttpVersion.HTTP_1_0 : HttpVersion.HTTP_1_1
    );

    // DefaultHttpClient adds HOST header automatically in its default processor

    // Add the default user agent if not already set on the message
    if (!requestMessage.getHeaders().containsKey(UpnpHeader.Type.USER_AGENT)) {
        HttpProtocolParams.setUserAgent(
            localParams,
            getConfiguration().getUserAgentValue(requestMessage.getUdaMajorVersion(), requestMessage.getUdaMinorVersion())
        );
    }

    return new DefaultedHttpParams(localParams, globalParams);
}
 
Example #13
Source Project: TVRemoteIME   Author: kingthy   File: StreamClientImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
protected HttpParams getRequestParams(StreamRequestMessage requestMessage) {
    HttpParams localParams = new BasicHttpParams();

    localParams.setParameter(
        CoreProtocolPNames.PROTOCOL_VERSION,
        requestMessage.getOperation().getHttpMinorVersion() == 0 ? HttpVersion.HTTP_1_0 : HttpVersion.HTTP_1_1
    );

    // DefaultHttpClient adds HOST header automatically in its default processor

    // Add the default user agent if not already set on the message
    if (!requestMessage.getHeaders().containsKey(UpnpHeader.Type.USER_AGENT)) {
        HttpProtocolParams.setUserAgent(
            localParams,
            getConfiguration().getUserAgentValue(requestMessage.getUdaMajorVersion(), requestMessage.getUdaMinorVersion())
        );
    }

    return new DefaultedHttpParams(localParams, globalParams);
}
 
Example #14
Source Project: TVRemoteIME   Author: kingthy   File: OutgoingEventRequestMessage.java    License: GNU General Public License v2.0 6 votes vote down vote up
public OutgoingEventRequestMessage(GENASubscription subscription,
                                   URL callbackURL,
                                   UnsignedIntegerFourBytes sequence,
                                   Collection<StateVariableValue> values) {

    super(new UpnpRequest(UpnpRequest.Method.NOTIFY, callbackURL));

    getHeaders().add(UpnpHeader.Type.CONTENT_TYPE, new ContentTypeHeader());
    getHeaders().add(UpnpHeader.Type.NT, new NTEventHeader());
    getHeaders().add(UpnpHeader.Type.NTS, new NTSHeader(NotificationSubtype.PROPCHANGE));
    getHeaders().add(UpnpHeader.Type.SID, new SubscriptionIdHeader(subscription.getSubscriptionId()));

    // Important! Pass by value so that we can safely increment it afterwards and before this is send!
    getHeaders().add(UpnpHeader.Type.SEQ, new EventSequenceHeader(sequence.getValue()));

    this.stateVariableValues = values;
}
 
Example #15
Source Project: TVRemoteIME   Author: kingthy   File: DLNAHeaders.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public void log() {
    if (log.isLoggable(Level.FINE)) {
        super.log();
        if (parsedDLNAHeaders != null && parsedDLNAHeaders.size() > 0) {
            log.fine("########################## PARSED DLNA HEADERS ##########################");
            for (Map.Entry<DLNAHeader.Type, List<UpnpHeader>> entry : parsedDLNAHeaders.entrySet()) {
                log.log(Level.FINE, "=== TYPE: {0}", entry.getKey());
                for (UpnpHeader upnpHeader : entry.getValue()) {
                    log.log(Level.FINE, "HEADER: {0}", upnpHeader);
                }
            }
        }
        log.fine("####################################################################");
    }
}
 
Example #16
Source Project: DroidDLNA   Author: offbye   File: OutgoingSearchResponse.java    License: GNU General Public License v3.0 6 votes vote down vote up
public OutgoingSearchResponse(IncomingDatagramMessage request,
                              Location location,
                              LocalDevice device) {

    super(new UpnpResponse(UpnpResponse.Status.OK), request.getSourceAddress(), request.getSourcePort());

    getHeaders().add(UpnpHeader.Type.MAX_AGE, new MaxAgeHeader(device.getIdentity().getMaxAgeSeconds()));
    getHeaders().add(UpnpHeader.Type.LOCATION, new LocationHeader(location.getURL()));
    getHeaders().add(UpnpHeader.Type.SERVER, new ServerHeader());
    getHeaders().add(UpnpHeader.Type.EXT, new EXTHeader());

    if (location.getNetworkAddress().getHardwareAddress() != null) {
        getHeaders().add(
                UpnpHeader.Type.EXT_IFACE_MAC,
                 new InterfaceMacHeader(location.getNetworkAddress().getHardwareAddress())
        );
    }
}
 
Example #17
Source Project: DroidDLNA   Author: offbye   File: DLNAHeaders.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void parseHeaders() {
    if (parsedHeaders == null) super.parseHeaders();
    
    // This runs as late as possible and only when necessary (getter called and map is dirty)
    parsedDLNAHeaders = new LinkedHashMap();
    log.log(Level.FINE, "Parsing all HTTP headers for known UPnP headers: {0}", size());
    for (Entry<String, List<String>> entry : entrySet()) {

        if (entry.getKey() == null) continue; // Oh yes, the JDK has 'null' HTTP headers

        DLNAHeader.Type type = DLNAHeader.Type.getByHttpName(entry.getKey());
        if (type == null) {
            log.log(Level.FINE, "Ignoring non-UPNP HTTP header: {0}", entry.getKey());
            continue;
        }

        for (String value : entry.getValue()) {
            UpnpHeader upnpHeader = DLNAHeader.newInstance(type, value);
            if (upnpHeader == null || upnpHeader.getValue() == null) {
                log.log(Level.FINE, "Ignoring known but non-parsable header (value violates the UDA specification?) '{0}': {1}", new Object[]{type.getHttpName(), value});
            } else {
                addParsedValue(type, upnpHeader);
            }
        }
    }
}
 
Example #18
Source Project: DroidDLNA   Author: offbye   File: IncomingNotificationRequest.java    License: GNU General Public License v3.0 5 votes vote down vote up
public byte[] getInterfaceMacHeader() {
    InterfaceMacHeader header = getHeaders().getFirstHeader(UpnpHeader.Type.EXT_IFACE_MAC, InterfaceMacHeader.class);
    if (header != null) {
        return header.getValue();
    }
    return null;
}
 
Example #19
Source Project: TVRemoteIME   Author: kingthy   File: SendingSearch.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param mxSeconds The time in seconds a host should wait before responding.
 */
public SendingSearch(UpnpService upnpService, UpnpHeader searchTarget, int mxSeconds) {
    super(upnpService);

    if (!UpnpHeader.Type.ST.isValidHeaderType(searchTarget.getClass())) {
        throw new IllegalArgumentException(
                "Given search target instance is not a valid header class for type ST: " + searchTarget.getClass()
        );
    }
    this.searchTarget = searchTarget;
    this.mxSeconds = mxSeconds;
}
 
Example #20
Source Project: TVRemoteIME   Author: kingthy   File: IncomingSearchRequest.java    License: GNU General Public License v2.0 5 votes vote down vote up
public Integer getMX() {
    MXHeader header = getHeaders().getFirstHeader(UpnpHeader.Type.MX, MXHeader.class);
    if (header != null) {
        return header.getValue();
    }
    return null;
}
 
Example #21
Source Project: DroidDLNA   Author: offbye   File: SendingSearch.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * @param mxSeconds The time in seconds a host should wait before responding.
 */
public SendingSearch(UpnpService upnpService, UpnpHeader searchTarget, int mxSeconds) {
    super(upnpService);

    if (!UpnpHeader.Type.ST.isValidHeaderType(searchTarget.getClass())) {
        throw new IllegalArgumentException(
                "Given search target instance is not a valid header class for type ST: " + searchTarget.getClass()
        );
    }
    this.searchTarget = searchTarget;
    this.mxSeconds = mxSeconds;
}
 
Example #22
Source Project: TVRemoteIME   Author: kingthy   File: IncomingSearchResponse.java    License: GNU General Public License v2.0 5 votes vote down vote up
public URL getLocationURL() {
    LocationHeader header = getHeaders().getFirstHeader(UpnpHeader.Type.LOCATION, LocationHeader.class);
    if (header != null) {
        return header.getValue();
    }
    return null;
}
 
Example #23
Source Project: TVRemoteIME   Author: kingthy   File: IncomingSearchResponse.java    License: GNU General Public License v2.0 5 votes vote down vote up
public Integer getMaxAge() {
    MaxAgeHeader header = getHeaders().getFirstHeader(UpnpHeader.Type.MAX_AGE, MaxAgeHeader.class);
    if (header != null) {
        return header.getValue();
    }
    return null;
}
 
Example #24
Source Project: TVRemoteIME   Author: kingthy   File: IncomingSearchResponse.java    License: GNU General Public License v2.0 5 votes vote down vote up
public byte[] getInterfaceMacHeader() {
    InterfaceMacHeader header = getHeaders().getFirstHeader(UpnpHeader.Type.EXT_IFACE_MAC, InterfaceMacHeader.class);
    if (header != null) {
        return header.getValue();
    }
    return null;
}
 
Example #25
Source Project: TVRemoteIME   Author: kingthy   File: OutgoingSearchResponseRootDevice.java    License: GNU General Public License v2.0 5 votes vote down vote up
public OutgoingSearchResponseRootDevice(IncomingDatagramMessage request,
                                        Location location,
                                        LocalDevice device) {
    super(request, location, device);

    getHeaders().add(UpnpHeader.Type.ST, new RootDeviceHeader());
    getHeaders().add(UpnpHeader.Type.USN, new USNRootDeviceHeader(device.getIdentity().getUdn()));
}
 
Example #26
Source Project: TVRemoteIME   Author: kingthy   File: IncomingNotificationRequest.java    License: GNU General Public License v2.0 5 votes vote down vote up
public URL getLocationURL() {
    LocationHeader header = getHeaders().getFirstHeader(UpnpHeader.Type.LOCATION, LocationHeader.class);
    if (header != null) {
        return header.getValue();
    }
    return null;
}
 
Example #27
Source Project: DroidDLNA   Author: offbye   File: IncomingEventRequestMessage.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * @return <code>true</code> if this message has an NT header, and NTS header
 *         with value {@link org.fourthline.cling.model.types.NotificationSubtype#PROPCHANGE}.
 */
public boolean hasValidNotificationHeaders() {
    NTEventHeader ntHeader = getHeaders().getFirstHeader(UpnpHeader.Type.NT, NTEventHeader.class);
    NTSHeader ntsHeader = getHeaders().getFirstHeader(UpnpHeader.Type.NTS, NTSHeader.class);
    return ntHeader != null && ntHeader.getValue() != null
            && ntsHeader != null && ntsHeader.getValue().equals(NotificationSubtype.PROPCHANGE);

}
 
Example #28
Source Project: TVRemoteIME   Author: kingthy   File: IncomingNotificationRequest.java    License: GNU General Public License v2.0 5 votes vote down vote up
public Integer getMaxAge() {
    MaxAgeHeader header = getHeaders().getFirstHeader(UpnpHeader.Type.MAX_AGE, MaxAgeHeader.class);
    if (header != null) {
        return header.getValue();
    }
    return null;
}
 
Example #29
Source Project: TVRemoteIME   Author: kingthy   File: OutgoingSearchResponseDeviceType.java    License: GNU General Public License v2.0 5 votes vote down vote up
public OutgoingSearchResponseDeviceType(IncomingDatagramMessage request,
                                        Location location,
                                        LocalDevice device) {
    super(request, location, device);

    getHeaders().add(UpnpHeader.Type.ST, new DeviceTypeHeader(device.getType()));
    getHeaders().add(UpnpHeader.Type.USN, new DeviceUSNHeader(device.getIdentity().getUdn(), device.getType()));
}
 
Example #30
Source Project: DroidDLNA   Author: offbye   File: IncomingEventRequestMessage.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * @return <code>true</code> if this message as an NT and NTS header.
 */
public boolean hasNotificationHeaders() {
    UpnpHeader ntHeader = getHeaders().getFirstHeader(UpnpHeader.Type.NT);
    UpnpHeader ntsHeader = getHeaders().getFirstHeader(UpnpHeader.Type.NTS);
    return ntHeader != null && ntHeader.getValue() != null
            && ntsHeader != null && ntsHeader.getValue() != null;
}