From 846178cd09f6307f7bd01fe28c39a5e9a4ea93e6 Mon Sep 17 00:00:00 2001 From: Ben Pennell Date: Fri, 10 Jan 2025 12:22:17 -0500 Subject: [PATCH 1/2] Move all controllers in access app under /api/ path, except the content endpoints --- .../integration/web/access/EndpointIT.java | 2 +- .../src/components/advancedSearch.vue | 6 ++-- .../components/collectionBrowseWrapper.vue | 2 +- .../src/components/displayWrapper.vue | 4 +-- .../src/components/frontPage.vue | 2 +- .../src/components/full_record/fileList.vue | 2 +- .../full_record/metadataDisplay.vue | 2 +- .../src/components/full_record/player.vue | 2 +- .../src/components/header/headerHome.vue | 2 +- .../src/components/header/headerSmall.vue | 2 +- .../src/components/modalMetadata.vue | 2 +- .../src/components/searchWrapper.vue | 2 +- static/js/vue-cdr-access/src/router.js | 2 +- .../tests/unit/advancedSearch.spec.js | 4 +-- .../unit/collectionBrowseWrapper.spec.js | 4 +-- .../tests/unit/displayWrapper.spec.js | 28 +++++++++---------- .../tests/unit/frontPage.spec.js | 2 +- .../tests/unit/metadataDisplay.spec.js | 4 +-- .../tests/unit/modalMetadata.spec.js | 2 +- .../tests/unit/searchWrapper.spec.js | 10 +++---- .../AdvancedSearchFormController.java | 6 ++-- .../BasicSearchFormController.java | 2 +- .../controllers/FrontPageController.java | 2 +- .../controllers/FullRecordController.java | 2 +- .../controllers/SearchActionController.java | 10 +++---- .../UserInformationController.java | 2 +- 26 files changed, 55 insertions(+), 55 deletions(-) diff --git a/integration/src/test/java/edu/unc/lib/boxc/integration/web/access/EndpointIT.java b/integration/src/test/java/edu/unc/lib/boxc/integration/web/access/EndpointIT.java index 3c0ae40bdf..cf3549430a 100644 --- a/integration/src/test/java/edu/unc/lib/boxc/integration/web/access/EndpointIT.java +++ b/integration/src/test/java/edu/unc/lib/boxc/integration/web/access/EndpointIT.java @@ -72,7 +72,7 @@ public class EndpointIT { protected final static String USERNAME = "test_user"; protected final static AccessGroupSet GROUPS = new AccessGroupSetImpl("adminGroup"); - protected final static String ACCESS_URL = "http://localhost:48080/access"; + protected final static String ACCESS_URL = "http://localhost:48080/access/api"; protected CloseableHttpClient httpClient; protected CollectionObject collection; diff --git a/static/js/vue-cdr-access/src/components/advancedSearch.vue b/static/js/vue-cdr-access/src/components/advancedSearch.vue index 399c5543f0..b60ab9024a 100644 --- a/static/js/vue-cdr-access/src/components/advancedSearch.vue +++ b/static/js/vue-cdr-access/src/components/advancedSearch.vue @@ -2,7 +2,7 @@

{{ $t('adv_search.advanced') }}

-
+

{{ $t('adv_search.search_for') }}

@@ -182,7 +182,7 @@ export default { methods: { getCollections() { - get('/advancedSearch/collectionsJson').then((response) => { + get('/api/advancedSearch/collectionsJson').then((response) => { this.collections = response.data; }).catch(function (error) { console.log(error); @@ -190,7 +190,7 @@ export default { }, getFormats() { - get('/advancedSearch/formats').then((response) => { + get('/api/advancedSearch/formats').then((response) => { this.formats = response.data; }).catch(function (error) { console.log(error); diff --git a/static/js/vue-cdr-access/src/components/collectionBrowseWrapper.vue b/static/js/vue-cdr-access/src/components/collectionBrowseWrapper.vue index db3b62dbb1..be1ef589dd 100644 --- a/static/js/vue-cdr-access/src/components/collectionBrowseWrapper.vue +++ b/static/js/vue-cdr-access/src/components/collectionBrowseWrapper.vue @@ -46,7 +46,7 @@ Top level component used for the collection browse page methods: { retrieveData() { - get('collectionsJson').then((response) => { + get('api/collectionsJson').then((response) => { this.records = response.data.metadata; this.is_loading = false; }).catch((error) => { diff --git a/static/js/vue-cdr-access/src/components/displayWrapper.vue b/static/js/vue-cdr-access/src/components/displayWrapper.vue index 029166b66e..7dc9f7c8fb 100644 --- a/static/js/vue-cdr-access/src/components/displayWrapper.vue +++ b/static/js/vue-cdr-access/src/components/displayWrapper.vue @@ -183,7 +183,7 @@ Top level component for full record pages with searching/browsing, including Adm retrieveSearchResults() { let param_string = this.formatParamsString(this.updateParams()) + '&getFacets=true'; this.uuid = location.pathname.split('/')[2]; - get(`/${this.search_method}/${this.uuid}${param_string}`).then((response) => { + get(`/api/${this.search_method}/${this.uuid}${param_string}`).then((response) => { this.record_count = response.data.resultCount; this.record_list = response.data.metadata; this.facet_list = response.data.facetFields; @@ -205,7 +205,7 @@ Top level component for full record pages with searching/browsing, including Adm link += '/'; } - return get(`${link}json`).then((response) => { + return get(`/api${link}json`).then((response) => { this.emptyJsonResponseCheck(response); this.container_info = response.data; diff --git a/static/js/vue-cdr-access/src/components/frontPage.vue b/static/js/vue-cdr-access/src/components/frontPage.vue index 8782b1960b..34258be209 100644 --- a/static/js/vue-cdr-access/src/components/frontPage.vue +++ b/static/js/vue-cdr-access/src/components/frontPage.vue @@ -73,7 +73,7 @@ export default { methods: { getCollectionStats() { - get('/collectionStats').then((response) => { + get('/api/collectionStats').then((response) => { this.collectionStats = response.data; }).catch(function (error) { console.log(error); diff --git a/static/js/vue-cdr-access/src/components/full_record/fileList.vue b/static/js/vue-cdr-access/src/components/full_record/fileList.vue index 0733d96e90..4e03582968 100644 --- a/static/js/vue-cdr-access/src/components/full_record/fileList.vue +++ b/static/js/vue-cdr-access/src/components/full_record/fileList.vue @@ -86,7 +86,7 @@ export default { // File objects don't have any child metadata, so wrap the file object in an array ajaxOptions() { return { - url: `/listJson/${this.workId}?rows=10`, + url: `/api/listJson/${this.workId}?rows=10`, dataSrc: (d) => this.resourceType === 'Work' ? d.metadata : [d.container], data: (d) => { const sorts = ['title', 'fileFormatDescription', 'fileSize']; diff --git a/static/js/vue-cdr-access/src/components/full_record/metadataDisplay.vue b/static/js/vue-cdr-access/src/components/full_record/metadataDisplay.vue index 0c8b6cc3e1..d9b22b09b2 100644 --- a/static/js/vue-cdr-access/src/components/full_record/metadataDisplay.vue +++ b/static/js/vue-cdr-access/src/components/full_record/metadataDisplay.vue @@ -36,7 +36,7 @@ export default { methods: { loadMetadata() { - get(`/record/${this.uuid}/metadataView`).then((response) => { + get(`/api/record/${this.uuid}/metadataView`).then((response) => { this.metadata = response.data; this.hasLoaded = true; }).catch((error) => { diff --git a/static/js/vue-cdr-access/src/components/full_record/player.vue b/static/js/vue-cdr-access/src/components/full_record/player.vue index 3bd63bfc63..094fb06098 100644 --- a/static/js/vue-cdr-access/src/components/full_record/player.vue +++ b/static/js/vue-cdr-access/src/components/full_record/player.vue @@ -67,7 +67,7 @@ export default { methods: { viewer(viewer_type) { - return `/record/${this.recordData.briefObject.id}/${viewer_type}Viewer`; + return `/api/record/${this.recordData.briefObject.id}/${viewer_type}Viewer`; } } } diff --git a/static/js/vue-cdr-access/src/components/header/headerHome.vue b/static/js/vue-cdr-access/src/components/header/headerHome.vue index 601b577cdd..7c1f277c1b 100644 --- a/static/js/vue-cdr-access/src/components/header/headerHome.vue +++ b/static/js/vue-cdr-access/src/components/header/headerHome.vue @@ -42,7 +42,7 @@
- +
diff --git a/static/js/vue-cdr-access/src/components/header/headerSmall.vue b/static/js/vue-cdr-access/src/components/header/headerSmall.vue index 41ef806bef..2a93e2b29d 100644 --- a/static/js/vue-cdr-access/src/components/header/headerSmall.vue +++ b/static/js/vue-cdr-access/src/components/header/headerSmall.vue @@ -34,7 +34,7 @@
- +
diff --git a/static/js/vue-cdr-access/src/components/modalMetadata.vue b/static/js/vue-cdr-access/src/components/modalMetadata.vue index 4c5cf8f0b7..f62e18705f 100644 --- a/static/js/vue-cdr-access/src/components/modalMetadata.vue +++ b/static/js/vue-cdr-access/src/components/modalMetadata.vue @@ -75,7 +75,7 @@ Displays the MODS descriptive record for an object inside of a modal methods: { loadMetadata() { - get(`/record/${this.uuid}/metadataView`).then((response) => { + get(`/api/record/${this.uuid}/metadataView`).then((response) => { this.metadata = response.data; this.hasLoaded = true; }).catch((error) => { diff --git a/static/js/vue-cdr-access/src/components/searchWrapper.vue b/static/js/vue-cdr-access/src/components/searchWrapper.vue index 93ea0dbf87..3e247d4100 100644 --- a/static/js/vue-cdr-access/src/components/searchWrapper.vue +++ b/static/js/vue-cdr-access/src/components/searchWrapper.vue @@ -129,7 +129,7 @@ Top level component wrapper for search pages let search_path = 'searchJson'; this.collection = this.routeHasPathId ? this.$route.path.split('/')[2] : ''; - get(`${search_path}/${param_string}`).then((response) => { + get(`api/${search_path}/${param_string}`).then((response) => { this.emptyJsonResponseCheck(response); this.records = response.data.metadata; this.total_records = response.data.resultCount; diff --git a/static/js/vue-cdr-access/src/router.js b/static/js/vue-cdr-access/src/router.js index 76cd61a3d6..0445db3727 100644 --- a/static/js/vue-cdr-access/src/router.js +++ b/static/js/vue-cdr-access/src/router.js @@ -68,7 +68,7 @@ const router = createRouter({ router.beforeEach((to, from) => { const store = useAccessStore(); - axios.head('/userInformation').then((response) => { + axios.head('/api/userInformation').then((response) => { store.setUsername(response.headers['username']); store.setIsLoggedIn(); store.setViewAdmin(response.headers['can-view-admin']); diff --git a/static/js/vue-cdr-access/tests/unit/advancedSearch.spec.js b/static/js/vue-cdr-access/tests/unit/advancedSearch.spec.js index b37f35f7df..15010e03b0 100644 --- a/static/js/vue-cdr-access/tests/unit/advancedSearch.spec.js +++ b/static/js/vue-cdr-access/tests/unit/advancedSearch.spec.js @@ -73,7 +73,7 @@ describe('advancedSearch.vue', () => { ], "id":"fc77a9be-b49d-4f4e-b656-1644c9e964fc", "title":"testCollection" }]; - moxios.stubRequest('/advancedSearch/collectionsJson', { + moxios.stubRequest('/api/advancedSearch/collectionsJson', { status: 200, response: JSON.stringify(collections) }); @@ -100,7 +100,7 @@ describe('advancedSearch.vue', () => { "Video" ]; - moxios.stubRequest('/advancedSearch/formats', { + moxios.stubRequest('/api/advancedSearch/formats', { status: 200, response: JSON.stringify(formats) }); diff --git a/static/js/vue-cdr-access/tests/unit/collectionBrowseWrapper.spec.js b/static/js/vue-cdr-access/tests/unit/collectionBrowseWrapper.spec.js index 03be80983a..25c7147f72 100644 --- a/static/js/vue-cdr-access/tests/unit/collectionBrowseWrapper.spec.js +++ b/static/js/vue-cdr-access/tests/unit/collectionBrowseWrapper.spec.js @@ -73,7 +73,7 @@ describe('collectionBrowseWrapper.vue', () => { }); it("retrieves data", (done) => { - moxios.stubRequest('collectionsJson', { + moxios.stubRequest('api/collectionsJson', { status: 200, response: JSON.stringify(response) }); @@ -86,7 +86,7 @@ describe('collectionBrowseWrapper.vue', () => { }); it("displays a '503 page' if JSON responds with an error", (done) => { - moxios.stubRequest('collectionsJson', { + moxios.stubRequest('api/collectionsJson', { status: 503, response: JSON.stringify({ message: 'bad stuff happened' }) }); diff --git a/static/js/vue-cdr-access/tests/unit/displayWrapper.spec.js b/static/js/vue-cdr-access/tests/unit/displayWrapper.spec.js index 1b42f9343e..7c61b9043a 100644 --- a/static/js/vue-cdr-access/tests/unit/displayWrapper.spec.js +++ b/static/js/vue-cdr-access/tests/unit/displayWrapper.spec.js @@ -70,7 +70,7 @@ describe('displayWrapper.vue', () => { } it("retrieves data", async () => { - stubQueryResponse(`listJson/${response.container.id}?.+`, response); + stubQueryResponse(`api/listJson/${response.container.id}?.+`, response); await router.push(`/record/${response.container.id}`); mountApp(); wrapper.vm.getBriefObject(); @@ -130,7 +130,7 @@ describe('displayWrapper.vue', () => { }); it("uses the correct parameters for admin unit browse", async () => { - stubQueryResponse(`listJson/73bc003c-9603-4cd9-8a65-93a22520ef6a?.+`, response); + stubQueryResponse(`api/listJson/73bc003c-9603-4cd9-8a65-93a22520ef6a?.+`, response); await router.push('/record/73bc003c-9603-4cd9-8a65-93a22520ef6a?works_only=false'); mountApp({ container_info: { @@ -163,7 +163,7 @@ describe('displayWrapper.vue', () => { }); it("displays a 'works only' option if the 'works only' box is checked and no records are works", async () => { - stubQueryResponse(`searchJson/73bc003c-9603-4cd9-8a65-93a22520ef6a?.+`, response); + stubQueryResponse(`api/searchJson/73bc003c-9603-4cd9-8a65-93a22520ef6a?.+`, response); await router.push('/record/73bc003c-9603-4cd9-8a65-93a22520ef6a?works_only=true'); mountApp(); @@ -183,8 +183,8 @@ describe('displayWrapper.vue', () => { }); it("adjusts facets retrieved for admin unit", async () => { - stubQueryResponse(`listJson/73bc003c-9603-4cd9-8a65-93a22520ef6a?.+&facetSelect=collection%2Cformat%2Cgenre%2Clanguage%2Csubject%2Clocation%2CcreatedYear%2CcreatorContributor%2Cpublisher&.*`, response); - stubQueryResponse(`record/73bc003c-9603-4cd9-8a65-93a22520ef6a/json`, + stubQueryResponse(`api/listJson/73bc003c-9603-4cd9-8a65-93a22520ef6a?.+&facetSelect=collection%2Cformat%2Cgenre%2Clanguage%2Csubject%2Clocation%2CcreatedYear%2CcreatorContributor%2Cpublisher&.*`, response); + stubQueryResponse(`api/record/73bc003c-9603-4cd9-8a65-93a22520ef6a/json`, { 'briefObject': { type: 'AdminUnit', @@ -220,8 +220,8 @@ describe('displayWrapper.vue', () => { }); it("adjusts facets retrieved for collection object", async () => { - stubQueryResponse(`listJson/73bc003c-9603-4cd9-8a65-93a22520ef6a?.+&facetSelect=format%2Cgenre%2Clanguage%2Csubject%2Clocation%2CcreatedYear%2CcreatorContributor%2Cpublisher&.*`, response); - stubQueryResponse(`record/73bc003c-9603-4cd9-8a65-93a22520ef6a/json`, + stubQueryResponse(`api/listJson/73bc003c-9603-4cd9-8a65-93a22520ef6a?.+&facetSelect=format%2Cgenre%2Clanguage%2Csubject%2Clocation%2CcreatedYear%2CcreatorContributor%2Cpublisher&.*`, response); + stubQueryResponse(`api/record/73bc003c-9603-4cd9-8a65-93a22520ef6a/json`, { 'briefObject': briefObjectData.briefObject, 'resourceType': 'Collection', @@ -240,8 +240,8 @@ describe('displayWrapper.vue', () => { }); it("adjusts facets retrieved for folder object", async () => { - stubQueryResponse(`listJson/73bc003c-9603-4cd9-8a65-93a22520ef6a?.+&facetSelect=format%2Cgenre%2Clanguage%2Csubject%2Clocation%2CcreatedYear%2CcreatorContributor%2Cpublisher&.*`, response); - stubQueryResponse(`record/73bc003c-9603-4cd9-8a65-93a22520ef6a/json`, + stubQueryResponse(`api/listJson/73bc003c-9603-4cd9-8a65-93a22520ef6a?.+&facetSelect=format%2Cgenre%2Clanguage%2Csubject%2Clocation%2CcreatedYear%2CcreatorContributor%2Cpublisher&.*`, response); + stubQueryResponse(`api/record/73bc003c-9603-4cd9-8a65-93a22520ef6a/json`, { 'briefObject': { type: 'Folder', @@ -281,8 +281,8 @@ describe('displayWrapper.vue', () => { }); it("adjusts facets retrieved for admin unit and maintains them after checking works only", async () => { - stubQueryResponse(`listJson/73bc003c-9603-4cd9-8a65-93a22520ef6a?.+&facetSelect=collection%2Cformat%2Cgenre%2Clanguage%2Csubject%2Clocation%2CcreatedYear%2CcreatorContributor%2Cpublisher&.*`, response); - stubQueryResponse(`record/73bc003c-9603-4cd9-8a65-93a22520ef6a/json`, + stubQueryResponse(`api/listJson/73bc003c-9603-4cd9-8a65-93a22520ef6a?.+&facetSelect=collection%2Cformat%2Cgenre%2Clanguage%2Csubject%2Clocation%2CcreatedYear%2CcreatorContributor%2Cpublisher&.*`, response); + stubQueryResponse(`api/record/73bc003c-9603-4cd9-8a65-93a22520ef6a/json`, { 'briefObject': { type: 'AdminUnit', @@ -323,7 +323,7 @@ describe('displayWrapper.vue', () => { }); it("shows a 'not found' message if no data is returned", async () => { - stubQueryResponse(`/record/73bc003c-9603-4cd9-8a65-93a22520ef6a/json`, ''); + stubQueryResponse(`/api/record/73bc003c-9603-4cd9-8a65-93a22520ef6a/json`, ''); await router.push('/record/73bc003c-9603-4cd9-8a65-93a22520ef6a/?browse_type=list-display'); mountApp(); @@ -332,7 +332,7 @@ describe('displayWrapper.vue', () => { }); it("shows a 'not found' message if a 4xx status code is returned", async () => { - moxios.stubRequest('/record/73bc003c-9603-4cd9-8a65-93a22520ef6b/json', { + moxios.stubRequest('/api/record/73bc003c-9603-4cd9-8a65-93a22520ef6b/json', { status: 404, response: JSON.stringify({ message: 'Nothing to see here' }) }); @@ -344,7 +344,7 @@ describe('displayWrapper.vue', () => { }); it("displays a '503 page' if JSON responds with an error", async () => { - moxios.stubRequest('/record/73bc003c-9603-4cd9-8a65-93a22520ef6b/json', { + moxios.stubRequest('/api/record/73bc003c-9603-4cd9-8a65-93a22520ef6b/json', { status: 503, response: JSON.stringify({ message: 'bad stuff happened' }) }); diff --git a/static/js/vue-cdr-access/tests/unit/frontPage.spec.js b/static/js/vue-cdr-access/tests/unit/frontPage.spec.js index e024d9cdb9..493dc3740b 100644 --- a/static/js/vue-cdr-access/tests/unit/frontPage.spec.js +++ b/static/js/vue-cdr-access/tests/unit/frontPage.spec.js @@ -69,7 +69,7 @@ describe('frontPage.vue', () => { {"text":"46936"} ] }; - moxios.stubRequest('/collectionStats', { + moxios.stubRequest('/api/collectionStats', { status: 200, response: JSON.stringify(collectionStats) }); diff --git a/static/js/vue-cdr-access/tests/unit/metadataDisplay.spec.js b/static/js/vue-cdr-access/tests/unit/metadataDisplay.spec.js index 06685f8970..dcef7b1dbf 100644 --- a/static/js/vue-cdr-access/tests/unit/metadataDisplay.spec.js +++ b/static/js/vue-cdr-access/tests/unit/metadataDisplay.spec.js @@ -51,7 +51,7 @@ describe('metadataDisplay.vue', () => { it("loads record MODS metadata as html", (done) => { const html_data = "
Title

Listen for real

"; - const url = `record/${record.uuid}/metadataView`; + const url = `api/record/${record.uuid}/metadataView`; moxios.stubRequest(new RegExp(url), { status: 200, response: html_data @@ -67,7 +67,7 @@ describe('metadataDisplay.vue', () => { it("does not load record MODS metadata if empty", (done) => { const html_data = ""; - const url = `record/${record.uuid}/metadataView`; + const url = `api/record/${record.uuid}/metadataView`; moxios.stubRequest(new RegExp(url), { status: 200, response: html_data diff --git a/static/js/vue-cdr-access/tests/unit/modalMetadata.spec.js b/static/js/vue-cdr-access/tests/unit/modalMetadata.spec.js index 11a6c6065b..ddcf705054 100644 --- a/static/js/vue-cdr-access/tests/unit/modalMetadata.spec.js +++ b/static/js/vue-cdr-access/tests/unit/modalMetadata.spec.js @@ -50,7 +50,7 @@ describe('modalMetadata.vue', () => { it("fetches the record metadata when the modal is opened", () => { moxios.install(); - moxios.stubRequest(`record/${updated_uuid}/metadataView`, { + moxios.stubRequest(`api/record/${updated_uuid}/metadataView`, { status: 200, responseText: { data: response diff --git a/static/js/vue-cdr-access/tests/unit/searchWrapper.spec.js b/static/js/vue-cdr-access/tests/unit/searchWrapper.spec.js index 8fb7532253..259248fe1c 100644 --- a/static/js/vue-cdr-access/tests/unit/searchWrapper.spec.js +++ b/static/js/vue-cdr-access/tests/unit/searchWrapper.spec.js @@ -163,7 +163,7 @@ describe('searchWrapper.vue', () => { }); it("displays facets if facets but no results", (done) => { - moxios.stubRequest(`searchJson/?anywhere=&getFacets=true`, { + moxios.stubRequest(`api/searchJson/?anywhere=&getFacets=true`, { status: 200, response: JSON.stringify(facets_no_results) }); @@ -177,7 +177,7 @@ describe('searchWrapper.vue', () => { it("does not display facets if there are no facets and no results", (done) => { wrapper.vm.retrieveData(); - moxios.stubRequest(`searchJson/?anywhere=&getFacets=true`, { + moxios.stubRequest(`api/searchJson/?anywhere=&getFacets=true`, { status: 200, response: JSON.stringify(no_results) }); @@ -197,7 +197,7 @@ describe('searchWrapper.vue', () => { }); it("displays a 'page not found' message if JSON response is an empty", (done) => { - moxios.stubRequest(`searchJson/?anywhere=&getFacets=true`, { + moxios.stubRequest(`api/searchJson/?anywhere=&getFacets=true`, { status: 200, response: JSON.stringify('') }); @@ -210,7 +210,7 @@ describe('searchWrapper.vue', () => { }); it("displays a '503 page' if JSON responds with an error", (done) => { - moxios.stubRequest(`searchJson/?anywhere=&getFacets=true`, { + moxios.stubRequest(`api/searchJson/?anywhere=&getFacets=true`, { status: 503, response: JSON.stringify({ message: 'bad stuff happened' }) }); @@ -230,7 +230,7 @@ describe('searchWrapper.vue', () => { }); function loadFullData() { - moxios.stubRequest(`searchJson/?anywhere=&getFacets=true`, { + moxios.stubRequest(`api/searchJson/?anywhere=&getFacets=true`, { status: 200, response: JSON.stringify(response) }); diff --git a/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/AdvancedSearchFormController.java b/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/AdvancedSearchFormController.java index cc5d807fd4..3fb16ce470 100644 --- a/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/AdvancedSearchFormController.java +++ b/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/AdvancedSearchFormController.java @@ -36,20 +36,20 @@ public class AdvancedSearchFormController extends AbstractErrorHandlingSearchCon .sorted() .collect(Collectors.toList()); - @RequestMapping(path = "/advancedSearch/collectionsJson", produces = APPLICATION_JSON_VALUE) + @RequestMapping(path = "/api/advancedSearch/collectionsJson", produces = APPLICATION_JSON_VALUE) public @ResponseBody String getCollections() { AccessGroupSet accessGroups = GroupsThreadStore.getPrincipals(); SearchResultResponse collectionResultResponse = queryLayer.getCollectionList(accessGroups); return SerializationUtil.resultsToJSON(collectionResultResponse, accessGroups); } - @RequestMapping(path = "/advancedSearch/formats", produces = APPLICATION_JSON_VALUE) + @RequestMapping(path = "/api/advancedSearch/formats", produces = APPLICATION_JSON_VALUE) public @ResponseBody String getFormats() throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(FORMAT_VALUES); } - @RequestMapping(path = "/advancedSearch", method = RequestMethod.GET) + @RequestMapping(path = "/api/advancedSearch", method = RequestMethod.GET) public String handleRequest(Model model, HttpServletRequest request) { // If the user has submitted the search form, then generate a search state // and forward them to the search servlet. diff --git a/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/BasicSearchFormController.java b/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/BasicSearchFormController.java index 6ae968a209..6caaf3ba9d 100644 --- a/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/BasicSearchFormController.java +++ b/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/BasicSearchFormController.java @@ -28,7 +28,7 @@ * @author bbpennel */ @Controller -@RequestMapping("/basicSearch") +@RequestMapping("/api/basicSearch") public class BasicSearchFormController extends AbstractErrorHandlingSearchController { private static final Logger LOG = LoggerFactory.getLogger(BasicSearchFormController.class); @Autowired diff --git a/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/FrontPageController.java b/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/FrontPageController.java index d716d3da93..1224dbb7f0 100644 --- a/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/FrontPageController.java +++ b/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/FrontPageController.java @@ -20,7 +20,7 @@ * @author bbpennel, krwong */ @Controller -@RequestMapping("/collectionStats") +@RequestMapping("/api/collectionStats") public class FrontPageController extends AbstractErrorHandlingSearchController { private static final Logger LOG = LoggerFactory.getLogger(FrontPageController.class); diff --git a/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/FullRecordController.java b/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/FullRecordController.java index 8a2f330228..fc97bdd7a3 100644 --- a/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/FullRecordController.java +++ b/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/FullRecordController.java @@ -71,7 +71,7 @@ * @author bbpennel */ @Controller -@RequestMapping("/record") +@RequestMapping("/api/record") public class FullRecordController extends AbstractErrorHandlingSearchController { private static final Logger LOG = LoggerFactory.getLogger(FullRecordController.class); private final String VIEWER_PID = "viewerPid"; diff --git a/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/SearchActionController.java b/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/SearchActionController.java index 0b989e9fa1..479b0aace7 100644 --- a/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/SearchActionController.java +++ b/web-access-app/src/main/java/edu/unc/lib/boxc/web/access/controllers/SearchActionController.java @@ -52,7 +52,7 @@ public class SearchActionController extends AbstractErrorHandlingSearchControlle * @param response * @return */ - @RequestMapping(value = "/searchJson", method = RequestMethod.GET, produces = "application/json") + @RequestMapping(value = "/api/searchJson", method = RequestMethod.GET, produces = "application/json") public @ResponseBody Map searchJson(@RequestParam("getFacets") Optional getFacets, HttpServletRequest request, HttpServletResponse response) { @@ -68,7 +68,7 @@ Map searchJson(@RequestParam("getFacets") Optional getF * @param response * @return */ - @RequestMapping(value = "/searchJson/{pid}", method = RequestMethod.GET, produces = "application/json") + @RequestMapping(value = "/api/searchJson/{pid}", method = RequestMethod.GET, produces = "application/json") public @ResponseBody Map searchJson(@PathVariable("pid") String pid, @RequestParam("getFacets") Optional getFacets, @@ -76,7 +76,7 @@ Map searchJson(@PathVariable("pid") String pid, return searchJsonRequest(request, getFacets.orElse(false), pid); } - @RequestMapping(value = "/list/{pid}", method = RequestMethod.GET) + @RequestMapping(value = "/api/list/{pid}", method = RequestMethod.GET) public String listRedirect(@PathVariable("pid") String pid) { return "redirect:/record/{pid}"; } @@ -90,7 +90,7 @@ public String listRedirect(@PathVariable("pid") String pid) { * @param response * @return */ - @RequestMapping(value = "/listJson/{pid}", method = RequestMethod.GET, produces = "application/json") + @RequestMapping(value = "/api/listJson/{pid}", method = RequestMethod.GET, produces = "application/json") public @ResponseBody Map listJson(@PathVariable("pid") String pid, @RequestParam("getFacets") Optional getFacets, @@ -114,7 +114,7 @@ Map listJson(@PathVariable("pid") String pid, * @param response * @return */ - @RequestMapping(value = "/collectionsJson", method = RequestMethod.GET, produces = "application/json") + @RequestMapping(value = "/api/collectionsJson", method = RequestMethod.GET, produces = "application/json") public @ResponseBody Map browseCollectionsJson(HttpServletRequest request, HttpServletResponse response) { SearchRequest searchRequest = generateSearchRequest(request); diff --git a/web-common/src/main/java/edu/unc/lib/boxc/web/common/controllers/UserInformationController.java b/web-common/src/main/java/edu/unc/lib/boxc/web/common/controllers/UserInformationController.java index f6492146f7..a3f2cea0f3 100644 --- a/web-common/src/main/java/edu/unc/lib/boxc/web/common/controllers/UserInformationController.java +++ b/web-common/src/main/java/edu/unc/lib/boxc/web/common/controllers/UserInformationController.java @@ -13,7 +13,7 @@ */ @Controller public class UserInformationController { - @RequestMapping(value = "/userInformation", method = RequestMethod.HEAD) + @RequestMapping(value = "/api/userInformation", method = RequestMethod.HEAD) public ResponseEntity getUserInformation() { return ResponseEntity.status(OK).contentLength(0).build(); } From f3b9278f3c4272c7e13c6d243fc96f96a96c98e3 Mon Sep 17 00:00:00 2001 From: Ben Pennell Date: Fri, 10 Jan 2025 15:02:21 -0500 Subject: [PATCH 2/2] Fix test --- .../lib/boxc/web/access/controllers/FrontPageControllerIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-access-app/src/test/java/edu/unc/lib/boxc/web/access/controllers/FrontPageControllerIT.java b/web-access-app/src/test/java/edu/unc/lib/boxc/web/access/controllers/FrontPageControllerIT.java index d3072784a6..661e0b13b3 100644 --- a/web-access-app/src/test/java/edu/unc/lib/boxc/web/access/controllers/FrontPageControllerIT.java +++ b/web-access-app/src/test/java/edu/unc/lib/boxc/web/access/controllers/FrontPageControllerIT.java @@ -57,7 +57,7 @@ public void testGetCollectionStats() throws Exception { "video", 21444L, "text", 46936L); when(queryLayer.getFormatCounts(any())).thenReturn(collectionStats); - MvcResult result = mvc.perform(get("/collectionStats") + MvcResult result = mvc.perform(get("/api/collectionStats") .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn();