An open API service indexing awesome lists of open source software.

https://github.com/giosil/wrapp

A configurable web application.
https://github.com/giosil/wrapp

java javaee javascript web webapp webapplication

Last synced: 5 months ago
JSON representation

A configurable web application.

Awesome Lists containing this project

README

          

# Wrapp

There are aspects of a web application that are transversal with respect to the GUI implemented in the individual pages as:

* Theme (css, scripts, header, footer, etc.);
* User access (login, logout, etc.);
* Configuration (locale, parameters, etc.);
* Log management;
* Menu management;
* Auditing and monitoring (accesses, visited pages, etc.).

**Wrapp** is a web application that allows you to easily implement all the aspects listed above in a structured way.

With **Wrapp** you can **WR**ap your web **APP**lication and deploy your services separately in independent modules (for example war, but also modules written in other languages).

**Wrapp** is configurable via the "wrapp_config.json" file in {user.home}/cfg or in resources folder.

In that you can configure:

* "locale": language-country-variant;
* "app": implementation of *org.dew.wrapp.mgr.IAppManager*;
* "login": implementation of *org.dew.wrapp.mgr.ILoginManager*;
* "menu": implementation of *org.dew.wrapp.mgr.AMenuManager*.

Example:

```json
{
"public": {
"name": "Wrapp",
"version": "1.0.0",
"theme": "",
"locale": "en"
},
"private": {
"logo": "

$app.name

",
"app": "org.dew.wrapp.impl.DefaultAppManager",
"login": "org.dew.wrapp.impl.DefaultLoginManager",
"menu": "org.dew.wrapp.impl.DefaultMenuManager"
}
}
```

In **Wrapp** each page is mapped by the *Page* object and can be called up from the URL page/{id}.

*Page* object has the following fields:

```json
{
"id": "hello",
"title": "en=Hello page^it=Pagina di saluto^fr=Salutation^es=P�gina de saludo",
"description": "en=Example of Wrapp page^it=Esempio di pagina Wrapp^fr=Exemple de page Wrapp^es=Ejemplo de p�gina Wrapp",
"layout": "default",
"modifier": "private",
"header": "",
"content": "",
"footer": "",
"script": "WuxDOM.render(new GUI.HelloWorld(), 'view-root');",
"css": [
"/hello/css/main.css"
],
"scripts": [
"/wrapp/wux/js/wux.min.js",
"/hello/js/res-$language.min.js",
"/hello/js/hello.min.js"
],
"attributes": {
"align": "center"
}
}
```

The *hello* page has URL page/**hello** and the related jsp page is src/main/webapp/layouts/**default**.jsp (from *layout*).

When a module is deployed it should call the GET method *wrapp/api/update?module={moduleName}* of Wrapp REST API.

This call allows to append the correct timestamp to the css and imported scripts provided by that module.

As far as the menus are concerned, it is possible to define several hierarchical menus and make the items visible with respect to user authorizations.

Each menu is identified by an id and is made up of a list of MenuItem object.

Here is a sample menu.

```json
{
"main": [
{ "id": "app", "text": "en=Application^it=Applicazione^fr=Application^es=Aplicaci�n", "icon": "fa-edit" },
{ "id": "app.hello", "text": "en=Hello^it=Saluto^fr=Salutation^es=saludo", "icon": null, "link": "page/hello"}
]
}
```

You can implement your own org.dew.wrapp.mgr.IAppManager by loading menus and pages for example from a database or from a nosql.

## REST API

### Reload
Reload Web App configuration, pages and menus.

Request:

**GET** `http://localhost:8080/wrapp/api/reload`

Response:

HTTP 204 No Content

### Refresh
Update reference of a module appending timestamp in css and script imports.

Request:

**GET** `http://localhost:8080/wrapp/api/refresh?module={moduleName}`

Response:

HTTP 204 No Content

### No Operation
Used to keep the session active or to ping webapp.

Request:

**GET** `http://localhost:8080/wrapp/api/nop`

Response:

HTTP 204 No Content

### User
Get user logged in current session.

Request:

**GET** `http://localhost:8080/wrapp/api/user`

Response:

HTTP 200 OK

Content-Type: application/json

{"userName":"test","role":"admin","tokenId":"..."}

### Update
Update password of logged user.

Request:

**POST** `http://localhost:8080/wrapp/api/update`

`op=oldPassowrd&np=newPasswrd`

Response:

HTTP 204 No Content

Response: (if old password is incorrect, new password is invalid or user is not logged)

HTTP 403 Forbidden

## Contributors

* [Giorgio Silvestris](https://github.com/giosil)