Has anyone had any luck running an SPA in centricity in v20? I got some code set up to transition a form that was working in 12.3 but not in v20 (we skipped v19) and was playing around with making it an SPA while I was in there, to make it easier to transition later forms. It works great in Chrome (well, other than the part where it can't retrieve Centricity info 😉 ), including loading different pages by URL, but when I load it in Centricity, it seems like all instances of the browser are the same instance, and while I can navigate from one form to another by a link on the form page, if I load a second form with a different address it just shows my already active window and doesn't change navigation. I'm not sure what causes this or where to troubleshoot.
If it matters I am using AngularJS and #! routing. I was tempted by HTML5 routing but since nobody will see it and I don't understand where to change URL rewriting rules in JBoss I passed. Starting to wonder if I need to use HTML5 addresses and no #! afterall in order to convince Centricity we are actually looking at different pages, though.
I got this working correctly. I don't know what the root cause in the EMR is, but it was treating each loaded route of the SPA as part of the same instance using #!
routes. Getting HTML5 routing working solved the issue.
After fighting with Undertow's undertow-handlers.conf
for a day and having no feedback on why my rules weren't working, I ended up using Tuckey's URL Rewrite. It helpfully logs what input it was comparing against what which allowed me to see where my first attempts at rules went wrong, and edit them accordingly until they worked.
This required three file changes in the WEB-INF directory inside the CentricityPracticeWS.war directory. (There are various META-INF and WEB-INF directories all over but using this one worked in the specific deployment I'm working in now, namely our demo server.)
1) Create a /lib directory inside WEB-INF and put urlrewritefilter-4.0.4.jar in it (downloaded from the Maven Repository)
2) Put the example urlrewrite.xml into WEB-INF and adapt it with necessary rules. For the root page of our SPA and the first route, the custom rules I inserted look something like this:
<rule match-type="regex" enabled="true">
<condition type="request-filename" operator="notfile" />
<condition type="request-uri" operator="notequal">(\.html|\.js|\.css)</condition>
<from>^/FormsFolder/subfolder/app/$</from>
<to last="true">/FormsFolder/subfolder/app/index.html</to>
</rule>
<rule match-type="regex" enabled="true">
<condition type="request-filename" operator="notfile" />
<condition type="request-uri" operator="notequal">(\.html|\.js|\.css)</condition>
<from>^/FormsFolder/subfolder/app/route1/$</from>
<to last="true">/FormsFolder/subfolder/app/index.html</to>
</rule>
3) Add the Tuckey Rewrite Filter to web.xml:
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<init-param>
<param-name>confPath</param-name>
<param-value>/WEB-INF/urlrewrite.xml</param-value>
</init-param>
<init-param>
<!-- This configures how often to check for an update to urlrewrite.xml -->
<param-name>confReloadCheckInterval</param-name>
<param-value>60</param-value>
</init-param>
<init-param>
<!-- This configures what detail level of messages to log. TRACE was useful to
figure things out but DEBUG or WARN is probably more appropriate for production -->
<param-name>logLevel</param-name>
<param-value>TRACE</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
Lastly I had to update the index.html of the SPA to include the base tag, before all the stylesheet links and javascript script includes so that they route correctly. For the demo server, mine looks something like <base href="/demo/ws/FormsFolder/subfolder/app/">
but will have to be updated to publish to the live server.
Hopefully this is helpful if anyone else is trying to configure HTML5 routing on a centricity JBoss server.
CHUG did a terrible job with my code chunks.
They're probably a bit more legible on the copy of this over at SO
Clinical Forge and their library works well.