diff --git a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/MainController.java b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/MainController.java index 52aaf9aa..b6754841 100644 --- a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/MainController.java +++ b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/MainController.java @@ -17,7 +17,7 @@ import eu.dnetlib.is.resource.model.ResourceType; import eu.dnetlib.is.resource.repository.ResourceTypeRepository; import eu.dnetlib.is.vocabulary.model.Vocabulary; import eu.dnetlib.is.vocabulary.repository.VocabularyRepository; -import eu.dnetlib.is.wfs.WfHistoryRestController; +import eu.dnetlib.is.wfs.WfHistoryAjaxController; @Controller public class MainController { @@ -76,7 +76,7 @@ public class MainController { public void wfHistory(final ModelMap map, @RequestParam(required = false, defaultValue = "-1") final Long from, @RequestParam(required = false, defaultValue = "-1") final Long to) { - map.put("maxNumberOfRecentWfs", WfHistoryRestController.MAX_NUMBER_OF_RECENT_WFS); + map.put("maxNumberOfRecentWfs", WfHistoryAjaxController.MAX_NUMBER_OF_RECENT_WFS); map.put("fromDate", from); map.put("toDate", to); } diff --git a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/context/AbstractContextController.java b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/context/AbstractContextController.java new file mode 100644 index 00000000..55a2de0e --- /dev/null +++ b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/context/AbstractContextController.java @@ -0,0 +1,21 @@ +package eu.dnetlib.is.context; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; + +import eu.dnetlib.common.controller.AbstractDnetController; +import eu.dnetlib.is.context.model.Context; + +public class AbstractContextController extends AbstractDnetController { + + @Autowired + protected ContextService contextService; + + @GetMapping("/") + public List listContexts() { + return contextService.listContexts(); + } + +} diff --git a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/context/ContextRestController.java b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/context/ContextAjaxController.java similarity index 62% rename from apps/dnet-is-application/src/main/java/eu/dnetlib/is/context/ContextRestController.java rename to apps/dnet-is-application/src/main/java/eu/dnetlib/is/context/ContextAjaxController.java index 9b3b2b0e..6e6facae 100644 --- a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/context/ContextRestController.java +++ b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/context/ContextAjaxController.java @@ -1,43 +1,24 @@ package eu.dnetlib.is.context; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import com.fasterxml.jackson.databind.node.ObjectNode; - -import eu.dnetlib.common.controller.AbstractDnetController; import eu.dnetlib.is.context.model.Category; import eu.dnetlib.is.context.model.Context; import eu.dnetlib.is.context.model.CtxChildInfo; import eu.dnetlib.is.util.InformationServiceException; @RestController -@RequestMapping("/api/contexts") -public class ContextRestController extends AbstractDnetController { - - @Autowired - private ContextService contextService; - - @GetMapping("/") - public List listContexts() { - return contextService.listContexts(); - } +@RequestMapping("/ajax/contexts") +public class ContextAjaxController extends AbstractContextController { @GetMapping("/{ctxId}") public Context getContext(@PathVariable final String ctxId) throws InformationServiceException { return contextService.getContext(ctxId); } - @GetMapping("/{ctxId}/full") - public ObjectNode getContextFull(@PathVariable final String ctxId) throws InformationServiceException { - return contextService.getContextFull(ctxId); - } - @GetMapping("/{parent}/categories") public Iterable listCategories(@PathVariable final String parent) { return contextService.listCategories(parent); diff --git a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/context/ContextApiController.java b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/context/ContextApiController.java new file mode 100644 index 00000000..9a8999af --- /dev/null +++ b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/context/ContextApiController.java @@ -0,0 +1,21 @@ +package eu.dnetlib.is.context; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.fasterxml.jackson.databind.node.ObjectNode; + +import eu.dnetlib.is.util.InformationServiceException; + +@RestController +@RequestMapping("/api/contexts") +public class ContextApiController extends AbstractContextController { + + @GetMapping("/{ctxId}") + public ObjectNode getContextFull(@PathVariable final String ctxId) throws InformationServiceException { + return contextService.getContextFull(ctxId); + } + +} diff --git a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/info/InfoRestController.java b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/info/InfoAjaxController.java similarity index 97% rename from apps/dnet-is-application/src/main/java/eu/dnetlib/is/info/InfoRestController.java rename to apps/dnet-is-application/src/main/java/eu/dnetlib/is/info/InfoAjaxController.java index 6a86ce56..8b98de3c 100644 --- a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/info/InfoRestController.java +++ b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/info/InfoAjaxController.java @@ -33,8 +33,8 @@ import org.springframework.web.bind.annotation.RestController; import eu.dnetlib.common.controller.AbstractDnetController; @RestController -@RequestMapping("/api/info") -public class InfoRestController extends AbstractDnetController { +@RequestMapping("/ajax/info") +public class InfoAjaxController extends AbstractDnetController { @Autowired private ConfigurableEnvironment configurableEnvironment; @@ -44,7 +44,7 @@ public class InfoRestController extends AbstractDnetController { private final RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean(); - private static final Log log = LogFactory.getLog(InfoRestController.class); + private static final Log log = LogFactory.getLog(InfoAjaxController.class); @GetMapping("/") public List> info() throws Exception { diff --git a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/resources/AbstractResourceController.java b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/resources/AbstractResourceController.java new file mode 100644 index 00000000..2e02de5e --- /dev/null +++ b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/resources/AbstractResourceController.java @@ -0,0 +1,53 @@ +package eu.dnetlib.is.resources; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.List; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.io.IOUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestParam; + +import eu.dnetlib.common.controller.AbstractDnetController; +import eu.dnetlib.is.resource.model.SimpleResource; +import eu.dnetlib.is.util.InformationServiceException; +import eu.dnetlib.is.util.XmlIndenter; + +public class AbstractResourceController extends AbstractDnetController { + + @Autowired + protected SimpleResourceService service; + + @GetMapping("/") + public List listResources(@RequestParam final String type) { + return service.listResources(type); + } + + @GetMapping("/{id}/metadata") + public SimpleResource getMetadata(@PathVariable final String id) throws InformationServiceException { + return service.getMetadata(id); + } + + @GetMapping("/{id}/content") + public void getContent(@PathVariable final String id, final HttpServletResponse res) throws InformationServiceException { + final String ctype = service.getContentType(id); + + res.setCharacterEncoding(StandardCharsets.UTF_8.name()); + res.setContentType(ctype); + + final String content = + ctype.equals(MediaType.APPLICATION_XML_VALUE) ? XmlIndenter.indent(service.getContent(id)) : service.getContent(id); + + try { + IOUtils.write(content, res.getOutputStream(), StandardCharsets.UTF_8.name()); + } catch (final IOException e) { + throw new InformationServiceException("Error retrieving content", e); + } + } + +} diff --git a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/resources/ResourcesRestController.java b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/resources/ResourceAjaxController.java similarity index 61% rename from apps/dnet-is-application/src/main/java/eu/dnetlib/is/resources/ResourcesRestController.java rename to apps/dnet-is-application/src/main/java/eu/dnetlib/is/resources/ResourceAjaxController.java index 66e2cdbd..4122a29f 100644 --- a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/resources/ResourcesRestController.java +++ b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/resources/ResourceAjaxController.java @@ -2,16 +2,12 @@ package eu.dnetlib.is.resources; import java.io.IOException; import java.nio.charset.StandardCharsets; -import java.util.List; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -19,22 +15,12 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import eu.dnetlib.common.controller.AbstractDnetController; import eu.dnetlib.is.resource.model.SimpleResource; import eu.dnetlib.is.util.InformationServiceException; -import eu.dnetlib.is.util.XmlIndenter; @RestController -@RequestMapping("/api/resources") -public class ResourcesRestController extends AbstractDnetController { - - @Autowired - private SimpleResourceService service; - - @GetMapping("/") - public List listResources(@RequestParam final String type) { - return service.listResources(type); - } +@RequestMapping("/ajax/resources") +public class ResourceAjaxController extends AbstractResourceController { @PostMapping("/") public SimpleResource newResource(@RequestParam final String name, @@ -51,28 +37,6 @@ public class ResourcesRestController extends AbstractDnetController { service.deleteResource(id); } - @GetMapping("/{id}/metadata") - public SimpleResource getMetadata(@PathVariable final String id) throws InformationServiceException { - return service.getMetadata(id); - } - - @GetMapping("/{id}/content") - public void getContent(@PathVariable final String id, final HttpServletResponse res) throws InformationServiceException { - final String ctype = service.getContentType(id); - - res.setCharacterEncoding(StandardCharsets.UTF_8.name()); - res.setContentType(ctype); - - final String content = - ctype.equals(MediaType.APPLICATION_XML_VALUE) ? XmlIndenter.indent(service.getContent(id)) : service.getContent(id); - - try { - IOUtils.write(content, res.getOutputStream(), StandardCharsets.UTF_8.name()); - } catch (final IOException e) { - throw new InformationServiceException("Error retrieving content", e); - } - } - @PostMapping("/{id}/metadata") public void saveMetadata(@PathVariable final String id, @RequestBody final SimpleResource r) throws InformationServiceException { service.saveMetadata(id, r); diff --git a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/resources/ResourceApiController.java b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/resources/ResourceApiController.java new file mode 100644 index 00000000..e3066961 --- /dev/null +++ b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/resources/ResourceApiController.java @@ -0,0 +1,10 @@ +package eu.dnetlib.is.resources; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api/resources") +public class ResourceApiController extends AbstractResourceController { + +} diff --git a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/vocabulary/AbstractVocabularyController.java b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/vocabulary/AbstractVocabularyController.java new file mode 100644 index 00000000..f6587433 --- /dev/null +++ b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/vocabulary/AbstractVocabularyController.java @@ -0,0 +1,27 @@ +package eu.dnetlib.is.vocabulary; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; + +import eu.dnetlib.common.controller.AbstractDnetController; +import eu.dnetlib.is.vocabulary.model.Vocabulary; +import eu.dnetlib.is.vocabulary.model.VocabularyTerm; + +public class AbstractVocabularyController extends AbstractDnetController { + + @Autowired + protected VocabularyService vocabularyService; + + @GetMapping("/") + public List listVocs() { + return vocabularyService.listVocs(); + } + + @GetMapping("/{vocabulary}/terms") + public Iterable listTerms(@PathVariable final String vocabulary) { + return vocabularyService.listTerms(vocabulary); + } +} diff --git a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/vocabulary/VocabularyRestController.java b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/vocabulary/VocabularyAjaxController.java similarity index 75% rename from apps/dnet-is-application/src/main/java/eu/dnetlib/is/vocabulary/VocabularyRestController.java rename to apps/dnet-is-application/src/main/java/eu/dnetlib/is/vocabulary/VocabularyAjaxController.java index 8b9050a4..84b1d9ff 100644 --- a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/vocabulary/VocabularyRestController.java +++ b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/vocabulary/VocabularyAjaxController.java @@ -2,7 +2,6 @@ package eu.dnetlib.is.vocabulary; import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -11,22 +10,13 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import eu.dnetlib.common.controller.AbstractDnetController; import eu.dnetlib.is.util.InformationServiceException; import eu.dnetlib.is.vocabulary.model.Vocabulary; import eu.dnetlib.is.vocabulary.model.VocabularyTerm; @RestController -@RequestMapping("/api/vocs") -public class VocabularyRestController extends AbstractDnetController { - - @Autowired - private VocabularyService vocabularyService; - - @GetMapping("/") - public List listVocs() { - return vocabularyService.listVocs(); - } +@RequestMapping("/ajax/vocs") +public class VocabularyAjaxController extends AbstractVocabularyController { @GetMapping("/{vocabulary}") public Vocabulary getVoc(@PathVariable final String vocabulary) throws InformationServiceException { @@ -45,11 +35,6 @@ public class VocabularyRestController extends AbstractDnetController { return vocabularyService.listVocs(); } - @GetMapping("/{vocabulary}/terms") - public Iterable listTerms(@PathVariable final String vocabulary) { - return vocabularyService.listTerms(vocabulary); - } - @PostMapping("/{vocabulary}/terms") public Iterable saveTerm(@PathVariable final String vocabulary, @RequestBody final VocabularyTerm term) { vocabularyService.saveTerms(vocabulary, term); diff --git a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/vocabulary/VocabularyApiController.java b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/vocabulary/VocabularyApiController.java new file mode 100644 index 00000000..d11dfb5f --- /dev/null +++ b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/vocabulary/VocabularyApiController.java @@ -0,0 +1,10 @@ +package eu.dnetlib.is.vocabulary; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api/vocs") +public class VocabularyApiController extends AbstractVocabularyController { + +} diff --git a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/wfs/WfHistoryRestController.java b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/wfs/WfHistoryAjaxController.java similarity index 96% rename from apps/dnet-is-application/src/main/java/eu/dnetlib/is/wfs/WfHistoryRestController.java rename to apps/dnet-is-application/src/main/java/eu/dnetlib/is/wfs/WfHistoryAjaxController.java index 33eaa8d3..54001a72 100644 --- a/apps/dnet-is-application/src/main/java/eu/dnetlib/is/wfs/WfHistoryRestController.java +++ b/apps/dnet-is-application/src/main/java/eu/dnetlib/is/wfs/WfHistoryAjaxController.java @@ -16,8 +16,8 @@ import eu.dnetlib.is.wf.model.WfProcessExecution; import eu.dnetlib.is.wf.repository.WfProcessExecutionRepository; @RestController -@RequestMapping("/api/wfs") -public class WfHistoryRestController { +@RequestMapping("/ajax/wfs") +public class WfHistoryAjaxController { @Autowired private WfProcessExecutionRepository wfProcessExecutionRepository; diff --git a/apps/dnet-is-application/src/main/resources/static/js/contextEditor.js b/apps/dnet-is-application/src/main/resources/static/js/contextEditor.js index 49c24ff1..24a3e281 100644 --- a/apps/dnet-is-application/src/main/resources/static/js/contextEditor.js +++ b/apps/dnet-is-application/src/main/resources/static/js/contextEditor.js @@ -6,7 +6,7 @@ app.controller('contextController', function($scope, $http, $location) { $scope.parameters = []; $scope.reload = function() { - $scope.url = './api/contexts/' + encodeURIComponent($scope.ctxId) + '/categories'; + $scope.url = './ajax/contexts/' + encodeURIComponent($scope.ctxId) + '/categories'; $http.get($scope.url + '?' + $.now()).then(function successCallback(res) { $scope.categories = res.data; @@ -17,7 +17,7 @@ app.controller('contextController', function($scope, $http, $location) { $scope.loadContextParameters = function() { $scope.parameters = []; - $http.get('./api/contexts/' + encodeURIComponent($scope.ctxId) + '?' + $.now()).then(function successCallback(res) { + $http.get('./ajax/contexts/' + encodeURIComponent($scope.ctxId) + '?' + $.now()).then(function successCallback(res) { $scope.parameters = res.data.parameters; }, function errorCallback(res) { alert('ERROR: ' + res.data.message); @@ -27,7 +27,7 @@ app.controller('contextController', function($scope, $http, $location) { $scope.populateNode = function(level, node) { - $scope.url = './api/contexts/' + $scope.url = './ajax/contexts/' + encodeURIComponent(level) + '/' + encodeURIComponent(node.id) diff --git a/apps/dnet-is-application/src/main/resources/static/js/contexts.js b/apps/dnet-is-application/src/main/resources/static/js/contexts.js index 671d219c..d7977a61 100644 --- a/apps/dnet-is-application/src/main/resources/static/js/contexts.js +++ b/apps/dnet-is-application/src/main/resources/static/js/contexts.js @@ -6,7 +6,7 @@ app.controller('contextsController', function($scope, $http) { $scope.mode = ''; $scope.reload = function() { - $http.get('./api/contexts/?' + $.now()).then(function successCallback(res) { + $http.get('./ajax/contexts/?' + $.now()).then(function successCallback(res) { $scope.contexts = res.data; }, function errorCallback(res) { alert('ERROR: ' + res.data.message); @@ -43,7 +43,7 @@ app.controller('contextsController', function($scope, $http) { } $http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8"; - $http.post('./api/contexts/?' + $.now(), ctx).then(function successCallback(res) { + $http.post('./ajax/contexts/?' + $.now(), ctx).then(function successCallback(res) { $scope.contexts = res.data; alert("Context saved"); }, function errorCallback(res) { @@ -53,7 +53,7 @@ app.controller('contextsController', function($scope, $http) { $scope.deleteContext = function(id) { if (confirm("Are you sure ?")) { - $http.delete('./api/contexts/' + encodeURIComponent(id) + '?' + $.now()).then(function successCallback(res) { + $http.delete('./ajax/contexts/' + encodeURIComponent(id) + '?' + $.now()).then(function successCallback(res) { $scope.contexts = res.data; alert("Context deleted"); }, function errorCallback(res) { diff --git a/apps/dnet-is-application/src/main/resources/static/js/simpleResources.js b/apps/dnet-is-application/src/main/resources/static/js/simpleResources.js index f950986b..86807406 100644 --- a/apps/dnet-is-application/src/main/resources/static/js/simpleResources.js +++ b/apps/dnet-is-application/src/main/resources/static/js/simpleResources.js @@ -7,7 +7,7 @@ app.controller('resourcesController', function($scope, $http) { $scope.type = typeId(); $scope.reload = function() { - $http.get('./api/resources/?type=' + $scope.type + '&' + $.now()).then(function successCallback(res) { + $http.get('./ajax/resources/?type=' + $scope.type + '&' + $.now()).then(function successCallback(res) { $scope.resources = res.data; }, function errorCallback(res) { alert('ERROR: ' + res.data.message); @@ -29,7 +29,7 @@ app.controller('resourcesController', function($scope, $http) { $scope.prepareEditContent = function(r) { $scope.tmpRes = angular.copy(r); $scope.tmpContent = "loading..."; - $http.get('./api/resources/' + r.id + '/content?' + $.now()).then(function successCallback(res) { + $http.get('./ajax/resources/' + r.id + '/content?' + $.now()).then(function successCallback(res) { if (res.data instanceof Object) { $scope.tmpContent = JSON.stringify(res.data, null, "\t"); } else { @@ -42,7 +42,7 @@ app.controller('resourcesController', function($scope, $http) { $scope.createNewResource = function(r) { $http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"; - $http.post('./api/resources/?' + $.now(), $.param({ + $http.post('./ajax/resources/?' + $.now(), $.param({ 'name' : r.name, 'type' : $scope.type, 'description' : r.description, @@ -57,7 +57,7 @@ app.controller('resourcesController', function($scope, $http) { $scope.saveMetadata = function(id, md) { $http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8"; - $http.post('./api/resources/' + id + '/metadata?' + $.now(), md).then(function successCallback(res) { + $http.post('./ajax/resources/' + id + '/metadata?' + $.now(), md).then(function successCallback(res) { alert("Resource saved"); $scope.reload(); }, function errorCallback(res) { @@ -67,7 +67,7 @@ app.controller('resourcesController', function($scope, $http) { $scope.saveContent = function(id, content) { $http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"; - $http.post('./api/resources/' + id + '/content?' + $.now(), $.param({ + $http.post('./ajax/resources/' + id + '/content?' + $.now(), $.param({ 'content' : content })).then(function successCallback(res) { alert("Resource saved"); @@ -78,7 +78,7 @@ app.controller('resourcesController', function($scope, $http) { $scope.deleteResource = function(r) { if (confirm("Are you sure ?")) { - $http.delete('./api/resources/' + encodeURIComponent(r.id) + '?' + $.now()).then(function successCallback(res) { + $http.delete('./ajax/resources/' + encodeURIComponent(r.id) + '?' + $.now()).then(function successCallback(res) { alert("Resource deleted"); $scope.reload(); }, function errorCallback(res) { diff --git a/apps/dnet-is-application/src/main/resources/static/js/vocabularies.js b/apps/dnet-is-application/src/main/resources/static/js/vocabularies.js index 87100bf2..cfbe79a2 100644 --- a/apps/dnet-is-application/src/main/resources/static/js/vocabularies.js +++ b/apps/dnet-is-application/src/main/resources/static/js/vocabularies.js @@ -6,7 +6,7 @@ app.controller('vocabulariesController', function($scope, $http) { $scope.mode = ''; $scope.reload = function() { - $http.get('./api/vocs/?' + $.now()).then(function successCallback(res) { + $http.get('./ajax/vocs/?' + $.now()).then(function successCallback(res) { $scope.vocabularies = res.data; }, function errorCallback(res) { alert('ERROR: ' + res.data.message); @@ -42,7 +42,7 @@ app.controller('vocabulariesController', function($scope, $http) { } $http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8"; - $http.post('./api/vocs/?' + $.now(), voc).then(function successCallback(res) { + $http.post('./ajax/vocs/?' + $.now(), voc).then(function successCallback(res) { $scope.vocabularies = res.data; alert("Vocabulary saved"); }, function errorCallback(res) { @@ -52,7 +52,7 @@ app.controller('vocabulariesController', function($scope, $http) { $scope.deleteVocabulary = function(id) { if (confirm("Are you sure ?")) { - $http.delete('./api/vocs/' + encodeURIComponent(id) + '?' + $.now()).then(function successCallback(res) { + $http.delete('./ajax/vocs/' + encodeURIComponent(id) + '?' + $.now()).then(function successCallback(res) { $scope.vocabularies = res.data; alert("Vocabulary deleted"); }, function errorCallback(res) { diff --git a/apps/dnet-is-application/src/main/resources/static/js/vocabularyEditor.js b/apps/dnet-is-application/src/main/resources/static/js/vocabularyEditor.js index f96c533c..d30f861a 100644 --- a/apps/dnet-is-application/src/main/resources/static/js/vocabularyEditor.js +++ b/apps/dnet-is-application/src/main/resources/static/js/vocabularyEditor.js @@ -8,7 +8,7 @@ app.controller('vocabularyController', function($scope, $http, $location) { $scope.mode = ''; $scope.currTerm = []; - $scope.baseUrl = './api/vocs/' + encodeURIComponent($scope.vocId) + '/terms'; + $scope.baseUrl = './ajax/vocs/' + encodeURIComponent($scope.vocId) + '/terms'; $scope.reload = function() { $http.get($scope.baseUrl + '?' + $.now()).then(function successCallback(res) { diff --git a/apps/dnet-is-application/src/main/resources/static/js/wf_history.js b/apps/dnet-is-application/src/main/resources/static/js/wf_history.js index 48dcd833..179dfbb1 100644 --- a/apps/dnet-is-application/src/main/resources/static/js/wf_history.js +++ b/apps/dnet-is-application/src/main/resources/static/js/wf_history.js @@ -14,7 +14,7 @@ app.controller('wfHistoryController', function($scope, $http) { $scope.sortReverse = false; $scope.reload = function() { - var url = './api/wfs/?' + $.now(); + var url = './ajax/wfs/?' + $.now(); if ($scope.fromDate > 0) { url += "&from=" + $scope.fromDate; } if ($scope.toDate > 0) { url += "&to=" + $scope.toDate; } diff --git a/apps/dnet-is-application/src/main/resources/templates/info.html b/apps/dnet-is-application/src/main/resources/templates/info.html index e4e2213d..297ab92e 100644 --- a/apps/dnet-is-application/src/main/resources/templates/info.html +++ b/apps/dnet-is-application/src/main/resources/templates/info.html @@ -58,7 +58,7 @@ app.controller('infoController', function($scope, $http) { $scope.info = []; - $http.get('./api/info/?' + $.now()).then(function successCallback(res) { + $http.get('./ajax/info/?' + $.now()).then(function successCallback(res) { angular.forEach(res.data, function(section) { if (section.name != 'Modules') { angular.forEach(section.data, function(r) { diff --git a/apps/dnet-is-application/src/main/resources/templates/simpleResources.html b/apps/dnet-is-application/src/main/resources/templates/simpleResources.html index 8a2b874c..4393f3a1 100644 --- a/apps/dnet-is-application/src/main/resources/templates/simpleResources.html +++ b/apps/dnet-is-application/src/main/resources/templates/simpleResources.html @@ -38,7 +38,7 @@

- raw content + raw content