Posts tagged REST (2)

Payara Platform on Microsoft Azure: Accessing SQL Databases

Microsoft Azure provides fully managed Cloud SQL databases for use by your Azure hosted cloud services. Payara® Micro is built to be the best runtime for Cloud Native Java EE and MicroProfile applications. Here’s how to rapidly create a REST web service that retrieves data from an Azure SQL Database and returns it as JSON.

Consuming a REST Service

A REST Service in Java EE can be created using JAX-RS. The contents of such service can be consumed using ordinary HTTP requests to a URL. URLs are typically kept simple and have a logical pattern, so it's easy to type them manually in e.g. a browser. This is different from SOAP, which essentially uses HTTP as well, but is designed to be rather complex and therefor making it not so easy to quickly test something in a browser.

 

Securing a REST Service

If you're building a REST service, then that REST service will expose some kind of data or will allow some kind of interactions with a server. For instance, consider a Facebook REST service that allows you to retrieve your chat history. Naturally you don't want just anyone looking at that history, hence the need for security.

 

REST Monitoring in Payara Server

The Payara Server 173 release included a technical preview of the REST Monitoring Service, which is a service to expose JMX monitoring MBeans over HTTP. As of Payara Server 174, this feature is no longer in tech preview.

One big problem with JMX is that JMX monitoring uses RMI (Remote Method Invocation), which can lead to a few nightmares if, for example, you have a firewall which blocks connections over RMI ports. The REST monitoring service in Payara Server now provides a service which will be very familiar to users of Jolokia in that it makes this monitoring data available over HTTP, making the data available in a more standard format (JSON) and accessible over a standard HTTP connection.

Using Hibernate 5 on Payara Server

Hibernate is the object/relational mapping tool that handles mapping of Java classes to relational tables and Java types to SQL data type. It’s a well-known framework in the Enterprise Java eco-system since it’s being actively developed for the last 16 years.

With this article, I’m going to show the ways of using Hibernate inside a sample application – source code available here – and deploy it onto Payara Server. I will be using the latest version of Hibernate, which is 5.2.10.Final at the time of writing.

 

Payara MicroProfile 1.0 Released

Back in June we announced MicroProfile with RedHat, IBM, Tomitribe, LJC and SouJava and Microprofile.io was launched as a location for community collaboration on Enterprise Java Microservices. In the announcement each of the vendors promised to have a MicroProfile runtime ready and available in time for JavaOne. Well  after much beavering away here in the Payara Engineering team we have just pushed onto Maven Central our 1.0 release of Payara MicroProfile.

 

Request Tracing Service in Payara Server & Payara Micro

Have you ever wondered whether your application is slow to respond to requests? Which requests take the longest to respond to? And what you can do about it? Payara Server aims to provide the best tooling you would need to identify performance issues, identify their causes and help you solve them. One part of this tooling is the new Request Tracing service, available in Payara Server and Payara Micro from version 163 as a technical preview.

 

Payara Server in Production - Quick Tip

TIP: Don't deploy any apps to the DAS in production!

Why?

As is the case with all my stories, this one began at a customer site. They had an old app they were migrating from GlassFish 3.1.2 to the latest version of Payara Blue. They'd called me in because they wanted to benchmark performance of the new version of Payara Blue on AIX against their existing GlassFish 3.1.2, also on AIX, as well as against a recent version of JBoss (I'm unsure of the version, though I know it was deployed on Windows).