From af4016cadd7fdc0b9f37582045b3c95925635457 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 4 Feb 2024 10:42:16 -0800 Subject: [PATCH] Improve code on rest. --- .../com/wisemapping/rest/AdminController.java | 20 +++--- .../com/wisemapping/rest/LabelController.java | 10 +-- .../wisemapping/rest/MindmapController.java | 66 +++++++++---------- .../com/wisemapping/rest/UserController.java | 7 +- .../com/wisemapping/rest/model/RestLabel.java | 18 +++++ .../src/main/resources/public/static/mindplot | 1 - .../src/main/resources/public/static/webapp | 1 - 7 files changed, 68 insertions(+), 55 deletions(-) delete mode 120000 wise-api/src/main/resources/public/static/mindplot delete mode 120000 wise-api/src/main/resources/public/static/webapp diff --git a/wise-api/src/main/java/com/wisemapping/rest/AdminController.java b/wise-api/src/main/java/com/wisemapping/rest/AdminController.java index ec2638d5..10dd3a2b 100644 --- a/wise-api/src/main/java/com/wisemapping/rest/AdminController.java +++ b/wise-api/src/main/java/com/wisemapping/rest/AdminController.java @@ -33,11 +33,10 @@ import org.springframework.http.HttpStatus; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; -import java.io.IOException; import java.util.List; @RestController -@RequestMapping("/api/restfull/admin/") +@RequestMapping("/api/restfull/admin") @PreAuthorize("isAuthenticated() and hasRole('ROLE_ADMIN')") public class AdminController extends BaseController { @Qualifier("userService") @@ -48,9 +47,9 @@ public class AdminController extends BaseController { @Autowired private MindmapService mindmapService; - @RequestMapping(method = RequestMethod.GET, value = "users/{id}", produces = {"application/json"}) + @RequestMapping(method = RequestMethod.GET, value = "/users/{id}", produces = {"application/json"}) @ResponseBody - public RestUser getUserById(@PathVariable int id) throws IOException { + public RestUser getUserById(@PathVariable int id) { final User userBy = userService.getUserBy(id); if (userBy == null) { throw new IllegalArgumentException("User could not be found"); @@ -58,9 +57,9 @@ public class AdminController extends BaseController { return new RestUser(userBy); } - @RequestMapping(method = RequestMethod.GET, value = "users/email/{email:.+}", produces = {"application/json"}) + @RequestMapping(method = RequestMethod.GET, value = "/users/email/{email:.+}", produces = {"application/json"}) @ResponseBody - public RestUser getUserByEmail(@PathVariable String email) throws IOException { + public RestUser getUserByEmail(@PathVariable String email) { final User user = userService.getUserBy(email); if (user == null) { throw new IllegalArgumentException("User '" + email + "' could not be found"); @@ -68,7 +67,7 @@ public class AdminController extends BaseController { return new RestUser(user); } - @RequestMapping(method = RequestMethod.POST, value = "users", consumes = {"application/json"}, produces = {"application/json"}) + @RequestMapping(method = RequestMethod.POST, value = "/users", consumes = {"application/json"}, produces = {"application/json"}) @ResponseStatus(value = HttpStatus.CREATED) public void createUser(@RequestBody RestUser user, HttpServletResponse response) throws WiseMappingException { if (user == null) { @@ -105,9 +104,9 @@ public class AdminController extends BaseController { response.setHeader("Location", "/api/restfull/admin/users/" + user.getId()); } - @RequestMapping(method = RequestMethod.PUT, value = "users/{id}/password", consumes = {"text/plain"}) + @RequestMapping(method = RequestMethod.PUT, value = "/users/{id}/password", consumes = {"text/plain"}) @ResponseStatus(value = HttpStatus.NO_CONTENT) - public void changePassword(@RequestBody String password, @PathVariable int id) throws WiseMappingException { + public void changePassword(@RequestBody String password, @PathVariable int id) { if (password == null) { throw new IllegalArgumentException("Password can not be null"); } @@ -120,7 +119,7 @@ public class AdminController extends BaseController { userService.changePassword(user); } - @RequestMapping(method = RequestMethod.DELETE, value = "users/{id}") + @RequestMapping(method = RequestMethod.DELETE, value = "/users/{id}") @ResponseStatus(value = HttpStatus.NO_CONTENT) public void deleteUserByEmail(@PathVariable int id) throws WiseMappingException { final User user = userService.getUserBy(id); @@ -133,7 +132,6 @@ public class AdminController extends BaseController { final Mindmap mindmap = collaboration.getMindMap(); mindmapService.removeMindmap(mindmap, user); } - userService.removeUser(user); } } diff --git a/wise-api/src/main/java/com/wisemapping/rest/LabelController.java b/wise-api/src/main/java/com/wisemapping/rest/LabelController.java index e99c806e..694524f4 100644 --- a/wise-api/src/main/java/com/wisemapping/rest/LabelController.java +++ b/wise-api/src/main/java/com/wisemapping/rest/LabelController.java @@ -27,20 +27,20 @@ import com.wisemapping.rest.model.RestLabelList; import com.wisemapping.security.Utils; import com.wisemapping.service.LabelService; import com.wisemapping.validator.LabelValidator; +import jakarta.servlet.http.HttpServletResponse; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.HttpStatus; import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.stereotype.Controller; import org.springframework.validation.BeanPropertyBindingResult; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; -import jakarta.servlet.http.HttpServletResponse; import java.util.List; @RestController +@RequestMapping("/api/restfull/labels") @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") public class LabelController extends BaseController { @@ -49,7 +49,7 @@ public class LabelController extends BaseController { private LabelService labelService; - @RequestMapping(method = RequestMethod.POST, value = "/api/restfull/labels", consumes = {"application/json"}) + @RequestMapping(method = RequestMethod.POST, value = "", consumes = {"application/json"}) @ResponseStatus(value = HttpStatus.CREATED) public void createLabel(@RequestBody RestLabel restLabel, @NotNull HttpServletResponse response, @RequestParam(required = false) String title) throws WiseMappingException { // Overwrite title if it was specified by parameter. @@ -67,7 +67,7 @@ public class LabelController extends BaseController { response.setHeader("ResourceId", Long.toString(label.getId())); } - @RequestMapping(method = RequestMethod.GET, value = "/api/restfull/labels/", produces = {"application/json"}) + @RequestMapping(method = RequestMethod.GET, value = "/", produces = {"application/json"}) public RestLabelList retrieveList() { final User user = Utils.getUser(); assert user != null; @@ -75,7 +75,7 @@ public class LabelController extends BaseController { return new RestLabelList(all); } - @RequestMapping(method = RequestMethod.DELETE, value = "/api/restfull/labels/{id}") + @RequestMapping(method = RequestMethod.DELETE, value = "/{id}") @ResponseStatus(value = HttpStatus.NO_CONTENT) public void deleteLabelById(@PathVariable int id) throws WiseMappingException { final User user = Utils.getUser(); diff --git a/wise-api/src/main/java/com/wisemapping/rest/MindmapController.java b/wise-api/src/main/java/com/wisemapping/rest/MindmapController.java index 3bf17a74..13850c9c 100644 --- a/wise-api/src/main/java/com/wisemapping/rest/MindmapController.java +++ b/wise-api/src/main/java/com/wisemapping/rest/MindmapController.java @@ -35,8 +35,6 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.BeanPropertyBindingResult; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; @@ -48,7 +46,7 @@ import java.util.stream.Collectors; @RestController -//@RequestMapping("/api/restfull/labels") +@RequestMapping("/api/restfull/maps") public class MindmapController extends BaseController { private final Logger logger = LogManager.getLogger(); @@ -71,7 +69,7 @@ public class MindmapController extends BaseController { @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.GET, value = "/api/restfull/maps/{id}", produces = {"application/json"}) + @RequestMapping(method = RequestMethod.GET, value = "/{id}", produces = {"application/json"}) @ResponseBody public RestMindmap retrieve(@PathVariable int id) throws WiseMappingException { final User user = Utils.getUser(); @@ -80,7 +78,7 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.GET, value = "/api/restfull/maps/", produces = {"application/json"}) + @RequestMapping(method = RequestMethod.GET, value = "/", produces = {"application/json"}) public RestMindmapList retrieveList(@RequestParam(required = false) String q) { final User user = Utils.getUser(); @@ -94,7 +92,7 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.GET, value = "/api/restfull/maps/{id}/history/", produces = {"application/json"}) + @RequestMapping(method = RequestMethod.GET, value = "/{id}/history/", produces = {"application/json"}) public RestMindmapHistoryList fetchHistory(@PathVariable int id) { final List histories = mindmapService.findMindmapHistory(id); final RestMindmapHistoryList result = new RestMindmapHistoryList(); @@ -104,7 +102,7 @@ public class MindmapController extends BaseController { return result; } - @RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/maps/{id}/document", consumes = {"application/json"}, produces = {"application/json"}) + @RequestMapping(method = RequestMethod.PUT, value = "/{id}/document", consumes = {"application/json"}, produces = {"application/json"}) @ResponseStatus(value = HttpStatus.NO_CONTENT) @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") @@ -136,7 +134,7 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(value = "/api/restfull/maps/{id}/history/{hid}", method = RequestMethod.POST) + @RequestMapping(value = "/{id}/history/{hid}", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void updateRevertMindmap(@PathVariable int id, @PathVariable String hid) throws WiseMappingException, IOException { final Mindmap mindmap = findMindmapById(id); @@ -156,7 +154,7 @@ public class MindmapController extends BaseController { } @PreAuthorize("permitAll()") - @RequestMapping(method = RequestMethod.GET, value = {"/api/restfull/maps/{id}/document/xml", "/api/restfull/maps/{id}/document/xml-pub"}, consumes = {"text/plain"}, produces = {"application/xml; charset=UTF-8"}) + @RequestMapping(method = RequestMethod.GET, value = {"/{id}/document/xml", "/{id}/document/xml-pub"}, consumes = {"text/plain"}, produces = {"application/xml; charset=UTF-8"}) @ResponseBody public byte[] retrieveDocument(@PathVariable int id, @NotNull HttpServletResponse response) throws WiseMappingException, IOException { final Mindmap mindmap = findMindmapById(id); @@ -166,9 +164,9 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.PUT, value = {"/api/restfull/maps/{id}/document/xml"}, consumes = {"text/plain"}) + @RequestMapping(method = RequestMethod.PUT, value = {"/{id}/document/xml"}, consumes = {"text/plain"}) @ResponseBody - public void updateDocument(@PathVariable int id, @RequestBody String xmlDoc) throws WiseMappingException, IOException { + public void updateDocument(@PathVariable int id, @RequestBody String xmlDoc) throws WiseMappingException { final Mindmap mindmap = findMindmapById(id); final User user = Utils.getUser(); mindmap.setXmlStr(xmlDoc); @@ -178,7 +176,7 @@ public class MindmapController extends BaseController { @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.GET, value = {"/api/restfull/maps/{id}/{hid}/document/xml"}, consumes = {"text/plain"}, produces = {"application/xml; charset=UTF-8"}) + @RequestMapping(method = RequestMethod.GET, value = {"/{id}/{hid}/document/xml"}, consumes = {"text/plain"}, produces = {"application/xml; charset=UTF-8"}) @ResponseBody public byte[] retrieveDocument(@PathVariable int id, @PathVariable int hid, @NotNull HttpServletResponse response) throws WiseMappingException, IOException { final MindMapHistory mindmapHistory = mindmapService.findMindmapHistory(id, hid); @@ -190,7 +188,7 @@ public class MindmapController extends BaseController { * The intention of this method is the update of several properties at once ... */ @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/maps/{id}", consumes = {"application/json"}, produces = {"application/json"}) + @RequestMapping(method = RequestMethod.PUT, value = "/{id}", consumes = {"application/json"}, produces = {"application/json"}) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void updateProperties(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws IOException, WiseMappingException { @@ -245,7 +243,7 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/maps/{id}/title", consumes = {"text/plain"}, produces = {"application/json"}) + @RequestMapping(method = RequestMethod.PUT, value = "/{id}/title", consumes = {"text/plain"}, produces = {"application/json"}) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void updateTitle(@RequestBody String title, @PathVariable int id) throws WiseMappingException { @@ -264,7 +262,7 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.POST, value = "/api/restfull/maps/{id}/collabs/", consumes = {"application/json"}, produces = {"application/json"}) + @RequestMapping(method = RequestMethod.POST, value = "/{id}/collabs/", consumes = {"application/json"}, produces = {"application/json"}) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void updateCollabs(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException, AccessDeniedSecurityException, InvalidEmailException, TooManyInactiveAccountsExceptions { final Mindmap mindMap = findMindmapById(id); @@ -314,7 +312,7 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/maps/{id}/collabs/", consumes = {"application/json"}, produces = {"application/json"}) + @RequestMapping(method = RequestMethod.PUT, value = "/{id}/collabs/", consumes = {"application/json"}, produces = {"application/json"}) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void addCollab(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException, AccessDeniedSecurityException, InvalidEmailException, TooManyInactiveAccountsExceptions, OwnerCannotChangeException { final Mindmap mindMap = findMindmapById(id); @@ -382,7 +380,7 @@ public class MindmapController extends BaseController { @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.GET, value = "/api/restfull/maps/{id}/collabs", produces = {"application/json"}) + @RequestMapping(method = RequestMethod.GET, value = "/{id}/collabs", produces = {"application/json"}) public RestCollaborationList retrieveList(@PathVariable int id) throws MapCouldNotFoundException, AccessDeniedSecurityException { final Mindmap mindMap = findMindmapById(id); @@ -399,7 +397,7 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/maps/{id}/description", consumes = {"text/plain"}, produces = {"application/json"}) + @RequestMapping(method = RequestMethod.PUT, value = "/{id}/description", consumes = {"text/plain"}, produces = {"application/json"}) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void updateDescription(@RequestBody String description, @PathVariable int id) throws WiseMappingException { final Mindmap mindmap = findMindmapById(id); @@ -408,7 +406,7 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/maps/{id}/publish", consumes = {"text/plain"}, produces = {"application/json"}) + @RequestMapping(method = RequestMethod.PUT, value = "/{id}/publish", consumes = {"text/plain"}, produces = {"application/json"}) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void updatePublishState(@RequestBody String value, @PathVariable int id) throws WiseMappingException { @@ -426,18 +424,18 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.DELETE, value = "/api/restfull/maps/{id}") + @RequestMapping(method = RequestMethod.DELETE, value = "/{id}") @ResponseStatus(value = HttpStatus.NO_CONTENT) - public void deleteMapById(@PathVariable int id) throws IOException, WiseMappingException { + public void deleteMapById(@PathVariable int id) throws WiseMappingException { final User user = Utils.getUser(); final Mindmap mindmap = findMindmapById(id); mindmapService.removeMindmap(mindmap, user); } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.DELETE, value = "/api/restfull/maps/{id}/collabs") + @RequestMapping(method = RequestMethod.DELETE, value = "/{id}/collabs") @ResponseStatus(value = HttpStatus.NO_CONTENT) - public void deleteCollabByEmail(@PathVariable int id, @RequestParam(required = false) String email) throws IOException, WiseMappingException { + public void deleteCollabByEmail(@PathVariable int id, @RequestParam(required = false) String email) throws WiseMappingException { logger.debug("Deleting permission for email:" + email); // Is a valid email address ? @@ -467,7 +465,7 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/maps/{id}/starred", consumes = {"text/plain"}, produces = {"application/json"}) + @RequestMapping(method = RequestMethod.PUT, value = "/{id}/starred", consumes = {"text/plain"}, produces = {"application/json"}) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void updateStarredState(@RequestBody String value, @PathVariable int id) throws WiseMappingException { @@ -486,7 +484,7 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.GET, value = "/api/restfull/maps/{id}/starred", produces = {"text/plain"}) + @RequestMapping(method = RequestMethod.GET, value = "/{id}/starred", produces = {"text/plain"}) @ResponseBody public String fetchStarred(@PathVariable int id) throws WiseMappingException { final Mindmap mindmap = findMindmapById(id); @@ -501,9 +499,9 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.DELETE, value = "/api/restfull/maps/batch") + @RequestMapping(method = RequestMethod.DELETE, value = "/batch") @ResponseStatus(value = HttpStatus.NO_CONTENT) - public void batchDelete(@RequestParam() String ids) throws IOException, WiseMappingException { + public void batchDelete(@RequestParam() String ids) throws WiseMappingException { final User user = Utils.getUser(); final String[] mapsIds = ids.split(","); try { @@ -519,9 +517,9 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.POST, value = "/api/restfull/maps", consumes = {"application/xml", "application/json"}) + @RequestMapping(method = RequestMethod.POST, value = "", consumes = {"application/xml", "application/json"}) @ResponseStatus(value = HttpStatus.CREATED) - public void createMap(@RequestBody(required = false) String mapXml, @NotNull HttpServletResponse response, @RequestParam(required = false) String title, @RequestParam(required = false) String description) throws IOException, WiseMappingException { + public void createMap(@RequestBody(required = false) String mapXml, @NotNull HttpServletResponse response, @RequestParam(required = false) String title, @RequestParam(required = false) String description) throws WiseMappingException { final Mindmap mindmap = new Mindmap(); if (title != null && !title.isEmpty()) { @@ -555,9 +553,9 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.POST, value = "/api/restfull/maps/{id}", consumes = {"application/json"}, produces = {"application/json", "text/plain"}) + @RequestMapping(method = RequestMethod.POST, value = "/{id}", consumes = {"application/json"}, produces = {"application/json", "text/plain"}) @ResponseStatus(value = HttpStatus.CREATED) - public void createDuplicate(@RequestBody RestMindmapInfo restMindmap, @PathVariable int id, @NotNull HttpServletResponse response) throws IOException, WiseMappingException { + public void createDuplicate(@RequestBody RestMindmapInfo restMindmap, @PathVariable int id, @NotNull HttpServletResponse response) throws WiseMappingException { // Validate ... final BindingResult result = new BeanPropertyBindingResult(restMindmap, ""); new MapInfoValidator(mindmapService).validate(restMindmap.getDelegated(), result); @@ -584,7 +582,7 @@ public class MindmapController extends BaseController { @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.DELETE, value = "/api/restfull/maps/{id}/labels/{lid}") + @RequestMapping(method = RequestMethod.DELETE, value = "/{id}/labels/{lid}") @ResponseStatus(value = HttpStatus.NO_CONTENT) public void removeLabelFromMap(@PathVariable int id, @PathVariable int lid) throws WiseMappingException { final User user = Utils.getUser(); @@ -600,7 +598,7 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.POST, value = "/api/restfull/maps/{id}/labels", consumes = {"application/json"}) + @RequestMapping(method = RequestMethod.POST, value = "/{id}/labels", consumes = {"application/json"}) @ResponseStatus(value = HttpStatus.OK) public void updateLabel(@PathVariable int id, @RequestBody int lid) throws WiseMappingException { final User user = Utils.getUser(); @@ -615,7 +613,7 @@ public class MindmapController extends BaseController { } @PreAuthorize("isAuthenticated() and hasRole('ROLE_USER')") - @RequestMapping(method = RequestMethod.PUT, value = "/api/restfull/maps/{id}/lock", consumes = {"text/plain"}, produces = {"application/json"}) + @RequestMapping(method = RequestMethod.PUT, value = "/{id}/lock", consumes = {"text/plain"}, produces = {"application/json"}) public ResponseEntity lockMindmap(@RequestBody String value, @PathVariable int id) throws WiseMappingException { final User user = Utils.getUser(); final LockManager lockManager = mindmapService.getLockManager(); diff --git a/wise-api/src/main/java/com/wisemapping/rest/UserController.java b/wise-api/src/main/java/com/wisemapping/rest/UserController.java index 6208e365..b10b8ed0 100644 --- a/wise-api/src/main/java/com/wisemapping/rest/UserController.java +++ b/wise-api/src/main/java/com/wisemapping/rest/UserController.java @@ -48,6 +48,7 @@ import java.util.Arrays; import java.util.List; @RestController +@RequestMapping("/api/restfull/users") @CrossOrigin public class UserController extends BaseController { @@ -71,7 +72,7 @@ public class UserController extends BaseController { private static final Logger logger = LogManager.getLogger(); private static final String REAL_IP_ADDRESS_HEADER = "X-Real-IP"; - @RequestMapping(method = RequestMethod.POST, value = "/users/", produces = { "application/json" }) + @RequestMapping(method = RequestMethod.POST, value = "/", produces = { "application/json" }) @ResponseStatus(value = HttpStatus.CREATED) public void registerUser(@RequestBody RestUserRegistration registration, @NotNull HttpServletRequest request, @NotNull HttpServletResponse response) throws WiseMappingException, BindException { @@ -98,10 +99,10 @@ public class UserController extends BaseController { user.setAuthenticationType(AuthenticationType.DATABASE); userService.createUser(user, false, true); - response.setHeader("Location", "/service/users/" + user.getId()); + response.setHeader("Location", "/api/restfull/users/" + user.getId()); } - @RequestMapping(method = RequestMethod.PUT, value = "/users/resetPassword", produces = { "application/json" }) + @RequestMapping(method = RequestMethod.PUT, value = "/resetPassword", produces = { "application/json" }) @ResponseStatus(value = HttpStatus.OK) public RestResetPasswordResponse resetPassword(@RequestParam String email) throws InvalidAuthSchemaException, EmailNotExistsException { try { diff --git a/wise-api/src/main/java/com/wisemapping/rest/model/RestLabel.java b/wise-api/src/main/java/com/wisemapping/rest/model/RestLabel.java index 5a49fd38..24086818 100644 --- a/wise-api/src/main/java/com/wisemapping/rest/model/RestLabel.java +++ b/wise-api/src/main/java/com/wisemapping/rest/model/RestLabel.java @@ -1,3 +1,21 @@ +/* + * Copyright [2022] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.wisemapping.rest.model; import com.fasterxml.jackson.annotation.JsonAutoDetect; diff --git a/wise-api/src/main/resources/public/static/mindplot b/wise-api/src/main/resources/public/static/mindplot deleted file mode 120000 index 61ad9a4e..00000000 --- a/wise-api/src/main/resources/public/static/mindplot +++ /dev/null @@ -1 +0,0 @@ -../../../../../../wise-ui/target/wisemapping-mindplot/package/dist \ No newline at end of file diff --git a/wise-api/src/main/resources/public/static/webapp b/wise-api/src/main/resources/public/static/webapp deleted file mode 120000 index 240a1953..00000000 --- a/wise-api/src/main/resources/public/static/webapp +++ /dev/null @@ -1 +0,0 @@ -../../../../../../wise-ui/target/wisemapping-webapp/package/dist \ No newline at end of file