本文整理了Java中ratpack.func.Action.execute()
方法的一些代码示例,展示了Action.execute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Action.execute()
方法的具体详情如下:
包路径:ratpack.func.Action
类名称:Action
方法名:execute
[英]Executes the action against the given thing.
[中]
代码示例来源:origin: io.ratpack/ratpack-core
@Override
public void onStart(StartEvent event) throws Exception {
action.execute(event);
}
};
代码示例来源:origin: io.ratpack/ratpack-exec
/**
* Creates a block that executes this action with the given value when called.
*
* @param value the value to execute this action with when the block is executed
* @return a new block
*/
default Block curry(T value) {
return () -> execute(value);
}
代码示例来源:origin: io.ratpack/ratpack-exec
@Override
public final void execute(I i) throws Exception {
for (Branch<I> branch : branches) {
if (branch.predicate.apply(i)) {
branch.action.execute(i);
return;
}
}
other.execute(i);
}
}
代码示例来源:origin: io.ratpack/ratpack-test
@Override
public RequestFixture serverConfig(Action<? super ServerConfigBuilder> action) throws Exception {
serverConfigBuilder = ServerConfig.builder();
action.execute(serverConfigBuilder);
return this;
}
代码示例来源:origin: io.ratpack/ratpack-exec
@Override
public void success(O value) {
try {
action.execute(value);
} catch (Throwable e) {
Downstream.this.error(e);
}
}
代码示例来源:origin: io.ratpack/ratpack-core
@Override
public RequestSpec headers(Action<? super MutableHeaders> action) throws Exception {
action.execute(getHeaders());
return this;
}
代码示例来源:origin: io.ratpack/ratpack-core
@Override
public RequestSpec body(Action<? super Body> action) throws Exception {
action.execute(getBody());
return this;
}
}
代码示例来源:origin: io.ratpack/ratpack-core
@Override
public ConfigDataBuilder configureObjectMapper(Action<ObjectMapper> action) {
try {
action.execute(objectMapper);
} catch (Exception ex) {
throw Exceptions.uncheck(ex);
}
return this;
}
代码示例来源:origin: io.ratpack/ratpack-core
@Override
public ObjectNode loadConfigData(ObjectMapper objectMapper, FileSystemBinding fileSystemBinding) throws Exception {
try {
return delegate.loadConfigData(objectMapper, fileSystemBinding);
} catch (Throwable ex) {
errorHandler.execute(ex);
return objectMapper.createObjectNode(); // treat the source as if it had no data
}
}
}
代码示例来源:origin: io.ratpack/ratpack-exec
@Override
public void success(T value) {
try {
then.execute(value);
} catch (Throwable e) {
throwError(e);
}
}
代码示例来源:origin: io.ratpack/ratpack-exec
@Override
void error(Throwable throwable) {
execStream = parent;
try {
onError.execute(throwable);
} catch (Exception e) {
execStream.error(e);
}
}
}
代码示例来源:origin: io.ratpack/ratpack-core
@Override
public void onClose(WebSocketClose<T> close) {
try {
this.close.execute(close);
} catch (Exception e) {
throw uncheck(e);
}
}
代码示例来源:origin: io.ratpack/ratpack-core
@Override
public Body stream(Action<? super OutputStream> action) throws Exception {
ByteBuf byteBuf = byteBufAllocator.buffer();
try (OutputStream outputStream = new ByteBufOutputStream(byteBuf)) {
action.execute(outputStream);
} catch (Throwable t) {
byteBuf.release();
throw t;
}
setBodyByteBuf(byteBuf);
return this;
}
代码示例来源:origin: io.ratpack/ratpack-core
@Override
public void takeOwnership(Action<Object> messageReceiver) {
try {
onTakeOwnership.execute(messageReceiver);
} catch (Exception e) {
throw uncheck(e);
}
}
}
代码示例来源:origin: io.ratpack/ratpack-core
@Override
public void takeOwnership(Action<Object> messageReceiver) {
try {
onTakeOwnership.execute(messageReceiver);
} catch (Exception e) {
throw uncheck(e);
}
}
代码示例来源:origin: io.ratpack/ratpack-core
public static <T> Handler build(final Function<List<Handler>, ? extends T> toChainBuilder, final Action<? super T> chainBuilderAction) throws Exception {
List<Handler> handlers = Lists.newLinkedList();
T chainBuilder = toChainBuilder.apply(handlers);
chainBuilderAction.execute(chainBuilder);
return Handlers.chain(handlers.toArray(new Handler[handlers.size()]));
}
代码示例来源:origin: io.ratpack/ratpack-exec
@Override
public void item(O item) {
try {
itemMapper.execute(item);
} catch (Exception e) {
subscription.cancel();
error(e);
}
}
代码示例来源:origin: io.ratpack/ratpack-core
public static RatpackServerDefinition build(Action<? super RatpackServerSpec> config) throws Exception {
SpecImpl spec = new SpecImpl();
config.execute(spec);
ServerConfig serverConfig = Optional.ofNullable(spec.serverConfig).orElseGet(() -> ServerConfig.builder().build());
return new RatpackServerDefinition(serverConfig, spec.registry, spec.handler);
}
代码示例来源:origin: io.ratpack/ratpack-spring-boot
private Function<Registry, Registry> joinedRegistry(ApplicationContext context) throws Exception {
return baseRegistry -> Guice.registry(bindingSpec -> {
context.getBeansOfType(Module.class).values().forEach(bindingSpec::module);
for (RatpackServerCustomizer customizer : customizers) {
customizer.getBindings().execute(bindingSpec);
}
}).apply(baseRegistry).join(Spring.spring(context));
}
代码示例来源:origin: io.ratpack/ratpack-test
/**
* Creates an embedded application from the given function.
*
* @param definition a function that defines the server
* @return a newly created embedded application
* @throws java.lang.Exception if an error is encountered creating the application
* @see ratpack.server.RatpackServer#of(Action)
*/
static EmbeddedApp of(Action<? super RatpackServerSpec> definition) throws Exception {
return fromServer(RatpackServer.of(d -> definition.execute(new EmbeddedRatpackServerSpec(d))));
}
内容来源于网络,如有侵权,请联系作者删除!