Permalink
Browse files

Merge pull request #23 from ideoplex/work

Update Content-Type
  • Loading branch information...
2 parents 6c3509c + 478457d commit e7bfbd4837a02d451a93bff640639be7b7028972 @ideoplex committed Oct 31, 2015
Showing with 6 additions and 5 deletions.
  1. +2 −0 README.md
  2. +0 −1 src/main/java/com/ideoplex/tutorial/GsonWriter.java
  3. +4 −4 src/main/webapp/index.html
View
@@ -32,7 +32,9 @@ mvn test -Dbrowser=chrome
Read about the project (from most recent to oldest):
+1. [jersey-gson Content-Type Woes](https://ideoplex.com/2015/10/31/jersey-gson-content-type-woes/)
1. [Autostart Jetty in Maven](https://ideoplex.com/2015/10/25/autostart-jetty-in-maven/)
+1. [DataTables, Bootstrap and Text Overflow](https://ideoplex.com/2015/08/16/datatables-bootstrap-and-text-overflow/)
1. [DataTables edit Locally](https://ideoplex.com/2015/07/12/datatables-edit-locally/)
1. [jQuery Ajax and Selenium](https://ideoplex.com/2015/06/21/jquery-ajax-and-selenium/)
1. [DataTables and Selenium](https://ideoplex.com/2015/06/14/datatables-and-selenium/)
@@ -42,7 +42,6 @@ public void writeTo(T t, Class<?> type, Type genericType,
MultivaluedMap<String, Object> httpHeaders,
OutputStream entityStream)
throws IOException, WebApplicationException {
- httpHeaders.get("Content-Type").add("charset=UTF-8");
entityStream.write(gson.toJson(t).getBytes("UTF-8"));
}
@@ -134,13 +134,13 @@ <h4 class="modal-title">Add User</h4>
type: "POST",
url: "webapi/myresource/user/post",
data: JSON.stringify(json),
- contentType: "application/json; charset=utf-8",
+ contentType: "application/json",
error: function(xhr,status,error) {
bootbox.alert(xhr.responseText);
},
success: function(data,status,xhr){
form[0].reset();
- $('#users').DataTable().row.add(JSON.parse(data)).draw(false);
+ $('#users').DataTable().row.add(data).draw(false);
}
});
}
@@ -151,14 +151,14 @@ <h4 class="modal-title">Add User</h4>
type: "POST",
url: "webapi/myresource/user/edit",
data: JSON.stringify(json),
- contentType: "application/json; charset=utf-8",
+ contentType: "application/json",
error: function(xhr,status,error) {
bootbox.alert(xhr.responseText);
$('#users tbody tr.selected').removeClass('selected');
},
success: function(data,status,xhr){
form[0].reset();
- $('#users').DataTable().row('.selected').data(JSON.parse(data)).draw(false);
+ $('#users').DataTable().row('.selected').data(data).draw(false);
$('#users tbody tr.selected').removeClass('selected');
}
});

0 comments on commit e7bfbd4

Please sign in to comment.