@Override public String toString() { return getUdn().toString() + "::" + getServiceType().toString(); }
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; }
@Override public String toString() { return getUdn().toString() + "::" + getServiceType().toString(); }
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; }
@Override public String toString() { return getUdn().toString() + "::" + getServiceType().toString(); }
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; }