Package com.vaadin.browserless.quarkus
Class QuarkusBrowserlessApplicationContext
java.lang.Object
com.vaadin.browserless.quarkus.QuarkusBrowserlessApplicationContext
Factory for creating a Quarkus-integrated
BrowserlessApplicationContext.
Wires a Quarkus-aware servlet and the QuarkusTestLookupInitializer.
Three entry points are provided:
create(UnaryOperator)(and the view-package shortcuts) — returns the unsecuredBrowserlessApplicationContext.createSecured(UnaryOperator)(and the view-package shortcuts) — returns the credential-typedSecuredBrowserlessApplicationContext; requires Quarkus Security on the classpath.builder()— returns a pre-wiredBrowserlessApplicationContext.Builderfor full customization (e.g. a customUIFactoryor a different security handler).
var app = QuarkusBrowserlessApplicationContext
.createSecured(ProtectedView.class);
var admin = app.newUser(securityIdentity);
var window = admin.newWindow();
window.navigate(ProtectedView.class);
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a Quarkus-pre-wired builder.Creates an unsecured Quarkus-integrated application context that scans the packages of the given classes for@Route-annotated views.Creates an unsecured Quarkus-integrated application context that scans the given packages for@Route-annotated views.create(UnaryOperator<BrowserlessApplicationContext.Builder> configurer) Creates an unsecured Quarkus-integrated application context, applying the given configurer to the pre-wired builder before building it.static SecuredBrowserlessApplicationContext<io.quarkus.security.identity.SecurityIdentity> createSecured(Class<?>... viewPackageClasses) Creates a Quarkus-integrated application context with Quarkus Security wiring that scans the packages of the given classes for@Route-annotated views.static SecuredBrowserlessApplicationContext<io.quarkus.security.identity.SecurityIdentity> createSecured(String... viewPackages) Creates a Quarkus-integrated application context with Quarkus Security wiring that scans the given packages for@Route-annotated views.static SecuredBrowserlessApplicationContext<io.quarkus.security.identity.SecurityIdentity> Creates a Quarkus-integrated application context with Quarkus Security wiring, applying the given configurer to the pre-wired builder.
-
Method Details
-
builder
Creates a Quarkus-pre-wired builder. The builder has the Quarkus servlet and the lookup initializer configured; callers can chain additional customizations (including a customUIFactory) before callingBrowserlessApplicationContext.Builder.build().- Returns:
- a pre-wired builder
-
create
Creates an unsecured Quarkus-integrated application context that scans the given packages for@Route-annotated views.- Parameters:
viewPackages- package names to scan for views; an empty array falls back to a full classpath scan- Returns:
- a new unsecured application context configured for Quarkus
-
create
Creates an unsecured Quarkus-integrated application context that scans the packages of the given classes for@Route-annotated views.- Parameters:
viewPackageClasses- classes whose packages should be scanned for views- Returns:
- a new unsecured application context configured for Quarkus
-
create
public static BrowserlessApplicationContext create(UnaryOperator<BrowserlessApplicationContext.Builder> configurer) Creates an unsecured Quarkus-integrated application context, applying the given configurer to the pre-wired builder before building it.- Parameters:
configurer- builder configurer; e.g.b -> b.withViewPackages(...). PassUnaryOperator.identity()to keep defaults.- Returns:
- a new unsecured application context configured for Quarkus
-
createSecured
public static SecuredBrowserlessApplicationContext<io.quarkus.security.identity.SecurityIdentity> createSecured(String... viewPackages) Creates a Quarkus-integrated application context with Quarkus Security wiring that scans the given packages for@Route-annotated views. Requires Quarkus Security on the classpath; throws otherwise.- Parameters:
viewPackages- package names to scan for views- Returns:
- a new secured application context configured for Quarkus Security
- Throws:
IllegalStateException- if Quarkus Security is not on the classpath
-
createSecured
public static SecuredBrowserlessApplicationContext<io.quarkus.security.identity.SecurityIdentity> createSecured(Class<?>... viewPackageClasses) Creates a Quarkus-integrated application context with Quarkus Security wiring that scans the packages of the given classes for@Route-annotated views. Requires Quarkus Security on the classpath; throws otherwise.- Parameters:
viewPackageClasses- classes whose packages should be scanned for views- Returns:
- a new secured application context configured for Quarkus Security
- Throws:
IllegalStateException- if Quarkus Security is not on the classpath
-
createSecured
public static SecuredBrowserlessApplicationContext<io.quarkus.security.identity.SecurityIdentity> createSecured(UnaryOperator<BrowserlessApplicationContext.Builder> configurer) Creates a Quarkus-integrated application context with Quarkus Security wiring, applying the given configurer to the pre-wired builder. Requires Quarkus Security on the classpath; throws otherwise.- Parameters:
configurer- builder configurer- Returns:
- a new secured application context configured for Quarkus Security
- Throws:
IllegalStateException- if Quarkus Security is not on the classpath
-