Geertjan's Blog

Application Container Cloud, Oracle JET, and NetBeans IDE (Part 2)

Geertjan Wielenga
Product Manager

In part 1, yesterday, we deployed a Node.js application, with static resources architected on Orace JET, to the Application Container Cloud Service (ACCS). However, ACCS is also applicable to Java SE applications.

There are several use cases for running Java SE applications on ACCS:


I followed this scenario:


However, I wanted to serve up JSON, rather than Strings, so I rewrote "getAllCustomers" in "CustomerService" to the following:

public GenericEntity<List<Customer>> getAllCustomers() {
List<Customer> list = CustomerList.getInstance();
return new GenericEntity<List<Customer>>(list) {};

See the above code here.

More info in this example for JSON-related scenarios:


Also, I needed a ContainerResponseFilter, to handle CORS:

import java.io.IOException;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.ext.Provider;
public class CORSFilter implements ContainerResponseFilter {
public void filter(ContainerRequestContext request,
ContainerResponseContext response) throws IOException {
response.getHeaders().add("Access-Control-Allow-Origin", "*");
"origin, content-type, accept, authorization");
response.getHeaders().add("Access-Control-Allow-Credentials", "true");

My application now looks like this: 

I created a cloud-ready package with an uber JAR (in my case named "CustomerAwesomizer.jar"), as described in the documentation, and then uploaded it to ACCS: 

Here's the upload form that follows from the above:

After a bit, the application is available in my dashboard, as can be seen below, with a Java SE icon:

Next, now that the application is contained and deployed by ACCS, when I go to the REST endpoint in the browser I can see the JSON payload:

The final step is to create a user interface in JET:

Here's the JavaScript side of my JET module:

define(['ojs/ojcore', 'knockout', 'ojs/ojtable', 'ojs/ojdatacollection-common'
], function (oj, ko) {
function GeneratedContentViewModel() {
var self = this;
self.data = ko.observableArray();
then(function (json) {
$.each(json, function () {
birthday: this.birthday,
city: this.city,
firstName: this.firstName,
lastName: this.lastName
self.datasource = new oj.ArrayTableDataSource(
{idAttribute: 'birthday'}
return GeneratedContentViewModel;

Note: In the above, make sure that the value of 'idAttribute' is an existing column. For the sake of this example, where there's no unique ID, I'm using 'birthday' instead.

And here's the HTML: 

<h1>Customer View</h1>
<table id="table"
data-bind="ojComponent: {
component: 'ojTable',
data: datasource,
columns: [
{headerText: 'Name', field: 'firstName'},
{headerText: 'Surname', field: 'lastName'},
{headerText: 'Birthday', field: 'birthday'},
{headerText: 'City', field: 'city'},

The above is a simple end-to-end scenario of ACCS providing the backend and Oracle JET the frontend of an enterprise application.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.