blob: 398bfee0e23e01b2c9c9e886c09690666cb76682 [file] [log] [blame]
Thomas Vachuska530e52a2015-05-06 19:51:32 -07001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.ui.impl;
17
18import com.sun.jersey.multipart.FormDataParam;
19import org.onlab.rest.BaseResource;
20import org.onosproject.app.ApplicationAdminService;
Thomas Vachuska530e52a2015-05-06 19:51:32 -070021
22import javax.ws.rs.Consumes;
23import javax.ws.rs.POST;
24import javax.ws.rs.Path;
25import javax.ws.rs.core.MediaType;
26import javax.ws.rs.core.Response;
27import java.io.IOException;
28import java.io.InputStream;
29
30/**
31 * Application upload resource.
32 */
33@Path("applications")
34public class ApplicationResource extends BaseResource {
35
36 @Path("upload")
37 @POST
38 @Consumes(MediaType.MULTIPART_FORM_DATA)
39 public Response upload(@FormDataParam("file") InputStream stream) throws IOException {
Bri Prebilic Cole522e7562015-06-22 15:56:25 -070040 get(ApplicationAdminService.class).install(stream);
41 return Response.ok().build();
Thomas Vachuska530e52a2015-05-06 19:51:32 -070042 }
43
44}