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

WFLY-1393 Shared TLD's not being handled correctly #4551

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public LocationService(String locationPath) {

@Override
public void start(StartContext context) throws StartException {
UndertowLogger.ROOT_LOGGER.infof("registering handler %s under path '%s'", httpHandler, locationPath);
UndertowLogger.ROOT_LOGGER.registeringHandler( httpHandler.getValue(), locationPath);
host.getValue().registerHandler(locationPath, configureHandler());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@

package org.wildfly.extension.undertow;

import static org.jboss.logging.Logger.Level.ERROR;
import static org.jboss.logging.Logger.Level.INFO;
import static org.jboss.logging.Logger.Level.WARN;

import java.net.InetSocketAddress;

import io.undertow.server.HttpHandler;
import org.jboss.as.clustering.web.OutgoingDistributableSessionData;
import org.wildfly.extension.undertow.session.ClusteredSession;
import org.jboss.jandex.ClassInfo;
import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.annotations.Cause;
import org.jboss.logging.annotations.LogMessage;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageLogger;
import org.wildfly.extension.undertow.session.ClusteredSession;

import static org.jboss.logging.Logger.Level.ERROR;
import static org.jboss.logging.Logger.Level.INFO;
import static org.jboss.logging.Logger.Level.WARN;

/**
* <p/>
Expand Down Expand Up @@ -258,4 +258,12 @@ public interface UndertowLogger extends BasicLogger {
@LogMessage(level = WARN)
@Message(id = 17526, value = "Could not create redirect URI.")
void invalidRedirectURI(@Cause Throwable cause);

@LogMessage(level = INFO)
@Message(id = 17527, value = "Creating file handler for path %s")
void creatingFileHandler(String path);

@LogMessage(level = INFO)
@Message(id = 17528, value="registering handler %s under path '%s'")
void registeringHandler(HttpHandler value, String locationPath);
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@
import org.jboss.as.server.deployment.DeploymentUnitProcessor;
import org.jboss.as.server.deployment.SetupAction;
import org.jboss.as.server.deployment.reflect.DeploymentClassIndex;
import org.jboss.metadata.web.spec.TldMetaData;
import org.wildfly.extension.undertow.BufferCacheService;
import org.wildfly.extension.undertow.DeploymentDefinition;
import org.wildfly.extension.undertow.Host;
import org.wildfly.extension.undertow.ServletContainerService;
import org.wildfly.extension.undertow.UndertowExtension;
import org.wildfly.extension.undertow.UndertowService;
import org.jboss.as.web.common.ServletContextAttribute;
import org.jboss.as.web.common.SharedTldsMetaDataBuilder;
import org.jboss.as.web.common.WarMetaData;
import org.jboss.as.web.common.WebComponentDescription;
import org.jboss.as.web.common.WebInjectionContainer;
Expand Down Expand Up @@ -181,6 +181,7 @@ private void processDeployment(final WarMetaData warMetaData, final DeploymentUn

final ServiceName deploymentServiceName = UndertowService.deploymentServiceName(hostName,pathName);

TldsMetaData tldsMetaData = deploymentUnit.getAttachment(TldsMetaData.ATTACHMENT_KEY);
UndertowDeploymentInfoService undertowDeploymentInfoService = UndertowDeploymentInfoService.builder()
.setAttributes(deploymentUnit.getAttachment(ServletContextAttribute.ATTACHMENT_KEY))
.setClassReflectionIndex(deploymentClassIndex)
Expand All @@ -194,8 +195,8 @@ private void processDeployment(final WarMetaData warMetaData, final DeploymentUn
.setScisMetaData(scisMetaData)
.setSecurityContextId(securityContextId)
.setSecurityDomain(securityDomain)
.setSharedTlds(deploymentUnit.getAttachment(SharedTldsMetaDataBuilder.ATTACHMENT_KEY))
.setTldsMetaData(deploymentUnit.getAttachment(TldsMetaData.ATTACHMENT_KEY))
.setSharedTlds(tldsMetaData == null ? Collections.<TldMetaData>emptyList() : tldsMetaData.getSharedTlds(deploymentUnit))
.setTldsMetaData(tldsMetaData)
.setSetupActions(setupActions)
.createUndertowDeploymentInfoService();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.Arrays;
import java.util.Collection;

import io.undertow.UndertowLogger;
import io.undertow.server.HttpHandler;
import io.undertow.server.handlers.resource.FileResourceManager;
import io.undertow.server.handlers.resource.ResourceHandler;
Expand All @@ -39,6 +38,7 @@
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
import org.wildfly.extension.undertow.Constants;
import org.wildfly.extension.undertow.UndertowLogger;

/**
* @author <a href="mailto:tomaz.cerar@redhat.com">Tomaz Cerar</a> (c) 2013 Red Hat Inc.
Expand Down Expand Up @@ -78,7 +78,7 @@ public Collection<AttributeDefinition> getAttributes() {
public HttpHandler createHandler(final OperationContext context, ModelNode model) throws OperationFailedException {
String path = PATH.resolveModelAttribute(context, model).asString();
boolean directoryListing = DIRECTORY_LISTING.resolveModelAttribute(context, model).asBoolean();
UndertowLogger.ROOT_LOGGER.infof("Creating file handler for path %s", path);
UndertowLogger.ROOT_LOGGER.creatingFileHandler(path);
FileResourceManager resourceManager = new FileResourceManager(Paths.get(path));
ResourceHandler handler = new ResourceHandler();
handler.setResourceManager(resourceManager);
Expand Down