Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 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 | */ |
Jonathan Hart | 9bb32ab | 2015-05-05 18:17:31 -0700 | [diff] [blame] | 16 | package org.onosproject.rest.resources; |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 17 | |
alshabib | 20a070b | 2016-06-03 14:44:05 -0700 | [diff] [blame] | 18 | import com.fasterxml.jackson.databind.node.ObjectNode; |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 19 | import org.onosproject.app.ApplicationAdminService; |
Ray Milkey | 1657032 | 2018-04-17 10:26:54 -0700 | [diff] [blame] | 20 | import org.onosproject.app.ApplicationException; |
Charles Chan | 416ef14 | 2020-08-10 16:34:32 -0700 | [diff] [blame] | 21 | import org.onosproject.cluster.ComponentsMonitorService; |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 22 | import org.onosproject.core.Application; |
| 23 | import org.onosproject.core.ApplicationId; |
Jian Li | e1c1c8d | 2016-05-09 16:24:40 -0700 | [diff] [blame] | 24 | import org.onosproject.core.CoreService; |
Jonathan Hart | 9bb32ab | 2015-05-05 18:17:31 -0700 | [diff] [blame] | 25 | import org.onosproject.rest.AbstractWebResource; |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 26 | |
| 27 | import javax.ws.rs.Consumes; |
| 28 | import javax.ws.rs.DELETE; |
Thomas Vachuska | 62ad95f | 2015-02-18 12:11:36 -0800 | [diff] [blame] | 29 | import javax.ws.rs.DefaultValue; |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 30 | import javax.ws.rs.GET; |
| 31 | import javax.ws.rs.POST; |
| 32 | import javax.ws.rs.Path; |
| 33 | import javax.ws.rs.PathParam; |
| 34 | import javax.ws.rs.Produces; |
Thomas Vachuska | 62ad95f | 2015-02-18 12:11:36 -0800 | [diff] [blame] | 35 | import javax.ws.rs.QueryParam; |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 36 | import javax.ws.rs.core.MediaType; |
| 37 | import javax.ws.rs.core.Response; |
alshabib | 20a070b | 2016-06-03 14:44:05 -0700 | [diff] [blame] | 38 | import java.io.IOException; |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 39 | import java.io.InputStream; |
alshabib | 20a070b | 2016-06-03 14:44:05 -0700 | [diff] [blame] | 40 | import java.net.URL; |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 41 | import java.util.Set; |
Andrea Campanella | 3657519 | 2021-10-25 12:33:01 +0200 | [diff] [blame^] | 42 | import org.slf4j.Logger; |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 43 | |
Andrea Campanella | 3657519 | 2021-10-25 12:33:01 +0200 | [diff] [blame^] | 44 | import static org.slf4j.LoggerFactory.getLogger; |
Jian Li | cbf4989 | 2016-05-10 14:54:44 -0700 | [diff] [blame] | 45 | import static org.onlab.util.Tools.nullIsNotFound; |
Ray Milkey | 86ee5e8 | 2018-04-02 15:33:07 -0700 | [diff] [blame] | 46 | import static org.onlab.util.Tools.readTreeFromStream; |
Jian Li | cbf4989 | 2016-05-10 14:54:44 -0700 | [diff] [blame] | 47 | |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 48 | /** |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 49 | * Manage inventory of applications. |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 50 | */ |
| 51 | @Path("applications") |
| 52 | public class ApplicationsWebResource extends AbstractWebResource { |
| 53 | |
Andrea Campanella | 3657519 | 2021-10-25 12:33:01 +0200 | [diff] [blame^] | 54 | private static final Logger log = getLogger(ApplicationsWebResource.class); |
| 55 | |
| 56 | |
Jian Li | cbf4989 | 2016-05-10 14:54:44 -0700 | [diff] [blame] | 57 | private static final String APP_ID_NOT_FOUND = "Application ID is not found"; |
| 58 | private static final String APP_NOT_FOUND = "Application is not found"; |
Charles Chan | 416ef14 | 2020-08-10 16:34:32 -0700 | [diff] [blame] | 59 | private static final String APP_READY = "ready"; |
| 60 | private static final String APP_PENDING = "pending"; |
Jian Li | cbf4989 | 2016-05-10 14:54:44 -0700 | [diff] [blame] | 61 | |
alshabib | 20a070b | 2016-06-03 14:44:05 -0700 | [diff] [blame] | 62 | private static final String URL = "url"; |
| 63 | private static final String ACTIVATE = "activate"; |
| 64 | |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 65 | /** |
| 66 | * Get all installed applications. |
| 67 | * Returns array of all installed applications. |
| 68 | * |
| 69 | * @return 200 OK |
Jian Li | e1c1c8d | 2016-05-09 16:24:40 -0700 | [diff] [blame] | 70 | * @onos.rsModel Applications |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 71 | */ |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 72 | @GET |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 73 | public Response getApps() { |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 74 | ApplicationAdminService service = get(ApplicationAdminService.class); |
| 75 | Set<Application> apps = service.getApplications(); |
| 76 | return ok(encodeArray(Application.class, "applications", apps)).build(); |
| 77 | } |
| 78 | |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 79 | /** |
| 80 | * Get application details. |
| 81 | * Returns details of the specified application. |
Jian Li | e1c1c8d | 2016-05-09 16:24:40 -0700 | [diff] [blame] | 82 | * |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 83 | * @param name application name |
| 84 | * @return 200 OK; 404; 401 |
Jian Li | e1c1c8d | 2016-05-09 16:24:40 -0700 | [diff] [blame] | 85 | * @onos.rsModel Application |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 86 | */ |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 87 | @GET |
| 88 | @Path("{name}") |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 89 | public Response getApp(@PathParam("name") String name) { |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 90 | ApplicationAdminService service = get(ApplicationAdminService.class); |
Andrea Campanella | 3657519 | 2021-10-25 12:33:01 +0200 | [diff] [blame^] | 91 | ApplicationId appId = nullIsNotFound(service.getId(name), APP_NOT_FOUND + ":" + name); |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 92 | return response(service, appId); |
| 93 | } |
| 94 | |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 95 | /** |
Charles Chan | 416ef14 | 2020-08-10 16:34:32 -0700 | [diff] [blame] | 96 | * Get application health. |
| 97 | * |
| 98 | * @param name application name |
| 99 | * @return 200 OK with app health in the body; 404 if app is not found |
| 100 | */ |
| 101 | @GET |
| 102 | @Path("{name}/health") |
| 103 | public Response health(@PathParam("name") String name) { |
| 104 | ApplicationAdminService service = get(ApplicationAdminService.class); |
Andrea Campanella | 3657519 | 2021-10-25 12:33:01 +0200 | [diff] [blame^] | 105 | ApplicationId appId = service.getId(name); |
| 106 | nullIsNotFound(appId, APP_ID_NOT_FOUND + ": " + name); |
| 107 | |
| 108 | Application app = service.getApplication(appId); |
| 109 | nullIsNotFound(app, APP_NOT_FOUND + ": " + appId); |
Charles Chan | 416ef14 | 2020-08-10 16:34:32 -0700 | [diff] [blame] | 110 | |
| 111 | ComponentsMonitorService componentsMonitorService = get(ComponentsMonitorService.class); |
Andrea Campanella | 3657519 | 2021-10-25 12:33:01 +0200 | [diff] [blame^] | 112 | boolean ready = componentsMonitorService.isFullyStarted(app.features()); |
Charles Chan | 416ef14 | 2020-08-10 16:34:32 -0700 | [diff] [blame] | 113 | return Response.ok(mapper().createObjectNode().put("message", ready ? APP_READY : APP_PENDING)).build(); |
| 114 | } |
| 115 | |
| 116 | /** |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 117 | * Install a new application. |
| 118 | * Uploads application archive stream and optionally activates the |
| 119 | * application. |
alshabib | 20a070b | 2016-06-03 14:44:05 -0700 | [diff] [blame] | 120 | |
| 121 | * @param raw json object containing location (url) of application oar |
| 122 | * @return 200 OK; 404; 401 |
| 123 | */ |
| 124 | @POST |
| 125 | @Consumes(MediaType.APPLICATION_JSON) |
| 126 | @Produces(MediaType.APPLICATION_JSON) |
| 127 | public Response installApp(InputStream raw) { |
| 128 | Application app; |
| 129 | try { |
Ray Milkey | 86ee5e8 | 2018-04-02 15:33:07 -0700 | [diff] [blame] | 130 | ObjectNode jsonTree = readTreeFromStream(mapper(), raw); |
alshabib | 20a070b | 2016-06-03 14:44:05 -0700 | [diff] [blame] | 131 | URL url = new URL(jsonTree.get(URL).asText()); |
| 132 | boolean activate = false; |
| 133 | if (jsonTree.has(ACTIVATE)) { |
| 134 | activate = jsonTree.get(ACTIVATE).asBoolean(); |
| 135 | } |
| 136 | |
| 137 | ApplicationAdminService service = get(ApplicationAdminService.class); |
| 138 | app = service.install(url.openStream()); |
| 139 | if (activate) { |
| 140 | service.activate(app.id()); |
| 141 | } |
| 142 | } catch (IOException ex) { |
| 143 | throw new IllegalArgumentException(ex); |
| 144 | } |
| 145 | return ok(codec(Application.class).encode(app, this)).build(); |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * Install a new application. |
| 150 | * Uploads application archive stream and optionally activates the |
| 151 | * application. |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 152 | * |
| 153 | * @param activate true to activate app also |
| 154 | * @param stream application archive stream |
| 155 | * @return 200 OK; 404; 401 |
| 156 | */ |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 157 | @POST |
| 158 | @Consumes(MediaType.APPLICATION_OCTET_STREAM) |
| 159 | @Produces(MediaType.APPLICATION_JSON) |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 160 | public Response installApp(@QueryParam("activate") |
| 161 | @DefaultValue("false") boolean activate, |
| 162 | InputStream stream) { |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 163 | ApplicationAdminService service = get(ApplicationAdminService.class); |
Ray Milkey | 1657032 | 2018-04-17 10:26:54 -0700 | [diff] [blame] | 164 | try { |
| 165 | Application app = service.install(stream); |
| 166 | if (activate) { |
| 167 | service.activate(app.id()); |
| 168 | } |
| 169 | return ok(codec(Application.class).encode(app, this)).build(); |
| 170 | } catch (ApplicationException appEx) { |
| 171 | throw new IllegalArgumentException(appEx); |
Thomas Vachuska | 62ad95f | 2015-02-18 12:11:36 -0800 | [diff] [blame] | 172 | } |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 173 | } |
| 174 | |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 175 | /** |
| 176 | * Uninstall application. |
| 177 | * Uninstalls the specified application deactivating it first if necessary. |
| 178 | * |
| 179 | * @param name application name |
Jian Li | c2a542b | 2016-05-10 11:48:19 -0700 | [diff] [blame] | 180 | * @return 204 NO CONTENT |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 181 | */ |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 182 | @DELETE |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 183 | @Path("{name}") |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 184 | public Response uninstallApp(@PathParam("name") String name) { |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 185 | ApplicationAdminService service = get(ApplicationAdminService.class); |
| 186 | ApplicationId appId = service.getId(name); |
dvaddire | e113b65 | 2017-08-04 14:58:06 +0530 | [diff] [blame] | 187 | if (appId != null) { |
| 188 | service.uninstall(appId); |
| 189 | } |
Jian Li | c2a542b | 2016-05-10 11:48:19 -0700 | [diff] [blame] | 190 | return Response.noContent().build(); |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 191 | } |
| 192 | |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 193 | /** |
| 194 | * Activate application. |
| 195 | * Activates the specified application. |
| 196 | * |
| 197 | * @param name application name |
| 198 | * @return 200 OK; 404; 401 |
| 199 | */ |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 200 | @POST |
| 201 | @Produces(MediaType.APPLICATION_JSON) |
| 202 | @Path("{name}/active") |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 203 | public Response activateApp(@PathParam("name") String name) { |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 204 | ApplicationAdminService service = get(ApplicationAdminService.class); |
Andrea Campanella | 3657519 | 2021-10-25 12:33:01 +0200 | [diff] [blame^] | 205 | ApplicationId appId = nullIsNotFound(service.getId(name), APP_NOT_FOUND + ": " + name); |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 206 | service.activate(appId); |
| 207 | return response(service, appId); |
| 208 | } |
| 209 | |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 210 | /** |
| 211 | * De-activate application. |
| 212 | * De-activates the specified application. |
| 213 | * |
| 214 | * @param name application name |
dvaddire | e113b65 | 2017-08-04 14:58:06 +0530 | [diff] [blame] | 215 | * @return 204 NO CONTENT |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 216 | */ |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 217 | @DELETE |
| 218 | @Produces(MediaType.APPLICATION_JSON) |
| 219 | @Path("{name}/active") |
Thomas Vachuska | 0fa2aa1 | 2015-08-18 12:53:04 -0700 | [diff] [blame] | 220 | public Response deactivateApp(@PathParam("name") String name) { |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 221 | ApplicationAdminService service = get(ApplicationAdminService.class); |
| 222 | ApplicationId appId = service.getId(name); |
dvaddire | e113b65 | 2017-08-04 14:58:06 +0530 | [diff] [blame] | 223 | if (appId != null) { |
| 224 | service.deactivate(appId); |
| 225 | } |
| 226 | return Response.noContent().build(); |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 227 | } |
| 228 | |
Jian Li | e1c1c8d | 2016-05-09 16:24:40 -0700 | [diff] [blame] | 229 | /** |
| 230 | * Registers an on or off platform application. |
| 231 | * |
| 232 | * @param name application name |
| 233 | * @return 200 OK; 404; 401 |
| 234 | * @onos.rsModel ApplicationId |
| 235 | */ |
| 236 | @POST |
| 237 | @Produces(MediaType.APPLICATION_JSON) |
| 238 | @Path("{name}/register") |
| 239 | public Response registerAppId(@PathParam("name") String name) { |
| 240 | CoreService service = get(CoreService.class); |
| 241 | ApplicationId appId = service.registerApplication(name); |
| 242 | return response(appId); |
| 243 | } |
| 244 | |
| 245 | /** |
Thomas Vachuska | 08b4dec | 2017-08-31 15:20:17 -0700 | [diff] [blame] | 246 | * Get application OAR/JAR file. |
| 247 | * Returns the OAR/JAR file used to install the specified application. |
| 248 | * |
| 249 | * @param name application name |
| 250 | * @return 200 OK; 404; 401 |
| 251 | */ |
| 252 | @GET |
| 253 | @Produces(MediaType.APPLICATION_OCTET_STREAM) |
| 254 | @Path("{name}/bits") |
| 255 | public Response getAppBits(@PathParam("name") String name) { |
| 256 | ApplicationAdminService service = get(ApplicationAdminService.class); |
Andrea Campanella | 3657519 | 2021-10-25 12:33:01 +0200 | [diff] [blame^] | 257 | ApplicationId appId = nullIsNotFound(service.getId(name), APP_ID_NOT_FOUND + ": " + name); |
Thomas Vachuska | 08b4dec | 2017-08-31 15:20:17 -0700 | [diff] [blame] | 258 | InputStream bits = service.getApplicationArchive(appId); |
| 259 | return ok(bits).build(); |
| 260 | } |
| 261 | |
| 262 | /** |
Jian Li | 847242b | 2016-05-11 18:58:53 -0700 | [diff] [blame] | 263 | * Gets applicationId entry by either id or name. |
Jian Li | e1c1c8d | 2016-05-09 16:24:40 -0700 | [diff] [blame] | 264 | * |
Jian Li | 847242b | 2016-05-11 18:58:53 -0700 | [diff] [blame] | 265 | * @param id id of application |
Jian Li | e1c1c8d | 2016-05-09 16:24:40 -0700 | [diff] [blame] | 266 | * @param name name of application |
| 267 | * @return 200 OK; 404; 401 |
| 268 | * @onos.rsModel ApplicationId |
| 269 | */ |
| 270 | @GET |
| 271 | @Produces(MediaType.APPLICATION_JSON) |
Jian Li | 847242b | 2016-05-11 18:58:53 -0700 | [diff] [blame] | 272 | @Path("ids/entry") |
Jian Li | a3e4c7a | 2016-05-12 13:15:40 -0700 | [diff] [blame] | 273 | public Response getAppIdByName(@QueryParam("id") String id, |
Jian Li | 847242b | 2016-05-11 18:58:53 -0700 | [diff] [blame] | 274 | @QueryParam("name") String name) { |
Jian Li | e1c1c8d | 2016-05-09 16:24:40 -0700 | [diff] [blame] | 275 | CoreService service = get(CoreService.class); |
Jian Li | 847242b | 2016-05-11 18:58:53 -0700 | [diff] [blame] | 276 | ApplicationId appId = null; |
| 277 | if (id != null) { |
Jian Li | a3e4c7a | 2016-05-12 13:15:40 -0700 | [diff] [blame] | 278 | appId = service.getAppId(Short.valueOf(id)); |
Jian Li | 847242b | 2016-05-11 18:58:53 -0700 | [diff] [blame] | 279 | } else if (name != null) { |
| 280 | appId = service.getAppId(name); |
| 281 | } |
Jian Li | e1c1c8d | 2016-05-09 16:24:40 -0700 | [diff] [blame] | 282 | return response(appId); |
| 283 | } |
| 284 | |
| 285 | /** |
| 286 | * Gets a collection of application ids. |
| 287 | * Returns array of all registered application ids. |
| 288 | * |
| 289 | * @return 200 OK; 404; 401 |
| 290 | * @onos.rsModel ApplicationIds |
| 291 | */ |
| 292 | @GET |
| 293 | @Produces(MediaType.APPLICATION_JSON) |
| 294 | @Path("ids") |
| 295 | public Response getAppIds() { |
| 296 | CoreService service = get(CoreService.class); |
| 297 | Set<ApplicationId> appIds = service.getAppIds(); |
| 298 | return ok(encodeArray(ApplicationId.class, "applicationIds", appIds)).build(); |
| 299 | } |
| 300 | |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 301 | private Response response(ApplicationAdminService service, ApplicationId appId) { |
Andrea Campanella | 3657519 | 2021-10-25 12:33:01 +0200 | [diff] [blame^] | 302 | Application app = nullIsNotFound(service.getApplication(appId), |
| 303 | APP_NOT_FOUND + ": " + appId); |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 304 | return ok(codec(Application.class).encode(app, this)).build(); |
| 305 | } |
| 306 | |
Jian Li | e1c1c8d | 2016-05-09 16:24:40 -0700 | [diff] [blame] | 307 | private Response response(ApplicationId appId) { |
Andrea Campanella | 3657519 | 2021-10-25 12:33:01 +0200 | [diff] [blame^] | 308 | ApplicationId checkedAppId = nullIsNotFound(appId, APP_ID_NOT_FOUND + ": " + appId); |
Jian Li | cbf4989 | 2016-05-10 14:54:44 -0700 | [diff] [blame] | 309 | return ok(codec(ApplicationId.class).encode(checkedAppId, this)).build(); |
Jian Li | e1c1c8d | 2016-05-09 16:24:40 -0700 | [diff] [blame] | 310 | } |
Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 311 | } |