curl --user abc@xyz.com:testing --form file=@Testing.csv <URL>/data
HTTP/1.1 500 Server Error
the response is comingnew BasicNameValuePair("file", "")
and obviously the content over the server gets replaced with Empty data.200 Ok
, but its again giving me 2 thoughts:httpPost.setEntity(new StringEntity("a, b, c, d", "UTF-8"));
new StringEntity("file=@Testing.csv")
Anayonkar Shivalkar wrote:
1) ColWithData has two fields - col and data. The col field will contain a field name of TableClass field and data will contain the actual data. Now, how do you manage to link these two things? I mean, if your code has 50 TableClass object, how would you map which ColWithData object contains data for which TableClass object? Maybe you are maintaining the list of ColWithData inside TableClass.
2) Why to do duplication of ALL data? I mean, if TableClass is having 10 fields, then you'll have 11th field - which is a list of ColWithData, and it will again contain 10 member, right? Basically, you are duplicating all the data just for the sake of hashCode and equals method.
3) What if value of a field in TableClass changes? Are you also going to do similar modification in cwdList? This way, you'll degrade your code performance, plus the code would be difficult to maintain (and note that by duplicating the data, you've already increased the memory footprint of your code).
4) What if a field in TableClass cannot be expressed in String format? e.g. if TableClass contains a DB connection, what would be data field in corresponding ColWithData object?
Frankly, I would follow the simple approach:
1) Whenever a field is added/removed, make corresponding changes in hashCode/equals method (just like your original code where you were considering 4 fields).
2) Or, obtain types and data of all fields via reflection - this way you'll never have to change your code even if you add/remove the field of TableClass.