This piece of code is giving me trouble:
On the client side (using Angular 2)
saveConfig(configType: ConfigTypes, gasConfigModel: GasConfigModel): any {
console.info("sending post request");
let headers = new Headers({
'Content-Type': 'application/json'
});
....
return this.http
.post(this.url, formParamString, ??, {headers: headers})
.map(res => res.json())
.subscribe(
data => {
console.info("next: ");
console.info(data)
},
err => console.error(err)
);
}
Meanwhile, on the server side:
@Path("/SaveConfig")
@POST
@Consumes(MediaType.APPLICATION_JSON + ";charset=utf-8")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void saveConfig(MyObj my object, CountryGasStationConfig countryGasStationConfig) throws Exception {....}
I am familiar with sending one object in a post request, but how can I send two objects in a post request?