}
// the request can either be for a ServiceURL or a ServiceType
Object reqService;
boolean fullurl = false;
if (attreq.url.indexOf("//") == -1) {
reqService = new ServiceType(attreq.url);
} else {
fullurl = true;
reqService = new ServiceURL(attreq.url, 0);
}
// if spi is sent, the request must be for a full url and
// the tag list has to be empty
if (attreq.spi.equals("")
|| (fullurl && attreq.tagList.isEmpty())) {
for (Iterator srvs = services.iterator(); srvs.hasNext();) {
Service service = (Service) srvs.next();
if (service.url.matches(reqService)) {
attResult.addAll(SLPUtils.findMatches(
attreq.tagList, service.attributes));
}
}
}
}
reply = new AttributeReply(attreq, attResult);
if (SLPCore.CONFIG.getSecurityEnabled()) {
((AttributeReply) reply).sign(attreq.spi);
}
return reply;
case SLPMessage.SRVTYPERQST:
ServiceTypeRequest streq = (ServiceTypeRequest) msg;
ArrayList result = new ArrayList();
// iterate over scopes
for (Iterator scopeIter = streq.scopeList.iterator(); scopeIter
.hasNext();) {
// iterate over the registered services
String scope = (String) scopeIter.next();
List services = ((List) registeredServices
.get(scope.toLowerCase()));
if (services == null) {
continue;
}
for (Iterator iter = services.iterator(); iter.hasNext();) {
Service service = (Service) iter.next();
ServiceType type = service.url.getServiceType();
if (streq.namingAuthority.equals("*")
|| streq.namingAuthority.equals("")
|| type.getNamingAuthority().equals(
streq.namingAuthority)) {
if (!result.contains(type)) {
result.add(type);
}
}