From 469d04425415264b484312af41e94113e6ee4cd4 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Tue, 17 Jun 2014 14:07:07 +0100 Subject: [PATCH] KEYCLOAK-532 --- .../services/resources/admin/RealmsAdminResource.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/services/src/main/java/org/keycloak/services/resources/admin/RealmsAdminResource.java b/services/src/main/java/org/keycloak/services/resources/admin/RealmsAdminResource.java index 9e888a04f0..7600c871af 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/RealmsAdminResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/RealmsAdminResource.java @@ -21,6 +21,7 @@ import org.keycloak.services.managers.RealmManager; import org.keycloak.services.managers.TokenManager; import org.keycloak.services.resources.KeycloakApplication; import org.keycloak.services.resources.flows.Flows; +import org.keycloak.util.JsonSerialization; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -167,10 +168,8 @@ public class RealmsAdminResource { List inputParts = uploadForm.get("file"); for (InputPart inputPart : inputParts) { - inputPart.setMediaType(MediaType.APPLICATION_JSON_TYPE); - RealmRepresentation rep = inputPart.getBody(new GenericType() { - }); - + // 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 = JsonSerialization.readValue(inputPart.getBodyAsString(), RealmRepresentation.class); RealmModel realm; try { realm = realmManager.importRealm(rep);