Running a grails application via Intelli-J with the root set to localhost: 8080 / instead of localhost: 8080 / app or change createLink?

Is there a way to run the application through Intelli-J so that it creates the localhost:8080/root of the application? The problem I am facing is that AJAX URLs that work locally don't work during production, but createLink(action:"ajaxUpdate")seem to create links to /app/ajaxUpdateone that works locally but doesn't work.

Is there a way to fix it createLinkto work in both places? I thought that maybe I could just use UrlMappings to make all ajax calls pretty and just appeal to /ajaxUpdate, but this does not work due to the way the Grails application is deployed inside Intelli-J.

How to fix it?

+1
source share
1 answer

About your problem, in grails-app / conf / Config.groovy , you can specify the server URL, for example:

environments {
    production {

        grails.serverURL = "http://localhost/"  // Specify the "root" of your link
        ....
    }

    development {
        grails.serverURL = "http://localhost:8080/${appName}"
        ...
    }
    ...
}

Then the createLink method must be accurate. As I know, this applies to a non-IntelliJ Grails configuration.

EDIT: I seem to have missed some information: to make createLink starts with "http: // localhost /", you need to add another line to Config.groovy:

grails.app.context = "/"
+5
source

All Articles