O'Reilly logo

JXTA in a Nutshell by Li Gong, Bernard Traversat, Scott Oaks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Advertisements

Let’s look now at some JXTA advertisements. Advertisements are central to JXTA; you discover JXTA peers and their resources by looking for advertisements, and you provide your own services by publishing advertisements. Therefore, working with advertisements and the documents they contain is the next step we must take in learning how to develop JXTA applications.

Advertisements are represented by the abstract Advertisement class (net.jxta.document.Advertisement). Each advertisement has a unique type, which is returned by the getAdvertisementType( ) method. The JXTA API defines the following core advertisement types (each of which is an abstract class in the net.jxta.protocol package):

  • PeerAdvertisement

  • PeerGroupAdvertisement

  • PipeAdvertisement

  • PeerInfoAdvertisement

  • EndpointAdvertisement

  • ModuleClassAdvertisement , ModuleSpecAdvertisement, and ModuleImplAdver-tisement (module-related advertisements)

  • RdvAdvertisement

  • TransportAdvertisement

Each advertisement object holds an object that implements the Document interface (net.jxta.document.Document) and represents the advertisement. An advertisement is typically represented as an XML document, and the JXTA protocol specification relies heavily on XML advertisements. The getDocument( ) method of the Advertisement class returns a representation of the advertisement in different formats based on its MimeMediaType argument. Typical MIME types are “text/xml” or “text/plain” (which, in fact, are the only ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required