Deploy a Grails App on AWS Beanstalk

Hi,

sometimes I use AWS Beanstalk to host my Grails apps.

It’s convenient, especially when it comes to managed databases, and it fulfills its purpose with a reasonable price tag.

Here, you will find a nice description about how to deploy a Grails App to AWS Beanstalk.

 

HTH Johannes

 

Posted in Development, Grails | Tagged , | Leave a comment

Get a URL Mappings Report in Grails 2.3

With Grails 2.3 you can get a report about your URL Mappings.

To get the report, just execute:

grails url-mappings-report

Then you will get an output similar to this:

|Loading Grails 2.3.7
|Configuring classpath
|Environment set to development
|URL Mappings Configured for Application
|---------------------------------------
Dynamic Mappings
| * | /${controller}/${action}?/${id}?(.${format)?    | Action: (default action)                                       
| * | /                                               | View:   /index                                                 
| * | ERROR: 500                                      | View:   /error                                                 
| * | /viewCities                                     | Action: (default action)                                       Controller: cities
| * | /api/cities                                     | Action: {GET=list, POST=save, PUT=unsupported,DELETE=unsupported}       Controller: city
| GET | /api/city/${id}/create                        | Action: create                                                           | POST| /api/city/${id}                               | Action: save                                                             | GET | /api/city/${id}                               | Action: show                                                             | GET | /api/city/${id}/edit                          | Action: edit                                                             Controller: dbdoc
| * | /dbdoc/${section}?/${filename}?/${table}?/${column}?      | Action: (default action)

HTH Johannes

Posted in Development, Grails | Tagged | Leave a comment

Install Plugins in Grails 2.3

With Grails 2.3 the known Plugin manager is not longer available.
To install a plugin, just follow these steps:

- add the plugin to: BuildConfig.groovy

- execute: grails run-app

If you end up with some errors, then

- execute: grails refresh-dependencies

HTH Johannes

Posted in Development, Grails | Tagged | Leave a comment

Log Raw HTTP Requests/Responses for better Debugging of the REST API (Part 4)

In my previous three blogs, I wrote about creating a REST service, how to exclude properties and to customize the response of the RESTService API.

In this blog, I want to show a simple but effective method to log all requests to REST API.
Continue reading

Posted in Development, Grails | Tagged , , , | Leave a comment

Customize Properties from RESTful Responses and Improve the RESTService API (Part 3)

In my previous two blogs, I wrote about creating a REST API in Grails 2.3.x and how to exclude properties from a REST response.
In this third blog about using REST in Grails 2.3.x, I show how to improve the used RESTService API by customizing the REST response.

This is the standard response of my RESTService:

{
  "class":"com.jolorenz.rest.City",
  "id":1,
  "cityName":"Munich",
  "countryCode":"DE",
  "dateCreated":"2014-02-28T04:24:13Z",
  "lastUpdated":"2014-02-28T04:24:13Z",
  "postalCode":"81927"
}

and this should become the customized response of the RESTService:

{
    "name of city": "Munich",
    "country of city": "DE",
    "last update": "11 Mrz 2014 19:42:40"
  }

As you see, the key and the value of the properties are customized.
So let’s see how to do it in Grails 2.3.x.
Continue reading

Posted in Development, Grails | Tagged , , , | 9 Comments

Exclude Properties from RESTful Responses and Improve the RESTService API (Part 2)

In my previous blog Create a REST API with Grails 2.3.x in 15 Minutes a basic REST service was created. Here I show how to customize and improve the REST API.

Exclude Properties from RESTful Responses

As you have noticed in my previous blog, the REST API delivers the data from the database without any restrictions.
In practice, there are many situations when such a behavior is not suitable or meaningful.
As an example, the class property is contained in the JSON response, but almost useless for the end user.

{
  "class":"com.jolorenz.rest.City",
  "id":1,
  "cityName":"Munich",
  "countryCode":"DE",
  "dateCreated":"2014-02-28T04:24:13Z",
  "lastUpdated":"2014-02-28T04:24:13Z",
  "postalCode":"81927"
}

In practice it is also desired to have a greater control about the response sent from the REST API.
Here I show how to exclude properties (e.g. class property and dateCreated) from the REST response, so we would end up with this response from the REST API:
Continue reading

Posted in Development, Grails | Tagged , , | 3 Comments