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
Expand Up @@ -32,7 +32,7 @@
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;

import io.quarkus.deployment.IsNormal;
import io.quarkus.deployment.IsProduction;
import io.quarkus.deployment.pkg.builditem.UberJarMergedResourceBuildItem;
import org.atteo.xmlcombiner.XmlCombiner;
import org.jboss.logging.Logger;
Expand Down Expand Up @@ -61,7 +61,7 @@ public class FacesUberJarProcessor
*
* @param producer The build item producer for creating `UberJarMergedResourceBuildItem` instances.
*/
@BuildStep(onlyIf = IsNormal.class)
@BuildStep(onlyIf = IsProduction.class)
void uberJarServiceLoaders(BuildProducer<UberJarMergedResourceBuildItem> producer)
{
List<String> serviceFiles = List.of(
Expand Down Expand Up @@ -89,7 +89,7 @@ void uberJarServiceLoaders(BuildProducer<UberJarMergedResourceBuildItem> produce
* @param generatedResourcesProducer the producer to add generated resources
* @param packageConfig the package configuration to check for UBER_JAR type
*/
@BuildStep(onlyIf = IsNormal.class)
@BuildStep(onlyIf = IsProduction.class)
void uberJarXmlFiles(BuildProducer<GeneratedResourceBuildItem> generatedResourcesProducer,
PackageConfig packageConfig)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.apache.myfaces.core.extensions.quarkus.deployment;

import java.io.IOException;
import java.lang.reflect.Modifier;
import java.nio.file.Files;
import java.util.ArrayList;
Expand Down Expand Up @@ -235,15 +234,19 @@ void buildFeature(BuildProducer<FeatureBuildItem> feature)

@BuildStep
void buildServlet(WebMetadataBuildItem webMetaDataBuildItem,
BuildProducer<FeatureBuildItem> feature,
BuildProducer<ServletBuildItem> servlet,
BuildProducer<ListenerBuildItem> listener) throws IOException
BuildProducer<ListenerBuildItem> listener)
{
WebMetaData webMetaData = webMetaDataBuildItem.getWebMetaData();

boolean extensionlessViews = webMetaData.getContextParams().stream().anyMatch(p ->
FacesServlet.AUTOMATIC_EXTENSIONLESS_MAPPING_PARAM_NAME.equals(p.getParamName())
&& "true".equals(p.getParamValue()));
boolean extensionlessViews = false;

if (webMetaData.getContextParams() != null)
{
extensionlessViews = webMetaData.getContextParams().stream().anyMatch(p ->
FacesServlet.AUTOMATIC_EXTENSIONLESS_MAPPING_PARAM_NAME.equals(p.getParamName())
&& "true".equals(p.getParamValue()));
}

// handle jakarta.faces.AUTOMATIC_EXTENSIONLESS_MAPPING
Set<String> extensionlessViewMappings = extensionlessViews
Expand Down Expand Up @@ -284,7 +287,7 @@ void buildServlet(WebMetadataBuildItem webMetaDataBuildItem,
}
else if (!extensionlessViewMappings.isEmpty())
{
// in case when there are extensionless views enabled, we have add mappings for it
// in case when there are extensionless views enabled, we have added mappings for it
// this is currently only possible by re-register the FacesServlet
// https://github.com/quarkusio/quarkus/issues/49705
builder = createServletBuilderFromMetaData(webMetaData, facesServlet);
Expand Down Expand Up @@ -471,12 +474,12 @@ void buildFlowScopedMapping(MyFacesRecorder recorder,

@BuildStep
@Record(ExecutionTime.STATIC_INIT)
void collectTopLevelViews(MyFacesRecorder recorder) throws IOException
void collectTopLevelViews(MyFacesRecorder recorder)
{
findTopLevelViews().forEach(recorder::registerTopLevelView);
}

Set<String> findTopLevelViews() throws IOException
Set<String> findTopLevelViews()
{
Set<String> topLevelViews = new HashSet<>();
visitRuntimeMetaInfResources(visit ->
Expand All @@ -499,7 +502,7 @@ else if (!Files.isDirectory(visit.getPath()))
return;
}

String viewId = "/" + visit.getRelativePath().toString()
String viewId = "/" + visit.getRelativePath()
.replace("META-INF/resources/", "");
topLevelViews.add(viewId);
}
Expand Down Expand Up @@ -766,7 +769,7 @@ public List<String> collectSubclasses(CombinedIndexBuildItem combinedIndex, Stri
public List<String> collectImplementors(CombinedIndexBuildItem combinedIndex, String className)
{
List<String> classes = combinedIndex.getIndex()
.getAllKnownImplementors(DotName.createSimple(className))
.getAllKnownImplementations(DotName.createSimple(className))
.stream()
.map(ClassInfo::toString)
.collect(Collectors.toList());
Expand Down Expand Up @@ -996,13 +999,16 @@ private ServletBuildItem.Builder createServletBuilderFromMetaData(WebMetaData we
ServletBuildItem.Builder builder = ServletBuildItem.builder(servletMeta.getName(),
servletMeta.getServletClass());

webMetaData.getServletMappings().forEach(mapping ->
if (webMetaData.getServletMappings() != null)
{
if (servletMeta.getName().equals(mapping.getServletName()))
webMetaData.getServletMappings().forEach(mapping ->
{
mapping.getUrlPatterns().forEach(builder::addMapping);
}
});
if (servletMeta.getName().equals(mapping.getServletName()))
{
mapping.getUrlPatterns().forEach(builder::addMapping);
}
});
}
if (servletMeta.getInitParam() != null)
{
servletMeta.getInitParam()
Expand Down