Azure CDN libraries for Java

Overview

Cache static web content at strategically placed locations to provide maximum throughput for users with Azure Content Delivery Network (CDN).

To get started with Azure CDN, see Getting started with Azure CDN.

Management API

Create CDN profiles, define endpoints, and add content to the CDN using the management API.

Add a dependency to your Maven pom.xml file to use the management API in your project.

<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-mgmt-cdn</artifactId>
    <version>1.3.0</version>
</dependency>

Example

Create a CDN profile, assign endpoints, and load content into the CDN.

CdnProfile profile = azure.cdnProfiles().define("testCDN")
        .withRegion(Region.US_EAST)
        .withNewResourceGroup()
        .withStandardVerizonSku()
        .withNewEndpoint("webAppHostname1")
        .withNewEndpoint("webAppHostname2")
        .create();

List<String> contentList = new ArrayList<String>();
contentList.add("/client.js");
contentList.add("/media/fabrikam_logo.png");

for (CdnEndpoint endpoint : profile.endpoints().values()) {
    endpoint.loadContent(contentList);
}

Samples

Manage CDNs with Java