use of com.liferay.faces.util.config.WebConfig in project liferay-faces-bridge-impl by liferay.
the class ResourceValidatorBridgeImpl method isSelfReferencing.
@Override
public boolean isSelfReferencing(FacesContext facesContext, String resourceId) {
ExternalContext externalContext = facesContext.getExternalContext();
final Product PLUTO = ProductFactory.getProductInstance(externalContext, Product.Name.PLUTO);
// If the delegation chain indicates that the specified resource is not self-referencing, then
boolean selfReferencing = super.isSelfReferencing(facesContext, resourceId);
if (PLUTO.isDetected() && (!selfReferencing) && (resourceId != null)) {
// Process the configured servlet entries in order to determine which ones are portlet invokers.
Set<String> invokerServletNames = new HashSet<String>();
Map<String, Object> applicationMap = externalContext.getApplicationMap();
ApplicationConfig applicationConfig = (ApplicationConfig) applicationMap.get(ApplicationConfig.class.getName());
WebConfig webConfig = applicationConfig.getWebConfig();
List<ConfiguredServlet> configuredServlets = webConfig.getConfiguredServlets();
for (ConfiguredServlet configuredServlet : configuredServlets) {
String configuredServletClass = configuredServlet.getServletClass();
if (isInvokerServletClass(configuredServletClass)) {
invokerServletNames.add(configuredServlet.getServletName());
}
}
// For each of the servlet-mapping entries:
List<ConfiguredServletMapping> configuredServletMappings = webConfig.getConfiguredServletMappings();
for (ConfiguredServletMapping configuredServletMapping : configuredServletMappings) {
// Determine whether or not the current servlet-mapping is mapped to a portlet invoker servlet-class.
if (invokerServletNames.contains(configuredServletMapping.getServletName())) {
if (configuredServletMapping.isMatch(resourceId)) {
selfReferencing = true;
break;
}
}
}
}
return selfReferencing;
}
use of com.liferay.faces.util.config.WebConfig in project liferay-faces-alloy by liferay.
the class InputFileDecoderBase method getFacesServletMultiPartConfig.
protected MultiPartConfig getFacesServletMultiPartConfig(ExternalContext externalContext) {
MultiPartConfig facesServletMultiPartConfig = null;
String appConfigAttrName = ApplicationConfig.class.getName();
Map<String, Object> applicationMap = externalContext.getApplicationMap();
ApplicationConfig applicationConfig = (ApplicationConfig) applicationMap.get(appConfigAttrName);
WebConfig webConfig = applicationConfig.getWebConfig();
List<ConfiguredServlet> configuredServlets = webConfig.getConfiguredServlets();
for (ConfiguredServlet configuredServlet : configuredServlets) {
if (FACES_SERVLET_FQCN.equals(configuredServlet.getServletClass())) {
facesServletMultiPartConfig = configuredServlet.getMultiPartConfig();
}
}
return facesServletMultiPartConfig;
}
use of com.liferay.faces.util.config.WebConfig in project liferay-faces-bridge-ext by liferay.
the class ResourceValidatorLiferayImpl method isSelfReferencing.
@Override
public boolean isSelfReferencing(FacesContext facesContext, String resourceId) {
// If the delegation chain indicates that the specified resource is not self-referencing, then
boolean selfReferencing = super.isSelfReferencing(facesContext, resourceId);
if ((!selfReferencing) && (resourceId != null)) {
// Process the configured servlet entries in order to determine which ones are portlet invokers.
Set<String> invokerServletNames = new HashSet<String>();
ExternalContext externalContext = facesContext.getExternalContext();
Map<String, Object> applicationMap = externalContext.getApplicationMap();
ApplicationConfig applicationConfig = (ApplicationConfig) applicationMap.get(ApplicationConfig.class.getName());
WebConfig webConfig = applicationConfig.getWebConfig();
List<ConfiguredServlet> configuredServlets = webConfig.getConfiguredServlets();
for (ConfiguredServlet configuredServlet : configuredServlets) {
String configuredServletClass = configuredServlet.getServletClass();
if (isInvokerServletClass(configuredServletClass)) {
invokerServletNames.add(configuredServlet.getServletName());
}
}
// For each of the servlet-mapping entries:
List<ConfiguredServletMapping> configuredServletMappings = webConfig.getConfiguredServletMappings();
for (ConfiguredServletMapping configuredServletMapping : configuredServletMappings) {
// Determine whether or not the current servlet-mapping is mapped to a portlet invoker servlet-class.
if (invokerServletNames.contains(configuredServletMapping.getServletName())) {
if (configuredServletMapping.isMatch(resourceId)) {
selfReferencing = true;
break;
}
}
}
}
return selfReferencing;
}
Aggregations