Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Create UrlMappings file with proper file name. #1

Description

@rpalcolea

This is an enhancement ticket.

Context

apache/grails-core#9657
https://grails.slack.com/archives/plugins/p1471423052000063

People has issues with the naming convention for the UrlMappings file in plugins.

Proposal

Prepend the plugin name to the UrlMappings filename to prevent unpredictable results.

Solution

I was thinking on adding the following to the profile.yml but is already present

excludes:
  - grails-app/controllers/UrlMappings.groovy

I would like to know how to exclude the default UrlMappings.groovy that comes from the web profile

After that, create the UrlMappings artifact as follows:

@grails.codegen.projectClassName@UrlMappings.groovy

package @grails.codegen.defaultPackage@

class @grails.codegen.projectClassName@UrlMappings {

    static mappings = {
        "/$controller/$action?/$id?(.$format)?"{
            constraints {
                // apply constraints here
            }
        }

        "/"(view:"/index")
        "500"(view:'/error')
        "404"(view:'/notFound')
    }
}

Is this something that could generate value this profile?

What do you think? Is this something that you would like to have?

Thanks

Roberto

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions