Thomas Vachuska | 530e52a | 2015-05-06 19:51:32 -0700 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.ui.impl; |
| 17 | |
| 18 | import com.sun.jersey.multipart.FormDataParam; |
| 19 | import org.onlab.rest.BaseResource; |
| 20 | import org.onosproject.app.ApplicationAdminService; |
Thomas Vachuska | 530e52a | 2015-05-06 19:51:32 -0700 | [diff] [blame] | 21 | |
| 22 | import javax.ws.rs.Consumes; |
| 23 | import javax.ws.rs.POST; |
| 24 | import javax.ws.rs.Path; |
| 25 | import javax.ws.rs.core.MediaType; |
| 26 | import javax.ws.rs.core.Response; |
| 27 | import java.io.IOException; |
| 28 | import java.io.InputStream; |
| 29 | |
| 30 | /** |
| 31 | * Application upload resource. |
| 32 | */ |
| 33 | @Path("applications") |
| 34 | public 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 Cole | 522e756 | 2015-06-22 15:56:25 -0700 | [diff] [blame] | 40 | get(ApplicationAdminService.class).install(stream); |
| 41 | return Response.ok().build(); |
Thomas Vachuska | 530e52a | 2015-05-06 19:51:32 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | } |