|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.groovy.grails.commons.GrailsResourceUtils
public class GrailsResourceUtils
Utility methods for working with Grails resources and URLs that represent artifacts within a Grails application.
Field Summary | |
---|---|
static 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_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_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 |
static Pattern[] |
patterns
|
Method Summary | |
---|---|
static Resource
|
getAppDir(Resource resource)
|
static java.lang.String
|
getClassName(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 java.lang.String
|
getRelativeInsideWebInf(Resource resource)
Takes a Grails resource (one located inside the grails-app dir) and gets its relative path inside the WEB-INF directory when deployed. |
static java.lang.String
|
getStaticResourcePathForResource(Resource resource, java.lang.String contextPath)
Retrieves the static resource path for the given Grails resource artifact (controller/taglib etc.) |
static Resource
|
getViewsDir(Resource resource)
|
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(Resource r)
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), 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 |
---|
public static Pattern[] COMPILER_ROOT_PATTERNS
public static java.util.regex.Pattern DOMAIN_PATH_PATTERN
public static final java.lang.String GRAILS_APP_DIR
public static final java.util.regex.Pattern GRAILS_RESOURCE_PATTERN_FIFTH_MATCH
public static final java.util.regex.Pattern GRAILS_RESOURCE_PATTERN_FIRST_MATCH
public static final java.util.regex.Pattern GRAILS_RESOURCE_PATTERN_FOURTH_MATCH
public static final java.util.regex.Pattern GRAILS_RESOURCE_PATTERN_SECOND_MATCH
public static final java.util.regex.Pattern GRAILS_RESOURCE_PATTERN_SIXTH_MATCH
public static final java.util.regex.Pattern GRAILS_RESOURCE_PATTERN_THIRD_MATCH
public static java.util.regex.Pattern RESOURCE_PATH_PATTERN
public static java.util.regex.Pattern SPRING_SCRIPTS_PATH_PATTERN
public static final java.lang.String VIEWS_DIR_PATH
public static final java.lang.String WEB_APP_DIR
public static final java.lang.String WEB_INF
public static final Pattern[] patterns
Method Detail |
---|
public static Resource getAppDir(Resource resource)
public static java.lang.String getClassName(Resource resource)
resource
- The Spring Resource
public static java.lang.String getClassName(java.lang.String path)
path
- The path to check
public static java.lang.String getPathFromRoot(java.lang.String path)
path
- The path to evaluate
public static java.lang.String getRelativeInsideWebInf(Resource resource)
resource
- The Grails resource, which is a file inside the grails-app dir
public static java.lang.String getStaticResourcePathForResource(Resource resource, java.lang.String contextPath)
resource
- The ResourcecontextPath
- The additonal context path to prefix
public static Resource getViewsDir(Resource resource)
public static boolean isDomainClass(java.net.URL url)
url
- The URL instance
public static boolean isGrailsPath(java.lang.String path)
path
- The path to check
public static boolean isGrailsResource(Resource r)
Groovy Documentation