darwino / xpages-runtime

Apache License 2.0
0 stars 0 forks source link

Some Dojo resources aren't included on Android #5

Closed jesse-gallagher closed 5 years ago

jesse-gallagher commented 5 years ago

http://localhost:34100/.xsp/xsp/.ibmxspres/dojoroot/dojo/_base/url.js 404 (Not Found)

This is presumably due to Android's packaging behavior for folders with underscores: https://stackoverflow.com/questions/52719455/including-classloader-resources-starting-with-underscore-in-an-apk

jesse-gallagher commented 5 years ago

The core problem seems fairly intractable - the Android packager is hard-coded to ignore folders starting with "_". There's a gist that does a workaround for local resources, but it doesn't look through dependency resources. Worst case, we could alter that to look through dependencies, but that'd be a tall ask.

However, it may not be required: the underscore'd file is only requested when running on Android, and not when running on Domino or Liberty. In fact, the payload of the page is quite different between the two:

Liberty:

<head>
<title></title>
<script type="text/javascript">var dojoConfig = {locale: 'en-us'};</script>
<script type="text/javascript" src="/xpagesios/.xsp/xsp/.ibmxspres/dojoroot/dojo/dojo.js"></script>
<script type="text/javascript" src="/xpagesios/.xsp/xsp/.ibmxspres/dojoroot/ibm/xsp/widget/layout/layers/xspClientDojo.js"></script>
<link rel="stylesheet" type="text/css" href="/xpagesios/.xsp/xsp/.ibmxspres/global/theme/webstandard/xsp.css">
<link rel="stylesheet" type="text/css" href="/xpagesios/.xsp/xsp/.ibmxspres/global/theme/webstandard/xspLTR.css">
<link rel="stylesheet" type="text/css" href="/xpagesios/.xsp/xsp/.ibmxspres/global/theme/webstandard/xspFF.css">
<link rel="stylesheet" type="text/css" href="/xpagesios/.xsp/xsp/style.css">
</head>

Android:

<head>
<title></title>
<script type="text/javascript">var dojoConfig = {locale: 'en-us'};</script>
<script type="text/javascript" src="/.xsp/xsp/.ibmxspres/dojoroot/dojo/dojo.js"></script>
<script type="text/javascript">dojo.require("ibm.xsp.widget.layout.xspClientDojo")</script>
<link rel="stylesheet" type="text/css" href="/.xsp/xsp/style.css">
</head>
jesse-gallagher commented 5 years ago

Thinking about it, this may be due to Android not having access to filesystem-bound themes. The app theme extends webstandard, but that's loaded from the filesystem in Domino and Liberty, not from a jar that can be brought to Android.

jesse-gallagher commented 5 years ago

If this crops up again in practice, it could potentially be worked around by having a Maven module that copies the resources in during compilation and then having whichever getResource method that fetches them check for failed lookups and rewrites them to the worked-around version.