Class Groovy.Script
- java.lang.Object
-
- ratpack.groovy.Groovy.Script
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_APP_PATH
"ratpack.groovy".static String
DEFAULT_BINDINGS_PATH
"bindings.groovy".static String
DEFAULT_HANDLERS_PATH
"handlers.groovy".
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Action<? super RatpackServerSpec>
app()
Creates an application defining action from a Groovy script named "ratpack.groovy".static Action<? super RatpackServerSpec>
app(boolean compileStatic)
Creates an application defining action from a Groovy script named "ratpack.groovy".static Action<? super RatpackServerSpec>
app(boolean compileStatic, String... scriptPaths)
Creates an application defining action from a Groovy script.static Action<? super RatpackServerSpec>
app(boolean compileStatic, Path script)
Creates an application defining action from a Groovy script.static Action<? super RatpackServerSpec>
app(Path script)
Creates an application defining action from a Groovy script.static Action<? super RatpackServerSpec>
appWithArgs(boolean compileStatic, String[] scriptPaths, String... args)
Creates an application defining action from a Groovy script.static Action<? super RatpackServerSpec>
appWithArgs(boolean compileStatic, Path script, String... args)
Creates an application defining action from a Groovy script.static Action<? super RatpackServerSpec>
appWithArgs(String... args)
Creates an application defining action from a Groovy script named "ratpack.groovy".static Function<Registry,Registry>
bindings()
Creates a registry building function from a Groovy script named "bindings.groovy".static Function<Registry,Registry>
bindings(boolean compileStatic)
Creates a registry building function from a Groovy script named "bindings.groovy".static Function<Registry,Registry>
bindings(boolean compileStatic, String scriptPath)
Creates a registry building function from a Groovy script.static Function<Registry,Registry>
bindingsWithArgs(boolean compileStatic, String scriptPath, String... args)
Creates a registry building function from a Groovy script.static void
checkGroovy()
Asserts that the version of Groovy on the classpath meets the minimum requirement for Ratpack.static Function<Registry,Handler>
handlers()
Creates a handler defining function from a "handlers.groovy" Groovy script.static Function<Registry,Handler>
handlers(boolean compileStatic)
Creates a handler defining function from a "handlers.groovy" Groovy script.static Function<Registry,Handler>
handlers(boolean compileStatic, String scriptPath)
Creates a handler defining function from a Groovy script.static Function<Registry,Handler>
handlersWithArgs(boolean compileStatic, String scriptPath, String... args)
Creates a handler defining function from a Groovy script.
-
-
-
Field Detail
-
DEFAULT_HANDLERS_PATH
public static final String DEFAULT_HANDLERS_PATH
"handlers.groovy".- See Also:
- Constant Field Values
-
DEFAULT_BINDINGS_PATH
public static final String DEFAULT_BINDINGS_PATH
"bindings.groovy".- See Also:
- Constant Field Values
-
DEFAULT_APP_PATH
public static final String DEFAULT_APP_PATH
"ratpack.groovy".- See Also:
- Constant Field Values
-
-
Method Detail
-
checkGroovy
public static void checkGroovy()
Asserts that the version of Groovy on the classpath meets the minimum requirement for Ratpack.
-
app
public static Action<? super RatpackServerSpec> app()
Creates an application defining action from a Groovy script named "ratpack.groovy".This method returns an action that can be used with
RatpackServer.of(Action)
to create an application.The script should call the
Groovy.ratpack(Closure)
method.- Returns:
- an application definition action
-
app
public static Action<? super RatpackServerSpec> app(boolean compileStatic)
Creates an application defining action from a Groovy script named "ratpack.groovy".This method returns an action that can be used with
RatpackServer.of(Action)
to create an application.The script should call the
Groovy.ratpack(Closure)
method.- Parameters:
compileStatic
- whether to statically compile the script- Returns:
- an application definition action
-
app
public static Action<? super RatpackServerSpec> app(Path script)
Creates an application defining action from a Groovy script.This method returns an action that can be used with
RatpackServer.of(Action)
to create an application.The script should call the
Groovy.ratpack(Closure)
method.- Parameters:
script
- the script- Returns:
- an application definition action
-
app
public static Action<? super RatpackServerSpec> app(boolean compileStatic, Path script)
Creates an application defining action from a Groovy script.This method returns an action that can be used with
RatpackServer.of(Action)
to create an application.The script should call the
Groovy.ratpack(Closure)
method.- Parameters:
compileStatic
- whether to statically compile the scriptscript
- the script- Returns:
- an application definition action
-
app
public static Action<? super RatpackServerSpec> app(boolean compileStatic, String... scriptPaths)
Creates an application defining action from a Groovy script.This method returns an action that can be used with
RatpackServer.of(Action)
to create an application.The script should call the
Groovy.ratpack(Closure)
method.- Parameters:
compileStatic
- whether to statically compile the scriptscriptPaths
- the potential paths to the scripts (first existing is used)- Returns:
- an application definition action
-
appWithArgs
public static Action<? super RatpackServerSpec> appWithArgs(String... args)
Creates an application defining action from a Groovy script named "ratpack.groovy".This method returns an action that can be used with
RatpackServer.of(Action)
to create an application.The script should call the
Groovy.ratpack(Closure)
method.- Parameters:
args
- args to make available to the script via theargs
variable- Returns:
- an application definition action
- Since:
- 1.1
-
appWithArgs
public static Action<? super RatpackServerSpec> appWithArgs(boolean compileStatic, Path script, String... args)
Creates an application defining action from a Groovy script.This method returns an action that can be used with
RatpackServer.of(Action)
to create an application.The script should call the
Groovy.ratpack(Closure)
method.- Parameters:
compileStatic
- whether to statically compile the scriptscript
- the scriptargs
- args to make available to the script via theargs
variable- Returns:
- an application definition action
- Since:
- 1.1
-
appWithArgs
public static Action<? super RatpackServerSpec> appWithArgs(boolean compileStatic, String[] scriptPaths, String... args)
Creates an application defining action from a Groovy script.This method returns an action that can be used with
RatpackServer.of(Action)
to create an application.The script should call the
Groovy.ratpack(Closure)
method.- Parameters:
compileStatic
- whether to statically compile the scriptscriptPaths
- the potential paths to the scripts (first existing is used)args
- args to make available to the script via theargs
variable- Returns:
- an application definition action
- Since:
- 1.1
-
handlers
public static Function<Registry,Handler> handlers()
Creates a handler defining function from a "handlers.groovy" Groovy script.This method returns a function that can be used with
RatpackServerSpec.handler(Function)
when bootstrapping.The script should call the
Groovy.ratpack(Closure)
method, and only invoke theGroovy.Ratpack.handlers(Closure)
method.- Returns:
- a handler definition function
-
handlers
public static Function<Registry,Handler> handlers(boolean compileStatic)
Creates a handler defining function from a "handlers.groovy" Groovy script.This method returns a function that can be used with
RatpackServerSpec.handler(Function)
when bootstrapping.The script should call the
Groovy.ratpack(Closure)
method, and only invoke theGroovy.Ratpack.handlers(Closure)
method.- Parameters:
compileStatic
- whether to statically compile the script- Returns:
- a handler definition function
-
handlers
public static Function<Registry,Handler> handlers(boolean compileStatic, String scriptPath)
Creates a handler defining function from a Groovy script.This method returns a function that can be used with
RatpackServerSpec.handler(Function)
when bootstrapping.The script should call the
Groovy.ratpack(Closure)
method, and only invoke theGroovy.Ratpack.handlers(Closure)
method.- Parameters:
compileStatic
- whether to statically compile the scriptscriptPath
- the path to the script- Returns:
- a handler definition function
-
handlersWithArgs
public static Function<Registry,Handler> handlersWithArgs(boolean compileStatic, String scriptPath, String... args)
Creates a handler defining function from a Groovy script.This method returns a function that can be used with
RatpackServerSpec.handler(Function)
when bootstrapping.The script should call the
Groovy.ratpack(Closure)
method, and only invoke theGroovy.Ratpack.handlers(Closure)
method.- Parameters:
compileStatic
- whether to statically compile the scriptscriptPath
- the path to the scriptargs
- args to make available to the script via theargs
variable- Returns:
- a handler definition function
- Since:
- 1.1
-
bindings
public static Function<Registry,Registry> bindings()
Creates a registry building function from a Groovy script named "bindings.groovy".This method returns a function that can be used with
RatpackServerSpec.registry(Function)
when bootstrapping.The script should call the
Groovy.ratpack(Closure)
method, and only invoke theGroovy.Ratpack.bindings(Closure)
method.- Returns:
- a registry definition function
-
bindings
public static Function<Registry,Registry> bindings(boolean compileStatic)
Creates a registry building function from a Groovy script named "bindings.groovy".This method returns a function that can be used with
RatpackServerSpec.registry(Function)
when bootstrapping.The script should call the
Groovy.ratpack(Closure)
method, and only invoke theGroovy.Ratpack.bindings(Closure)
method.- Parameters:
compileStatic
- whether to statically compile the script- Returns:
- a registry definition function
-
bindings
public static Function<Registry,Registry> bindings(boolean compileStatic, String scriptPath)
Creates a registry building function from a Groovy script.This method returns a function that can be used with
RatpackServerSpec.registry(Function)
when bootstrapping.The script should call the
Groovy.ratpack(Closure)
method, and only invoke theGroovy.Ratpack.bindings(Closure)
method.- Parameters:
compileStatic
- whether to statically compile the scriptscriptPath
- the path to the script- Returns:
- a registry definition function
-
bindingsWithArgs
public static Function<Registry,Registry> bindingsWithArgs(boolean compileStatic, String scriptPath, String... args)
Creates a registry building function from a Groovy script.This method returns a function that can be used with
RatpackServerSpec.registry(Function)
when bootstrapping.The script should call the
Groovy.ratpack(Closure)
method, and only invoke theGroovy.Ratpack.bindings(Closure)
method.- Parameters:
compileStatic
- whether to statically compile the scriptscriptPath
- the path to the scriptargs
- args to make available to the script via theargs
variable- Returns:
- a registry definition function
- Since:
- 1.1
-
-