Merge pull request #469 from stianst/master

KEYCLOAK-532
This commit is contained in:
Stian Thorgersen 2014-06-17 14:07:26 +01:00
commit b31b54e17c

View file

@ -21,6 +21,7 @@ import org.keycloak.services.managers.RealmManager;
import org.keycloak.services.managers.TokenManager; import org.keycloak.services.managers.TokenManager;
import org.keycloak.services.resources.KeycloakApplication; import org.keycloak.services.resources.KeycloakApplication;
import org.keycloak.services.resources.flows.Flows; import org.keycloak.services.resources.flows.Flows;
import org.keycloak.util.JsonSerialization;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.GET; import javax.ws.rs.GET;
@ -167,10 +168,8 @@ public class RealmsAdminResource {
List<InputPart> inputParts = uploadForm.get("file"); List<InputPart> inputParts = uploadForm.get("file");
for (InputPart inputPart : inputParts) { for (InputPart inputPart : inputParts) {
inputPart.setMediaType(MediaType.APPLICATION_JSON_TYPE); // inputPart.getBody doesn't work as content-type is wrong, and inputPart.setMediaType is not supported on AS7 (RestEasy 2.3.2.Final)
RealmRepresentation rep = inputPart.getBody(new GenericType<RealmRepresentation>() { RealmRepresentation rep = JsonSerialization.readValue(inputPart.getBodyAsString(), RealmRepresentation.class);
});
RealmModel realm; RealmModel realm;
try { try {
realm = realmManager.importRealm(rep); realm = realmManager.importRealm(rep);