dimanche 15 mai 2016

sending a put request returns http error 400 using jersey

I am trying to send a PUT request from the client to the server in Ember.js (using model.save() on ember which generates a put request) whenever I put the model inside:

@PUT
@Secured
@Path("/{id}")
public void update(@Context SecurityContext sc, @PathParam("id") String id, Model model){
    System.out.println("here");
}

the model Pojo class:

@JsonTypeInfo(include=As.WRAPPER_OBJECT, use=Id.NAME)
@JsonTypeName(value = "model")
public class Model extends AnotherModel{

}

whenever the model is inside the update method the client receives HTTP error 400 and the "here" message isn't getting printed into the console. when I put a comment on the model on the update method "here" message is being printed to the console.

the class AnotherModel contains alot of fields here is a json that is being generated in the client:

{"model":{"name":"snapshothour","is_renameable":true,"memory_size":1073741824,"memory_used":1468006,"has_memory_limitation":true,"min_memory_size":1,"max_memory_size":1000000,"max_cluster_memory_size":20,"type":"redis","status":"active","version":"3.0.5","eviction_policy":"volatile-lru","dataset_init":"greenfield","private_endpoint":"","public_endpoint":"redis-14556.nadavcluster:14556","backup_status":"","backup_failure_reason":"","backup_progress":-1,"import_status":"idle","import_failure_reason":"","import_progress":-1,"export_status":null,"export_failure_reason":null,"export_progress":null,"data_persistence":"snapshot-1h","has_persistence":true,"replication":true,"is_replica_source":false,"sync_enabled":false,"activated_on":"2016-04-17T09:33:25Z","last_changed_time":"2016-04-28T07:51:27Z","cloud_name":"AWS","plan_size":0,"plan_max_connections":10,"plan_cloud":"AWS/eu-west-1","plan_name":"Standard PAYG","backup_storage_type":"","backup_path":null,"backup_interval":null,"last_backup_time":null,"has_backup":false,"sharding":false,"is_sharding_supported":true,"authentications":[{"id":"40007269","ssl":true,"authentication_ssl_client_cert":"-----BEGIN CERTIFICATE-----\r\nMIIDbzCCAlegAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MRUwEwYDVQQDDAw0Ljcu\r\nMy4xLjUtMjcxGjAYBgNVBAUTETE0NjE4MjQwMzc5OTAtMzM2MRYwFAYDVQQKDA1H\r\nYXJhbnRpYSBEYXRhMS4wLAYDVQQLDCVTU0wgQ2xpZW50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ATE-----","authentication_ssl_client_cert_fp":"2F:4F:76:47:08:AD:F7:0E:66:09:18:B7:0B:F5:35:0B:00:1D:C5:F9","authentication_redis_pass":"","authentication_sasl_uname":null,"authentication_sasl_pass":null,"authentication_pseudo_key":null,"bdb":"40007269","authenticationSecurityGroups":[{"account_id":"","security_group_name":"","authentication":"40007269"}],"authenticationSips":[{"id":"114310","ip":"154.51.60.0/24","authentication":"40007269"},{"id":"114308","ip":"154.50.60.1","authentication":"40007269"}]}],"subscription":"21500","bdbBackups":[],"bdbAlerts":[{"id":"40007269","bdb_high_latency":false,"bdb_high_latency_threshold":0,"bdb_high_throughput":true,"bdb_high_throughput_threshold":1000,"bdb_low_throughput":true,"bdb_low_throughput_threshold":10,"bdb_size":true,"bdb_size_threshold":80,"bdb_high_syncer_lag":false,"bdb_high_syncer_lag_threshold":0,"bdb_syncer_unable_to_sync":false,"bdb_connection_limit":true,"bdb_connection_limit_threshold":80,"bdb":"40007269"}],"shardKeyRegexs":[]}}

Thanks for the assist




Aucun commentaire:

Enregistrer un commentaire