components/src/test/java/eu/internetofus/common/components/GetSetContext.java
/**
   * Create a handler to store a value.
   *
   * @param prefix to apply to the identifier.
   * @param params name of the path elements with the identifiers.
   *
   * @return the handler to set a value.
   */
Create a handler to store a value.
@param prefix to apply to the identifier.
@param params name of the path elements with the identifiers.

@return the handler to set a value.
Create a handler to store a value . @param prefix to apply to the identifier . @param params name of the path elements with the identifiers . @return the handler to set a value .
public Handler<RoutingContext> createSetHandler(final String prefix, final String... params) {
    return ctx -> {
      final var response = ctx.response();
      try {
        final var id = this.getIdFrom(ctx, prefix, params);
        final var body = ctx.getBody();
        final var value = (ClusterSerializable) Json.decodeValue(body);
        this.values.put(id, value);
        response.setStatusCode(Status.CREATED.getStatusCode());
        response.end(this.toBuffer(value));
      } catch (final Throwable t) {
        response.setStatusCode(Status.BAD_REQUEST.getStatusCode());
        response.end(new ErrorMessage("bad_value", "Does not exist a valid value on the body.").toBuffer());
      }
    };
  }
public Handler < RoutingContext > createSetHandler ( final String prefix , final String ... params ) { return ctx -> { final var response = ctx . response ( ) ; try { final var id = this . getIdFrom ( ctx , prefix , params ) ; final var body = ctx . getBody ( ) ; final var value = ( ClusterSerializable ) Json . decodeValue ( body ) ; this . values . put ( id , value ) ; response . setStatusCode ( Status . CREATED . getStatusCode ( ) ) ; response . end ( this . toBuffer ( value ) ) ; } catch ( final Throwable t ) { response . setStatusCode ( Status . BAD_REQUEST . getStatusCode ( ) ) ; response . end ( new ErrorMessage ( "bad_value" , "Does not exist a valid value on the body." ) . toBuffer ( ) ) ; } } ; }
Create a handler to store a value.
Create a handler to store a value .