Skip to content

Commit 3ac1a72

Browse files
authored
Improvements on HttpExecutor (#912)
Signed-off-by: fjtirado <ftirados@redhat.com>
1 parent e93e4c6 commit 3ac1a72

File tree

3 files changed

+18
-46
lines changed

3 files changed

+18
-46
lines changed

impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/ExpressionURISupplier.java

Lines changed: 0 additions & 38 deletions
This file was deleted.

impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutor.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,17 @@ public static TargetSupplier getURISupplier(UriTemplate template) {
197197
}
198198
throw new IllegalArgumentException("Invalid uritemplate definition " + template);
199199
}
200+
201+
private static class ExpressionURISupplier implements TargetSupplier {
202+
private WorkflowValueResolver<String> expr;
203+
204+
public ExpressionURISupplier(WorkflowValueResolver<String> expr) {
205+
this.expr = expr;
206+
}
207+
208+
@Override
209+
public WebTarget apply(WorkflowContext workflow, TaskContext task, WorkflowModel node) {
210+
return client.target(expr.apply(workflow, task, node));
211+
}
212+
}
200213
}

impl/openapi/src/main/java/io/serverlessworkflow/impl/executors/openapi/OperationDefinitionSupplier.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,17 @@
2727

2828
class OperationDefinitionSupplier {
2929

30-
private final WorkflowApplication application;
31-
private final OpenAPIArguments with;
30+
private final String operationId;
31+
private final TargetSupplier targetSupplier;
3232

3333
OperationDefinitionSupplier(WorkflowApplication application, OpenAPIArguments with) {
34-
this.with = with;
35-
this.application = application;
34+
this.operationId = with.getOperationId();
35+
this.targetSupplier =
36+
getTargetSupplier(with.getDocument().getEndpoint(), application.expressionFactory());
3637
}
3738

3839
OperationDefinition get(
3940
WorkflowContext workflowContext, TaskContext taskContext, WorkflowModel input) {
40-
TargetSupplier targetSupplier =
41-
getTargetSupplier(with.getDocument().getEndpoint(), application.expressionFactory());
42-
43-
String operationId = with.getOperationId();
4441
WebTarget webTarget = targetSupplier.apply(workflowContext, taskContext, input);
4542
OpenAPIProcessor processor = new OpenAPIProcessor(operationId, webTarget.getUri());
4643
return processor.parse();

0 commit comments

Comments
 (0)