ONOS-6980 Adding support for download of application bits.

Change-Id: I742950690b50038cac0bb2ad2da4eaac5781da85
diff --git a/web/api/src/main/java/org/onosproject/rest/resources/ApplicationsWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/ApplicationsWebResource.java
index 3a4eb5c..4a71ffd 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/ApplicationsWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/ApplicationsWebResource.java
@@ -208,6 +208,23 @@
     }
 
     /**
+     * Get application OAR/JAR file.
+     * Returns the OAR/JAR file used to install the specified application.
+     *
+     * @param name application name
+     * @return 200 OK; 404; 401
+     */
+    @GET
+    @Produces(MediaType.APPLICATION_OCTET_STREAM)
+    @Path("{name}/bits")
+    public Response getAppBits(@PathParam("name") String name) {
+        ApplicationAdminService service = get(ApplicationAdminService.class);
+        ApplicationId appId = nullIsNotFound(service.getId(name), APP_ID_NOT_FOUND);
+        InputStream bits = service.getApplicationArchive(appId);
+        return ok(bits).build();
+    }
+
+    /**
      * Gets applicationId entry by either id or name.
      *
      * @param id   id of application