5

We have a DXA Java 1.7 web app and want to request the a DXA Module´s resources clientside (via AJAX) in order to localize labels etc. in a clientside application. I thought we would simply be able to request the resources using HTTP with the URL http://site/system/resources/modulename.json however this gives a 404. Is there a reason for this, and is there some way round it, or a different way to access this data without having to code something in the web app?

3

Try inserting the version number into the URL.

http://site/system/v1.7/resources/modulename.json

When running in debug (.Net) on the local machine I can access resources via a web browser (chrome) but have to add in the DXA version /v1.7/ into the URL, like this:

http://localhost:53028/system/v1.7/resources/core.json

{
  "readMoreLinkText": "Read More",
  "toggleNavigationText": "Toggle Navigation",
  "sectionErrorMessage": "A problem occurred while rendering this section",
  "todayText": "Today",
  "yesterdayText": "Yesterday",
  "xDaysAgoText": "{0} days ago",
  "showingItemsText": "Showing items {0} to {1}",
  "addressHeadingText": "Address",
  "placeContactHeadingText": "Contact Details",
  "teleponeCaptionText": "Telephone:",
  "faxCaptionText": "Fax:",
  "emailCaptionText": "Email:",
  "directionsLinkText": "Directions to this location",
  "largeMapLinkText": "View Large Map",
  "visitUsSocialLinkTitle": "Visit us on {0}",
  "shareOnSocialCaption": "Share:",
  "shareOnSocialLinkTitle": "Share this page on {0}",
  "redirectEditorHintText": "Edit redirect URL in page metadata",
  "defaultPageTitle": "Welcome",
  "pageTitlePostfix": " | My Site",
  "pageTitleSeparator": ""
}

So mostly, (See below), it works in DotNet DXA, so maybe the Java DXA version has lost the functionality.

Accessing remotely in chrome on IIS server http://notmyrealserver.uksouth.cloudapp.azure.com:82/system/v1.7/resources/core.json also works

Accessing locally on the IIS server with server name

http://notmyrealservername:82/system/v1.7/resources/core.json also works

Accessing locally on the IIS server with localhost

http://localhost:82/system/v1.7/resources/core.json does not work,

even though http://localhost:82 is configured in Topology Manager

  • Good to know it works for .NET, unfortunately the Java version does not support this... – Will Price Sep 4 '17 at 9:18
  • I'm guessing that the version number in the URL doesnt have to be the DXA version, but rather the HTML design version (or indeed any string matching the version pattern) – Will Price Sep 4 '17 at 9:20
  • The guess is correct (I guess it was an educated guess ;-) – Rick Pannekoek Sep 4 '17 at 16:59
  • Sorry to hear that the Java Version does not support this, If the two solutions start to diverge too much it will make it difficult for everyone to support in stack exchange (unless the happen to work on both solutions) – Chris Mills Sep 5 '17 at 7:33
  • The divergence is not intentional for sure; a lot of effort is put in ensuring they are functionaly very similar and compatible. Any inconsistencies between the two versions should be reported as issues on GitHub (which is what Will already did in this case). – Rick Pannekoek Sep 11 '17 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.