Just some notes of mine on how to install Jelastic command line tools and how to connect to your Jelastic provider1 2.
A little disappointed that installing the command line tools doesn't let me know that it "succeeded". It just returns my command prompt, with no indication what it did.
I thought it had quit unexpectedly.
The first call to the API will require authentication.
As I have enabled two-factor authentication, it's best if I create a personal access token3.
Success!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The absolute main reason to use it, I think, is the ability to move my static IP address of a Jelastic Node to another Node4, creating seamless upgrades.
I've tried it, and it's awesome.
I don't even have to explain how it works here. It's simple and the guide is fine.
I have a pressing need to allow files to be accessed that are static.
Unfortunately, there's a web application sitting on my root context ("/").
So I need to define alternate docroots1.
Unfortunately, this seems to be a specific Glassfish or Payara configuration.
As it is bad form, to put this in my code base (who knows where my wars will end up someday), it's better if I put it in the domain.xml file.
That way it's application server dependent, instead of war dependent.
However, I have found the following2:
virtual server's alternate docroots are considered only if a request does not map to any of the web modules deployed on that virtual server. A web module's alternate docroots are considered only once a request has been mapped to that web module.
Which means that an alternative docroot on the virtual server is basically unusable if you have a webapplication situated at your context root "/".
As an example consider the following:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Now, I don't much like putting pathnames in my web modules. So I was wondering if it's possible to change that by using Microprofile Config.
And it is3!
It will look something like this:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Unfortunately, the return value of the createNativeQuery method is "Query" which is totally untyped, contrary to "TypedQuery", which I would have liked.
Of course, people have already found this out when I looked it up1.
The API seems to be a little wonky in that area.
References
[1] StackOverflow - entityManager.createNativeQuery does not return a typed result
So I had to move a large number of database objects into a JSON response, and I was looking for a neat way to do it.
Originally, I already had the idea of having the database generate JSON responses for me. You can find more information on this here1.
But then I thought it would make sense to, instead of loading all those json strings from the database in memory, streaming them to the JSON generator in my REST Service.
It looked quite easy.
Database streaming
Now, I found out that instead of getResultList(), I could use getResultStream(). Unfortunately, the default implementation of getResultStream() just delegates to getResultList(), which doesn't help at all2.
Also, there seems to be a number of other pitfalls to fall into as well2, 3. So, my first attempt displayed here just might be flawed, or might be flawed if you're using something other than MariaDB.
My attempt at a scrolling cursor, instead of just dumping the entire thing in our lap.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters