This article steps out the key requirements of deploying a single-page-application on WebLogic server. Essentially, there are just three important gotchas in this process, which I will lay out in detail. The SPA, in this use-case, is an Angular 8 application. I have put the source code as part of the JDev application. I have customised the build process of the Angular application to generate the artifacts inside the public_html folder of the RESTWebService project. You may go with the usual build directory and then manually copy the generated files into the public_html folder.
Gotcha # 1:
The SPA should be built with the html file having a base-href property same as the context-root of the JDev application.
Gotcha # 2:
If you are using routing in your Angular application (you will obviously), then you will usually keep a component to display in case there is no route match (the wildcard ** path). In this case, the Angular routing handles the 404 page-not-found and redirects you to the appropriate component.
But in our case, our application is served by WebLogic, which sends its own 404 error page. To bypass this behaviour, we need to set our index.html page itself as the error page in web.xml, so that the 404 error is handled by Angular, and not by WebLogic. Read the complete article here.
For regular information become a member in the Developer Partner Community please register here.