List of usage examples for io.vertx.core.http HttpHeaders APPLICATION_X_WWW_FORM_URLENCODED
CharSequence APPLICATION_X_WWW_FORM_URLENCODED
To view the source code for io.vertx.core.http HttpHeaders APPLICATION_X_WWW_FORM_URLENCODED.
Click Source Link
From source file:org.eclipse.hono.service.registration.RegistrationHttpEndpoint.java
License:Open Source License
@Override public void addRoutes(final Router router) { final String pathWithTenant = String.format("/%s/:%s", RegistrationConstants.REGISTRATION_ENDPOINT, PARAM_TENANT_ID);/* w w w .j a v a2 s. co m*/ // ADD device registration router.route(HttpMethod.POST, pathWithTenant).consumes(HttpEndpointUtils.CONTENT_TYPE_JSON) .handler(this::doRegisterDeviceJson); router.route(HttpMethod.POST, pathWithTenant) .consumes(HttpHeaders.APPLICATION_X_WWW_FORM_URLENCODED.toString()) .handler(this::doRegisterDeviceForm); router.route(HttpMethod.POST, pathWithTenant).handler( ctx -> HttpEndpointUtils.badRequest(ctx.response(), "missing or unsupported content-type")); final String pathWithTenantAndDeviceId = String.format("/%s/:%s/:%s", RegistrationConstants.REGISTRATION_ENDPOINT, PARAM_TENANT_ID, PARAM_DEVICE_ID); // GET device registration router.route(HttpMethod.GET, pathWithTenantAndDeviceId).handler(this::doGetDevice); // UPDATE existing registration router.route(HttpMethod.PUT, pathWithTenantAndDeviceId).consumes(HttpEndpointUtils.CONTENT_TYPE_JSON) .handler(this::doUpdateRegistrationJson); router.route(HttpMethod.PUT, pathWithTenantAndDeviceId) .consumes(HttpHeaders.APPLICATION_X_WWW_FORM_URLENCODED.toString()) .handler(this::doUpdateRegistrationForm); router.route(HttpMethod.PUT, pathWithTenantAndDeviceId).handler( ctx -> HttpEndpointUtils.badRequest(ctx.response(), "missing or unsupported content-type")); // REMOVE registration router.route(HttpMethod.DELETE, pathWithTenantAndDeviceId).handler(this::doUnregisterDevice); }