|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 Pattern |
DOMAIN_PATH_PATTERN
|
static String |
GRAILS_APP_DIR
The name of the Grails application directory |
static Pattern |
GRAILS_RESOURCE_PATTERN_FIFTH_MATCH
|
static Pattern |
GRAILS_RESOURCE_PATTERN_FIRST_MATCH
|
static Pattern |
GRAILS_RESOURCE_PATTERN_FOURTH_MATCH
|
static Pattern |
GRAILS_RESOURCE_PATTERN_SECOND_MATCH
|
static Pattern |
GRAILS_RESOURCE_PATTERN_SIXTH_MATCH
|
static Pattern |
GRAILS_RESOURCE_PATTERN_THIRD_MATCH
|
static Pattern[] |
patterns
|
static Pattern |
RESOURCE_PATH_PATTERN
|
static Pattern |
SPRING_SCRIPTS_PATH_PATTERN
|
static String |
VIEWS_DIR_PATH
The path to the views directory |
static String |
WEB_APP_DIR
The name of the Web app dir within Grails |
static String |
WEB_INF
The relative path to the WEB-INF directory |
Constructor Summary | |
---|---|
GrailsResourceUtils()
|
Method Summary | |
---|---|
static Resource |
getAppDir(Resource resource)
|
static String |
getClassName(Resource resource)
Gets the class name of the specified Grails resource |
static String |
getClassName(String path)
Returns the class name for a Grails resource |
static String |
getPathFromRoot(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 |
static String |
getRelativeInsideWebInf(Resource resource)
This method will take a Grails resource (one located inside the grails-app dir) and get its relative path inside the WEB-INF directory when deployed |
static String |
getStaticResourcePathForResource(Resource resource,
String contextPath)
Retrieves the static resource path for the given Grails resource artifact (controller/taglib etc.) |
static Resource |
getViewsDir(Resource resource)
|
static boolean |
isDomainClass(URL url)
Checks whether the file referenced by the given url is a domain class |
static boolean |
isGrailsPath(String path)
Checks whether the specified path is a Grails path |
static boolean |
isGrailsResource(Resource r)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String WEB_INF
public static final String GRAILS_APP_DIR
public static final String WEB_APP_DIR
public static final String VIEWS_DIR_PATH
public static Pattern DOMAIN_PATH_PATTERN
public static Pattern RESOURCE_PATH_PATTERN
public static Pattern SPRING_SCRIPTS_PATH_PATTERN
public static Pattern[] COMPILER_ROOT_PATTERNS
public static final Pattern GRAILS_RESOURCE_PATTERN_FIRST_MATCH
public static final Pattern GRAILS_RESOURCE_PATTERN_SECOND_MATCH
public static final Pattern GRAILS_RESOURCE_PATTERN_THIRD_MATCH
public static final Pattern GRAILS_RESOURCE_PATTERN_FOURTH_MATCH
public static final Pattern GRAILS_RESOURCE_PATTERN_FIFTH_MATCH
public static final Pattern GRAILS_RESOURCE_PATTERN_SIXTH_MATCH
public static final Pattern[] patterns
Constructor Detail |
---|
public GrailsResourceUtils()
Method Detail |
---|
public static boolean isDomainClass(URL url)
url
- The URL instance
public static String getClassName(Resource resource)
resource
- The Spring Resource
public static String getClassName(String path)
path
- The path to check
public static boolean isGrailsPath(String path)
path
- The path to check
public static boolean isGrailsResource(Resource r)
public static Resource getViewsDir(Resource resource)
public static Resource getAppDir(Resource resource)
public static String getRelativeInsideWebInf(Resource resource)
resource
- The Grails resource, which is a file inside the grails-app dir
public static String getStaticResourcePathForResource(Resource resource, String contextPath)
resource
- The ResourcecontextPath
- The additonal context path to prefix
public static String getPathFromRoot(String path)
path
- The path to evaluate
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |