private void configureMimeMappings(WebAppType webApp, GBeanData webModuleData) { MimeMappingType[] mimeMappingArray = webApp.getMimeMappingArray(); Map<String, String> mimeMappingMap = new HashMap<String, String>(defaultMimeTypeMappings); for (MimeMappingType mimeMappingType : mimeMappingArray) { mimeMappingMap.put(mimeMappingType.getExtension().getStringValue().trim(), mimeMappingType.getMimeType().getStringValue().trim()); } webModuleData.setAttribute("mimeMap", mimeMappingMap); }
private void configureContextParams(WebAppType webApp, GBeanData webModuleData) { ParamValueType[] contextParamArray = webApp.getContextParamArray(); Map<String, String> contextParams = new HashMap<String, String>(); for (ParamValueType contextParam : contextParamArray) { contextParams.put(contextParam.getParamName().getStringValue().trim(), contextParam.getParamValue().getStringValue().trim()); } webModuleData.setAttribute("contextParamMap", contextParams); }
public void initContext(XmlObject specDD, XmlObject plan, Module module) throws DeploymentException { List<MessageDestinationType> specDestinations = convert(specDD.selectChildren(messageDestinationQNameSet), JEE_CONVERTER, MessageDestinationType.class, MessageDestinationType.type); XmlObject[] gerDestinations = plan.selectChildren(GER_MESSAGE_DESTINATION_QNAME_SET); Map<String, GerMessageDestinationType> nameMap = new HashMap<String, GerMessageDestinationType>(); for (XmlObject gerDestination : gerDestinations) { GerMessageDestinationType destination = (GerMessageDestinationType) gerDestination.copy().changeType(GerMessageDestinationType.type); String name = destination.getMessageDestinationName().trim(); nameMap.put(name, destination); boolean found = false; for (MessageDestinationType specDestination : specDestinations) { if (specDestination.getMessageDestinationName().getStringValue().trim().equals(name)) { found = true; break; } } if (!found) { throw new DeploymentException("No spec DD message-destination for " + name); } } module.getRootEarContext().registerMessageDestionations(module.getName(), nameMap); }
private void configureTagLibs(Module module, WebAppType webApp, GBeanData webModuleData, Map<String, Set<String>> servletMappings, Set<String> knownServletMappings, String jspServletName) throws DeploymentException { JspConfigType[] jspConfigArray = webApp.getJspConfigArray(); if (jspConfigArray.length > 1) { throw new DeploymentException("Web app " + module.getName() + " cannot have more than one jsp-config element. Currently has " + jspConfigArray.length + " jsp-config elements."); } Map<String, String> tagLibMap = new HashMap<String, String>(); for (JspConfigType aJspConfigArray : jspConfigArray) { TaglibType[] tagLibArray = aJspConfigArray.getTaglibArray(); for (TaglibType taglib : tagLibArray) { tagLibMap.put(taglib.getTaglibUri().getStringValue().trim(), taglib.getTaglibLocation().getStringValue().trim()); } for (JspPropertyGroupType propertyGroup: aJspConfigArray.getJspPropertyGroupArray()) { UrlPatternType[] urlPatterns = propertyGroup.getUrlPatternArray(); addMappingsForServlet(jspServletName, urlPatterns, knownServletMappings, servletMappings); } } webModuleData.setAttribute("tagLibMap", tagLibMap); }
private void addFiltersGBeans(EARContext earContext, EARContext moduleContext, AbstractName moduleName, WebAppType webApp) throws GBeanAlreadyExistsException { FilterType[] filterArray = webApp.getFilterArray(); for (FilterType filterType : filterArray) { String filterName = filterType.getFilterName().getStringValue().trim(); AbstractName filterAbstractName = earContext.getNaming().createChildName(moduleName, filterName, NameFactory.WEB_FILTER); GBeanData filterData = new GBeanData(filterAbstractName, JettyFilterHolder.GBEAN_INFO); filterData.setAttribute("filterName", filterName); filterData.setAttribute("filterClass", filterType.getFilterClass().getStringValue().trim()); Map<String, String> initParams = new HashMap<String, String>(); ParamValueType[] initParamArray = filterType.getInitParamArray(); for (ParamValueType paramValueType : initParamArray) { initParams.put(paramValueType.getParamName().getStringValue().trim(), paramValueType.getParamValue().getStringValue().trim()); } filterData.setAttribute("initParams", initParams); filterData.setReferencePattern("JettyServletRegistration", moduleName); moduleContext.addGBean(filterData); } }
ParamValueType[] initParamArray = servletType.getInitParamArray(); for (ParamValueType paramValueType : initParamArray) { initParams.put(paramValueType.getParamName().getStringValue().trim(), paramValueType.getParamValue().getStringValue().trim());
webModuleData.setAttribute("realmName", loginConfig.getRealmName().getStringValue());