Class Groovy.Script
- java.lang.Object
-
- ratpack.groovy.Groovy.Script
-
- Enclosing class:
- Groovy
public abstract static class Groovy.Script extends java.lang.Object
Methods for working with Groovy scripts as application components.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_APP_PATH
"ratpack.groovy"static java.lang.String
DEFAULT_BINDINGS_PATH
"bindings.groovy"static java.lang.String
DEFAULT_HANDLERS_PATH
"handlers.groovy"
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ratpack.func.Action<? super ratpack.server.RatpackServerSpec>
app()
Creates an application defining action from a Groovy script named "ratpack.groovy".static ratpack.func.Action<? super ratpack.server.RatpackServerSpec>
app(boolean compileStatic)
Creates an application defining action from a Groovy script named "ratpack.groovy".static ratpack.func.Action<? super ratpack.server.RatpackServerSpec>
app(boolean compileStatic, java.lang.String... scriptPaths)
Creates an application defining action from a Groovy script.static ratpack.func.Action<? super ratpack.server.RatpackServerSpec>
app(boolean compileStatic, java.nio.file.Path script)
Creates an application defining action from a Groovy script.static ratpack.func.Action<? super ratpack.server.RatpackServerSpec>
app(java.nio.file.Path script)
Creates an application defining action from a Groovy script.static ratpack.func.Action<? super ratpack.server.RatpackServerSpec>
appWithArgs(boolean compileStatic, java.lang.String[] scriptPaths, java.lang.String... args)
Creates an application defining action from a Groovy script.static ratpack.func.Action<? super ratpack.server.RatpackServerSpec>
appWithArgs(boolean compileStatic, java.nio.file.Path script, java.lang.String... args)
Creates an application defining action from a Groovy script.static ratpack.func.Action<? super ratpack.server.RatpackServerSpec>
appWithArgs(java.lang.String... args)
Creates an application defining action from a Groovy script named "ratpack.groovy"static ratpack.func.Function<ratpack.registry.Registry,ratpack.registry.Registry>
bindings()
Creates a registry building function from a Groovy script named "bindings.groovy".static ratpack.func.Function<ratpack.registry.Registry,ratpack.registry.Registry>
bindings(boolean compileStatic)
Creates a registry building function from a Groovy script named "bindings.groovy".static ratpack.func.Function<ratpack.registry.Registry,ratpack.registry.Registry>
bindings(boolean compileStatic, java.lang.String scriptPath)
Creates a registry building function from a Groovy script.static ratpack.func.Function<ratpack.registry.Registry,ratpack.registry.Registry>
bindingsWithArgs(boolean compileStatic, java.lang.String scriptPath, java.lang.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 ratpack.func.Function<ratpack.registry.Registry,ratpack.handling.Handler>
handlers()
Creates a handler defining function from a "handlers.groovy" Groovy script.static ratpack.func.Function<ratpack.registry.Registry,ratpack.handling.Handler>
handlers(boolean compileStatic)
Creates a handler defining function from a "handlers.groovy" Groovy script.static ratpack.func.Function<ratpack.registry.Registry,ratpack.handling.Handler>
handlers(boolean compileStatic, java.lang.String scriptPath)
Creates a handler defining function from a Groovy script.static ratpack.func.Function<ratpack.registry.Registry,ratpack.handling.Handler>
handlersWithArgs(boolean compileStatic, java.lang.String scriptPath, java.lang.String... args)
Creates a handler defining function from a Groovy script.
-
-
-
Field Detail
-
DEFAULT_HANDLERS_PATH
public static final java.lang.String DEFAULT_HANDLERS_PATH
"handlers.groovy"- See Also:
- Constant Field Values
-
DEFAULT_BINDINGS_PATH
public static final java.lang.String DEFAULT_BINDINGS_PATH
"bindings.groovy"- See Also:
- Constant Field Values
-
DEFAULT_APP_PATH
public static final java.lang.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 ratpack.func.Action<? super ratpack.server.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 ratpack.func.Action<? super ratpack.server.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 ratpack.func.Action<? super ratpack.server.RatpackServerSpec> app(java.nio.file.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 ratpack.func.Action<? super ratpack.server.RatpackServerSpec> app(boolean compileStatic, java.nio.file.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 ratpack.func.Action<? super ratpack.server.RatpackServerSpec> app(boolean compileStatic, java.lang.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 ratpack.func.Action<? super ratpack.server.RatpackServerSpec> appWithArgs(java.lang.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 ratpack.func.Action<? super ratpack.server.RatpackServerSpec> appWithArgs(boolean compileStatic, java.nio.file.Path script, java.lang.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 ratpack.func.Action<? super ratpack.server.RatpackServerSpec> appWithArgs(boolean compileStatic, java.lang.String[] scriptPaths, java.lang.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 ratpack.func.Function<ratpack.registry.Registry,ratpack.handling.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 ratpack.func.Function<ratpack.registry.Registry,ratpack.handling.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 ratpack.func.Function<ratpack.registry.Registry,ratpack.handling.Handler> handlers(boolean compileStatic, java.lang.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 ratpack.func.Function<ratpack.registry.Registry,ratpack.handling.Handler> handlersWithArgs(boolean compileStatic, java.lang.String scriptPath, java.lang.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 ratpack.func.Function<ratpack.registry.Registry,ratpack.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 ratpack.func.Function<ratpack.registry.Registry,ratpack.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 ratpack.func.Function<ratpack.registry.Registry,ratpack.registry.Registry> bindings(boolean compileStatic, java.lang.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 ratpack.func.Function<ratpack.registry.Registry,ratpack.registry.Registry> bindingsWithArgs(boolean compileStatic, java.lang.String scriptPath, java.lang.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
-
-