Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
package io.avaje.http.generator.core;

import java.util.HashSet;
import java.util.Set;

class RequestScopeTypes {

private static final String JAVALIN_CONTEXT = "io.javalin.http.Context";
private static final String JEX_CONTEXT = "io.avaje.jex.http.Context";
private static final String HELIDON_REQ = "io.helidon.webserver.ServerRequest";
private static final String HELIDON_RES = "io.helidon.webserver.ServerResponse";
private static final Set<String> TYPES = new HashSet<>();

static {
TYPES.add(JAVALIN_CONTEXT);
TYPES.add(HELIDON_REQ);
TYPES.add(HELIDON_RES);
}
private static final Set<String> TYPES =
Set.of(JAVALIN_CONTEXT, JEX_CONTEXT, HELIDON_REQ, HELIDON_RES);

/**
* Return true if the type is a request scoped type.
*/
/** Return true if the type is a request scoped type. */
static boolean isRequestType(String rawType) {
return TYPES.contains(rawType);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.example.web.myapp;

import io.avaje.http.api.Controller;
import io.avaje.http.api.Get;
import io.avaje.http.api.Produces;
import io.avaje.jex.http.Context;
import jakarta.inject.Inject;

@Controller("/req-scoped")
class ReqScopedController {

@Inject
Context context;

@Produces("text/plain")
@Get
String getSimple() {
return context.fullUrl();
}
}