}
// Filter the list of available resources so that only launch-able resources are available
List<Resource> filteredResources = new ArrayList<Resource>();
for(Iterator resourceIterator = ResourceUtil.getGrantedResource(agent.getSession(), resourceType).iterator(); resourceIterator.hasNext(); ) {
Resource resource = (Resource)resourceIterator.next();
if(resource.getLaunchRequirement() == LaunchRequirement.LAUNCHABLE ||
( resource.getLaunchRequirement() == LaunchRequirement.REQUIRES_WEB_SESSION && agent.getSession().getHttpSession() != null)) {
filteredResources.add(resource);
}
}
// Send the list of resource IDs and names back to the agent
ByteArrayWriter response = new ByteArrayWriter();
response.writeInt(filteredResources.size());
for (Resource resource : filteredResources) {
response.writeInt(resource.getResourceId());
response.writeString(resource.getResourceDisplayName());
}
request.setRequestData(response.toByteArray());
return true;
}
} catch (Exception e) {