Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename BuildItem and remove unused method #17781

Merged
merged 2 commits into from
Jun 9, 2021
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
Expand Up @@ -57,7 +57,7 @@
import io.quarkus.resteasy.server.common.spi.AdditionalJaxRsResourceMethodAnnotationsBuildItem;
import io.quarkus.resteasy.server.common.spi.AdditionalJaxRsResourceMethodParamAnnotations;
import io.quarkus.spring.web.runtime.ResponseStatusExceptionMapper;
import io.quarkus.undertow.deployment.BlacklistedServletContainerInitializerBuildItem;
import io.quarkus.undertow.deployment.IgnoredServletContainerInitializerBuildItem;
import io.quarkus.undertow.deployment.ServletInitParamBuildItem;

public class SpringWebProcessor {
Expand Down Expand Up @@ -107,8 +107,8 @@ FeatureBuildItem registerFeature() {
}

@BuildStep
public BlacklistedServletContainerInitializerBuildItem blacklistSpringServlet() {
return new BlacklistedServletContainerInitializerBuildItem("org.springframework.web.SpringServletContainerInitializer");
public IgnoredServletContainerInitializerBuildItem ignoreSpringServlet() {
return new IgnoredServletContainerInitializerBuildItem("org.springframework.web.SpringServletContainerInitializer");
}

@BuildStep
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,27 +246,33 @@ public void registerUndertowHandlersConf(BuildProducer<ServletExtensionBuildItem
}
}

@BuildStep
List<IgnoredServletContainerInitializerBuildItem> translateDeprecated(
List<BlacklistedServletContainerInitializerBuildItem> old) {
return old.stream().map(BlacklistedServletContainerInitializerBuildItem::getSciClass)
.map(IgnoredServletContainerInitializerBuildItem::new).collect(Collectors.toList());
}

/*
* look for Servlet container initializers
*
*/
@BuildStep
public List<ServletContainerInitializerBuildItem> servletContainerInitializer(
ApplicationArchivesBuildItem archives,
CombinedIndexBuildItem combinedIndexBuildItem,
List<BlacklistedServletContainerInitializerBuildItem> blacklistedBuildItems,
List<IgnoredServletContainerInitializerBuildItem> ignoredScis,
BuildProducer<AdditionalBeanBuildItem> beans) throws IOException {

Set<String> blacklistedClassNames = new HashSet<>();
for (BlacklistedServletContainerInitializerBuildItem bi : blacklistedBuildItems) {
blacklistedClassNames.add(bi.getSciClass());
Set<String> ignoredClassNames = new HashSet<>();
for (IgnoredServletContainerInitializerBuildItem bi : ignoredScis) {
ignoredClassNames.add(bi.getSciClass());
}
List<ServletContainerInitializerBuildItem> ret = new ArrayList<>();
Set<String> initializers = ServiceUtil.classNamesNamedIn(Thread.currentThread().getContextClassLoader(),
SERVLET_CONTAINER_INITIALIZER);

for (String initializer : initializers) {
if (blacklistedClassNames.contains(initializer)) {
if (ignoredClassNames.contains(initializer)) {
continue;
}
beans.produce(AdditionalBeanBuildItem.unremovableOf(initializer));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

import io.quarkus.builder.item.MultiBuildItem;

/**
* Use {@link IgnoredServletContainerInitializerBuildItem} instead
*/
@Deprecated
public final class BlacklistedServletContainerInitializerBuildItem extends MultiBuildItem {

final String sciClass;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.quarkus.undertow.deployment;

import io.quarkus.builder.item.MultiBuildItem;

public final class IgnoredServletContainerInitializerBuildItem extends MultiBuildItem {

final String sciClass;

public IgnoredServletContainerInitializerBuildItem(String sciClass) {
this.sciClass = sciClass;
}

public String getSciClass() {
return sciClass;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,6 @@ public static boolean isTextLike(MediaType mediaType) {
&& mediaType.getSubtype().toLowerCase().startsWith("xml"));
}

public static boolean isBlacklisted(MediaType mediaType) {
return "application".equals(mediaType.getType()) && "signed-exchange".equals(mediaType.getSubtype());
}

public static boolean isUnsupportedWildcardSubtype(MediaType mediaType) {
if (mediaType.isWildcardSubtype()) {
return !mediaType.isWildcardType() && !"application".equals(mediaType.getType());
Expand Down