Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.commons
[Java] Class GrailsResourceUtils

    java.lang.Object
      org.codehaus.groovy.grails.commons.GrailsResourceUtils

    @java.lang.Deprecated
    public class GrailsResourceUtils
    extends java.lang.Object

Utility methods for working with Grails resources and URLs that represent artifacts within a Grails application.

deprecated:
  Use org.codehaus.groovy.grails.io.support.GrailsResourceUtils instead

Authors:
  Graeme Rocher

Since:
  0.2

Field Summary
`static java.util.regex.Pattern[]` | `COMPILER_ROOT_PATTERNS`
`static java.util.regex.Pattern` | `DOMAIN_PATH_PATTERN`
`static java.lang.String` | `GRAILS_APP_DIR` The name of the Grails application directory
`static java.util.regex.Pattern` | `GRAILS_RESOURCE_PATTERN_EIGHTH_MATCH`
`static java.util.regex.Pattern` | `GRAILS_RESOURCE_PATTERN_FIFTH_MATCH`
`static java.util.regex.Pattern` | `GRAILS_RESOURCE_PATTERN_FIRST_MATCH`
`static java.util.regex.Pattern` | `GRAILS_RESOURCE_PATTERN_FOURTH_MATCH`
`static java.util.regex.Pattern` | `GRAILS_RESOURCE_PATTERN_SECOND_MATCH`
`static java.util.regex.Pattern` | `GRAILS_RESOURCE_PATTERN_SEVENTH_MATCH`
`static java.util.regex.Pattern` | `GRAILS_RESOURCE_PATTERN_SIXTH_MATCH`
`static java.util.regex.Pattern` | `GRAILS_RESOURCE_PATTERN_THIRD_MATCH`
`static java.util.regex.Pattern` | `RESOURCE_PATH_PATTERN`
`static java.util.regex.Pattern` | `SPRING_SCRIPTS_PATH_PATTERN`
`static java.lang.String` | `VIEWS_DIR_PATH` The path to the views directory
`static java.lang.String` | `WEB_APP_DIR` The name of the Web app dir within Grails
`static java.lang.String` | `WEB_INF` The relative path to the WEB-INF directory

Method Summary
`static java.lang.String` | `appendPiecesForUri(java.lang.String... pieces)` Takes any number of Strings and appends them into a uri, making sure that a forward slash is inserted between each piece and making sure that no duplicate slashes are in the uri
`static java.lang.String` | `getArtefactDirectory(java.lang.String path)` Takes a file path and returns the name of the folder under grails-app i.e:
`static java.lang.String` | `getClassName(org.springframework.core.io.Resource resource)` Gets the class name of the specified Grails resource
`static java.lang.String` | `getClassName(java.lang.String path)` Returns the class name for a Grails resource.
`static java.lang.String` | `getPathFromRoot(java.lang.String path)` Get the path relative to an artefact folder under grails-app i.e:
`static boolean` | `isDomainClass(java.net.URL url)` Checks whether the file referenced by the given url is a domain class
`static boolean` | `isGrailsPath(java.lang.String path)` Checks whether the specified path is a Grails path.
`static boolean` | `isGrailsResource(org.springframework.core.io.Resource r)`

Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### COMPILER_ROOT_PATTERNS

    public static java.util.regex.Pattern[] COMPILER_ROOT_PATTERNS

### DOMAIN_PATH_PATTERN

    public static java.util.regex.Pattern DOMAIN_PATH_PATTERN

### GRAILS_APP_DIR

    public static final java.lang.String GRAILS_APP_DIR

  The name of the Grails application directory

### GRAILS_RESOURCE_PATTERN_EIGHTH_MATCH

    public static final java.util.regex.Pattern GRAILS_RESOURCE_PATTERN_EIGHTH_MATCH

### GRAILS_RESOURCE_PATTERN_FIFTH_MATCH

    public static final java.util.regex.Pattern GRAILS_RESOURCE_PATTERN_FIFTH_MATCH

### GRAILS_RESOURCE_PATTERN_FIRST_MATCH

    public static final java.util.regex.Pattern GRAILS_RESOURCE_PATTERN_FIRST_MATCH

### GRAILS_RESOURCE_PATTERN_FOURTH_MATCH

    public static final java.util.regex.Pattern GRAILS_RESOURCE_PATTERN_FOURTH_MATCH

### GRAILS_RESOURCE_PATTERN_SECOND_MATCH

    public static final java.util.regex.Pattern GRAILS_RESOURCE_PATTERN_SECOND_MATCH

### GRAILS_RESOURCE_PATTERN_SEVENTH_MATCH

    public static final java.util.regex.Pattern GRAILS_RESOURCE_PATTERN_SEVENTH_MATCH

### GRAILS_RESOURCE_PATTERN_SIXTH_MATCH

    public static final java.util.regex.Pattern GRAILS_RESOURCE_PATTERN_SIXTH_MATCH

### GRAILS_RESOURCE_PATTERN_THIRD_MATCH

    public static final java.util.regex.Pattern GRAILS_RESOURCE_PATTERN_THIRD_MATCH

### RESOURCE_PATH_PATTERN

    public static java.util.regex.Pattern RESOURCE_PATH_PATTERN

### SPRING_SCRIPTS_PATH_PATTERN

    public static java.util.regex.Pattern SPRING_SCRIPTS_PATH_PATTERN

### VIEWS_DIR_PATH

    public static final java.lang.String VIEWS_DIR_PATH

  The path to the views directory

### WEB_APP_DIR

    public static final java.lang.String WEB_APP_DIR

  The name of the Web app dir within Grails

### WEB_INF

    public static final java.lang.String WEB_INF

  The relative path to the WEB-INF directory

Method Detail

### appendPiecesForUri

    public static java.lang.String appendPiecesForUri(java.lang.String... pieces)

  Takes any number of Strings and appends them into a uri, making sure that a forward slash is inserted between each piece and making sure that no duplicate slashes are in the uri

       Input: ""
       Output: ""

       Input: "/alpha", "/beta", "/gamma"
       Output: "/alpha/beta/gamma

       Input: "/alpha/, "/beta/", "/gamma"
       Output: "/alpha/beta/gamma

       Input: "/alpha/", "/beta/", "/gamma/"
       Output "/alpha/beta/gamma/

       Input: "alpha", "beta", "gamma"
       Output: "alpha/beta/gamma

  Parameters:
    `pieces` - Strings to concatenate together into a uri
  Returns:
    a uri

### getArtefactDirectory

    public static java.lang.String getArtefactDirectory(java.lang.String path)

  Takes a file path and returns the name of the folder under grails-app i.e: Input: /usr/joe/project/grails-app/domain/com/mystartup/Book.groovy Output: domain
  Parameters:
    `path` - The path
  Returns:
    The domain or null if not known

### getClassName

    public static java.lang.String getClassName(org.springframework.core.io.Resource resource)

  Gets the class name of the specified Grails resource
  Parameters:
    `resource` - The Spring Resource
  Returns:
    The class name or null if the resource is not a Grails class

### getClassName

    public static java.lang.String getClassName(java.lang.String path)

  Returns the class name for a Grails resource.
  Parameters:
    `path` - The path to check
  Returns:
    The class name or null if it doesn't exist

### getPathFromRoot

    public static java.lang.String getPathFromRoot(java.lang.String path)

  Get the path relative to an artefact folder under grails-app i.e: Input: /usr/joe/project/grails-app/conf/BootStrap.groovy Output: BootStrap.groovy Input: /usr/joe/project/grails-app/domain/com/mystartup/Book.groovy Output: com/mystartup/Book.groovy
  Parameters:
    `path` - The path to evaluate
  Returns:
    The path relative to the root folder grails-app

### isDomainClass

    public static boolean isDomainClass(java.net.URL url)

  Checks whether the file referenced by the given url is a domain class
  Parameters:
    `url` - The URL instance
  Returns:
    true if it is a domain class

### isGrailsPath

    public static boolean isGrailsPath(java.lang.String path)

  Checks whether the specified path is a Grails path.
  Parameters:
    `path` - The path to check
  Returns:
    true if it is a Grails path

### isGrailsResource

    public static boolean isGrailsResource(org.springframework.core.io.Resource r)

Groovy Documentation