diff --git a/hawkbit-system-resource/src/main/java/org/eclipse/hawkbit/system/rest/resource/SystemManagementResource.java b/hawkbit-system-resource/src/main/java/org/eclipse/hawkbit/system/rest/resource/SystemManagementResource.java index 074cf444d..6ea27d9ce 100644 --- a/hawkbit-system-resource/src/main/java/org/eclipse/hawkbit/system/rest/resource/SystemManagementResource.java +++ b/hawkbit-system-resource/src/main/java/org/eclipse/hawkbit/system/rest/resource/SystemManagementResource.java @@ -29,6 +29,7 @@ import org.springframework.cache.CacheManager; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; /** @@ -54,7 +55,7 @@ public class SystemManagementResource implements SystemManagementRestApi { * @return HttpStatus.OK */ @Override - public ResponseEntity deleteTenant(final String tenant) { + public ResponseEntity deleteTenant(@PathVariable("tenant") final String tenant) { systemManagement.deleteTenant(tenant); return new ResponseEntity<>(HttpStatus.OK); } diff --git a/hawkbit-system-resource/src/main/java/org/eclipse/hawkbit/system/rest/resource/SystemResource.java b/hawkbit-system-resource/src/main/java/org/eclipse/hawkbit/system/rest/resource/SystemResource.java index ca9b84df4..4333cfefb 100644 --- a/hawkbit-system-resource/src/main/java/org/eclipse/hawkbit/system/rest/resource/SystemResource.java +++ b/hawkbit-system-resource/src/main/java/org/eclipse/hawkbit/system/rest/resource/SystemResource.java @@ -25,6 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.hateoas.ResourceSupport; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; /** @@ -68,7 +70,7 @@ public class SystemResource implements SystemRestApi { * the response. */ @Override - public ResponseEntity deleteConfigurationValue(final String keyName) { + public ResponseEntity deleteConfigurationValue(@PathVariable("keyName") final String keyName) { final TenantConfigurationKey configKey = TenantConfigurationKey.fromKeyName(keyName); @@ -89,7 +91,8 @@ public class SystemResource implements SystemRestApi { * response. */ @Override - public ResponseEntity getConfigurationValue(final String keyName) { + public ResponseEntity getConfigurationValue( + @PathVariable("keyName") final String keyName) { final TenantConfigurationKey configKey = TenantConfigurationKey.fromKeyName(keyName); @@ -111,8 +114,9 @@ public class SystemResource implements SystemRestApi { * response. */ @Override - public ResponseEntity updateConfigurationValue(final String keyName, - final SystemTenantConfigurationValueRequest configurationValueRest) { + public ResponseEntity updateConfigurationValue( + @PathVariable("keyName") final String keyName, + @RequestBody final SystemTenantConfigurationValueRequest configurationValueRest) { final TenantConfigurationKey configKey = TenantConfigurationKey.fromKeyName(keyName); diff --git a/hawkbit-system-resource/src/test/java/org/eclipse/hawkbit/system/rest/resource/SystemResourceTest.java b/hawkbit-system-resource/src/test/java/org/eclipse/hawkbit/system/rest/resource/SystemResourceTest.java index 8458153ea..3dc9613e2 100644 --- a/hawkbit-system-resource/src/test/java/org/eclipse/hawkbit/system/rest/resource/SystemResourceTest.java +++ b/hawkbit-system-resource/src/test/java/org/eclipse/hawkbit/system/rest/resource/SystemResourceTest.java @@ -78,7 +78,7 @@ public class SystemResourceTest extends AbstractIntegrationTest { final TenantConfigurationKey key = TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME; final String testValue = "12:12:12"; - mvc.perform(put(SystemRestConstant.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}", key.getKeyName()) + mvc.perform(put(SystemRestConstant.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}/", key.getKeyName()) .content(String.format(BASE_JSON_REQUEST_STRING, testValue)).contentType(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());