Wed, 27 Apr 2016 01:27:09 +0800
Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/jaxws/
changeset: 657:d47a47f961ee
tag: jdk8u25-b17
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. Oracle designates this |
aoqi@0 | 8 | * particular file as subject to the "Classpath" exception as provided |
aoqi@0 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
aoqi@0 | 10 | * |
aoqi@0 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 15 | * accompanied this code). |
aoqi@0 | 16 | * |
aoqi@0 | 17 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 20 | * |
aoqi@0 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 22 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 23 | * questions. |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | package com.sun.xml.internal.ws.assembler; |
aoqi@0 | 27 | |
aoqi@0 | 28 | import com.sun.istack.internal.NotNull; |
aoqi@0 | 29 | import com.sun.istack.internal.logging.Logger; |
aoqi@0 | 30 | import com.sun.xml.internal.ws.api.ResourceLoader; |
aoqi@0 | 31 | import com.sun.xml.internal.ws.api.server.Container; |
aoqi@0 | 32 | import com.sun.xml.internal.ws.resources.TubelineassemblyMessages; |
aoqi@0 | 33 | import com.sun.xml.internal.ws.runtime.config.MetroConfig; |
aoqi@0 | 34 | import com.sun.xml.internal.ws.runtime.config.TubeFactoryList; |
aoqi@0 | 35 | import com.sun.xml.internal.ws.runtime.config.TubelineDefinition; |
aoqi@0 | 36 | import com.sun.xml.internal.ws.runtime.config.TubelineMapping; |
aoqi@0 | 37 | import com.sun.xml.internal.ws.util.xml.XmlUtil; |
aoqi@0 | 38 | |
aoqi@0 | 39 | import javax.xml.bind.JAXBContext; |
aoqi@0 | 40 | import javax.xml.bind.JAXBElement; |
aoqi@0 | 41 | import javax.xml.bind.Unmarshaller; |
aoqi@0 | 42 | import javax.xml.stream.XMLInputFactory; |
aoqi@0 | 43 | import javax.xml.ws.WebServiceException; |
aoqi@0 | 44 | import java.lang.reflect.Method; |
aoqi@0 | 45 | import java.lang.reflect.ReflectPermission; |
aoqi@0 | 46 | import java.net.MalformedURLException; |
aoqi@0 | 47 | import java.net.URI; |
aoqi@0 | 48 | import java.net.URISyntaxException; |
aoqi@0 | 49 | import java.net.URL; |
aoqi@0 | 50 | import java.security.*; |
aoqi@0 | 51 | import java.util.PropertyPermission; |
aoqi@0 | 52 | import java.util.logging.Level; |
aoqi@0 | 53 | |
aoqi@0 | 54 | /** |
aoqi@0 | 55 | * This class is responsible for locating and loading Metro configuration files |
aoqi@0 | 56 | * (both application jaxws-tubes.xml and default jaxws-tubes-default.xml). |
aoqi@0 | 57 | * <p/> |
aoqi@0 | 58 | * Once the configuration is loaded the class is able to resolve which tubeline |
aoqi@0 | 59 | * configuration belongs to each endpoint or endpoint client. This information is |
aoqi@0 | 60 | * then used in {@link TubelineAssemblyController} to construct the list of |
aoqi@0 | 61 | * {@link TubeCreator} objects that are used in the actual tubeline construction. |
aoqi@0 | 62 | * |
aoqi@0 | 63 | * @author Marek Potociar <marek.potociar at sun.com> |
aoqi@0 | 64 | */ |
aoqi@0 | 65 | // TODO Move the logic of this class directly into MetroConfig class. |
aoqi@0 | 66 | class MetroConfigLoader { |
aoqi@0 | 67 | |
aoqi@0 | 68 | private static final Logger LOGGER = Logger.getLogger(MetroConfigLoader.class); |
aoqi@0 | 69 | |
aoqi@0 | 70 | private MetroConfigName defaultTubesConfigNames; |
aoqi@0 | 71 | |
aoqi@0 | 72 | private static interface TubeFactoryListResolver { |
aoqi@0 | 73 | |
aoqi@0 | 74 | TubeFactoryList getFactories(TubelineDefinition td); |
aoqi@0 | 75 | } |
aoqi@0 | 76 | |
aoqi@0 | 77 | private static final TubeFactoryListResolver ENDPOINT_SIDE_RESOLVER = new TubeFactoryListResolver() { |
aoqi@0 | 78 | |
aoqi@0 | 79 | public TubeFactoryList getFactories(TubelineDefinition td) { |
aoqi@0 | 80 | return (td != null) ? td.getEndpointSide() : null; |
aoqi@0 | 81 | } |
aoqi@0 | 82 | }; |
aoqi@0 | 83 | private static final TubeFactoryListResolver CLIENT_SIDE_RESOLVER = new TubeFactoryListResolver() { |
aoqi@0 | 84 | |
aoqi@0 | 85 | public TubeFactoryList getFactories(TubelineDefinition td) { |
aoqi@0 | 86 | return (td != null) ? td.getClientSide() : null; |
aoqi@0 | 87 | } |
aoqi@0 | 88 | }; |
aoqi@0 | 89 | // |
aoqi@0 | 90 | private MetroConfig defaultConfig; |
aoqi@0 | 91 | private URL defaultConfigUrl; |
aoqi@0 | 92 | private MetroConfig appConfig; |
aoqi@0 | 93 | private URL appConfigUrl; |
aoqi@0 | 94 | |
aoqi@0 | 95 | MetroConfigLoader(Container container, MetroConfigName defaultTubesConfigNames) { |
aoqi@0 | 96 | this.defaultTubesConfigNames = defaultTubesConfigNames; |
aoqi@0 | 97 | ResourceLoader spiResourceLoader = null; |
aoqi@0 | 98 | if (container != null) { |
aoqi@0 | 99 | spiResourceLoader = container.getSPI(ResourceLoader.class); |
aoqi@0 | 100 | } |
aoqi@0 | 101 | // if spi resource can't load resource, default (MetroConfigUrlLoader) is used; |
aoqi@0 | 102 | // it searches the classpath, so it would be most probably used |
aoqi@0 | 103 | // when using jaxws- or metro-defaults from jaxws libraries |
aoqi@0 | 104 | init(container, spiResourceLoader, new MetroConfigUrlLoader(container)); |
aoqi@0 | 105 | } |
aoqi@0 | 106 | |
aoqi@0 | 107 | private void init(Container container, ResourceLoader... loaders) { |
aoqi@0 | 108 | |
aoqi@0 | 109 | String appFileName = null; |
aoqi@0 | 110 | String defaultFileName = null; |
aoqi@0 | 111 | if (container != null) { |
aoqi@0 | 112 | MetroConfigName mcn = container.getSPI(MetroConfigName.class); |
aoqi@0 | 113 | if (mcn != null) { |
aoqi@0 | 114 | appFileName = mcn.getAppFileName(); |
aoqi@0 | 115 | defaultFileName = mcn.getDefaultFileName(); |
aoqi@0 | 116 | } |
aoqi@0 | 117 | } |
aoqi@0 | 118 | if (appFileName == null) { |
aoqi@0 | 119 | appFileName = defaultTubesConfigNames.getAppFileName(); |
aoqi@0 | 120 | } |
aoqi@0 | 121 | |
aoqi@0 | 122 | if (defaultFileName == null) { |
aoqi@0 | 123 | defaultFileName = defaultTubesConfigNames.getDefaultFileName(); |
aoqi@0 | 124 | } |
aoqi@0 | 125 | this.defaultConfigUrl = locateResource(defaultFileName, loaders); |
aoqi@0 | 126 | if (defaultConfigUrl == null) { |
aoqi@0 | 127 | throw LOGGER.logSevereException(new IllegalStateException(TubelineassemblyMessages.MASM_0001_DEFAULT_CFG_FILE_NOT_FOUND(defaultFileName))); |
aoqi@0 | 128 | } |
aoqi@0 | 129 | |
aoqi@0 | 130 | LOGGER.config(TubelineassemblyMessages.MASM_0002_DEFAULT_CFG_FILE_LOCATED(defaultFileName, defaultConfigUrl)); |
aoqi@0 | 131 | this.defaultConfig = MetroConfigLoader.loadMetroConfig(defaultConfigUrl); |
aoqi@0 | 132 | if (defaultConfig == null) { |
aoqi@0 | 133 | throw LOGGER.logSevereException(new IllegalStateException(TubelineassemblyMessages.MASM_0003_DEFAULT_CFG_FILE_NOT_LOADED(defaultFileName))); |
aoqi@0 | 134 | } |
aoqi@0 | 135 | if (defaultConfig.getTubelines() == null) { |
aoqi@0 | 136 | throw LOGGER.logSevereException(new IllegalStateException(TubelineassemblyMessages.MASM_0004_NO_TUBELINES_SECTION_IN_DEFAULT_CFG_FILE(defaultFileName))); |
aoqi@0 | 137 | } |
aoqi@0 | 138 | if (defaultConfig.getTubelines().getDefault() == null) { |
aoqi@0 | 139 | throw LOGGER.logSevereException(new IllegalStateException(TubelineassemblyMessages.MASM_0005_NO_DEFAULT_TUBELINE_IN_DEFAULT_CFG_FILE(defaultFileName))); |
aoqi@0 | 140 | } |
aoqi@0 | 141 | |
aoqi@0 | 142 | this.appConfigUrl = locateResource(appFileName, loaders); |
aoqi@0 | 143 | if (appConfigUrl != null) { |
aoqi@0 | 144 | LOGGER.config(TubelineassemblyMessages.MASM_0006_APP_CFG_FILE_LOCATED(appConfigUrl)); |
aoqi@0 | 145 | this.appConfig = MetroConfigLoader.loadMetroConfig(appConfigUrl); |
aoqi@0 | 146 | } else { |
aoqi@0 | 147 | LOGGER.config(TubelineassemblyMessages.MASM_0007_APP_CFG_FILE_NOT_FOUND()); |
aoqi@0 | 148 | this.appConfig = null; |
aoqi@0 | 149 | } |
aoqi@0 | 150 | } |
aoqi@0 | 151 | |
aoqi@0 | 152 | TubeFactoryList getEndpointSideTubeFactories(URI endpointReference) { |
aoqi@0 | 153 | return getTubeFactories(endpointReference, ENDPOINT_SIDE_RESOLVER); |
aoqi@0 | 154 | } |
aoqi@0 | 155 | |
aoqi@0 | 156 | TubeFactoryList getClientSideTubeFactories(URI endpointReference) { |
aoqi@0 | 157 | return getTubeFactories(endpointReference, CLIENT_SIDE_RESOLVER); |
aoqi@0 | 158 | } |
aoqi@0 | 159 | |
aoqi@0 | 160 | private TubeFactoryList getTubeFactories(URI endpointReference, TubeFactoryListResolver resolver) { |
aoqi@0 | 161 | if (appConfig != null && appConfig.getTubelines() != null) { |
aoqi@0 | 162 | for (TubelineMapping mapping : appConfig.getTubelines().getTubelineMappings()) { |
aoqi@0 | 163 | if (mapping.getEndpointRef().equals(endpointReference.toString())) { |
aoqi@0 | 164 | TubeFactoryList list = resolver.getFactories(getTubeline(appConfig, resolveReference(mapping.getTubelineRef()))); |
aoqi@0 | 165 | if (list != null) { |
aoqi@0 | 166 | return list; |
aoqi@0 | 167 | } else { |
aoqi@0 | 168 | break; |
aoqi@0 | 169 | } |
aoqi@0 | 170 | } |
aoqi@0 | 171 | } |
aoqi@0 | 172 | |
aoqi@0 | 173 | if (appConfig.getTubelines().getDefault() != null) { |
aoqi@0 | 174 | TubeFactoryList list = resolver.getFactories(getTubeline(appConfig, resolveReference(appConfig.getTubelines().getDefault()))); |
aoqi@0 | 175 | if (list != null) { |
aoqi@0 | 176 | return list; |
aoqi@0 | 177 | } |
aoqi@0 | 178 | } |
aoqi@0 | 179 | } |
aoqi@0 | 180 | |
aoqi@0 | 181 | for (TubelineMapping mapping : defaultConfig.getTubelines().getTubelineMappings()) { |
aoqi@0 | 182 | if (mapping.getEndpointRef().equals(endpointReference.toString())) { |
aoqi@0 | 183 | TubeFactoryList list = resolver.getFactories(getTubeline(defaultConfig, resolveReference(mapping.getTubelineRef()))); |
aoqi@0 | 184 | if (list != null) { |
aoqi@0 | 185 | return list; |
aoqi@0 | 186 | } else { |
aoqi@0 | 187 | break; |
aoqi@0 | 188 | } |
aoqi@0 | 189 | } |
aoqi@0 | 190 | } |
aoqi@0 | 191 | |
aoqi@0 | 192 | return resolver.getFactories(getTubeline(defaultConfig, resolveReference(defaultConfig.getTubelines().getDefault()))); |
aoqi@0 | 193 | } |
aoqi@0 | 194 | |
aoqi@0 | 195 | TubelineDefinition getTubeline(MetroConfig config, URI tubelineDefinitionUri) { |
aoqi@0 | 196 | if (config != null && config.getTubelines() != null) { |
aoqi@0 | 197 | for (TubelineDefinition td : config.getTubelines().getTubelineDefinitions()) { |
aoqi@0 | 198 | if (td.getName().equals(tubelineDefinitionUri.getFragment())) { |
aoqi@0 | 199 | return td; |
aoqi@0 | 200 | } |
aoqi@0 | 201 | } |
aoqi@0 | 202 | } |
aoqi@0 | 203 | |
aoqi@0 | 204 | return null; |
aoqi@0 | 205 | } |
aoqi@0 | 206 | |
aoqi@0 | 207 | private static URI resolveReference(String reference) { |
aoqi@0 | 208 | try { |
aoqi@0 | 209 | return new URI(reference); |
aoqi@0 | 210 | } catch (URISyntaxException ex) { |
aoqi@0 | 211 | throw LOGGER.logSevereException(new WebServiceException(TubelineassemblyMessages.MASM_0008_INVALID_URI_REFERENCE(reference), ex)); |
aoqi@0 | 212 | } |
aoqi@0 | 213 | } |
aoqi@0 | 214 | |
aoqi@0 | 215 | |
aoqi@0 | 216 | private static URL locateResource(String resource, ResourceLoader loader) { |
aoqi@0 | 217 | if (loader == null) return null; |
aoqi@0 | 218 | |
aoqi@0 | 219 | try { |
aoqi@0 | 220 | return loader.getResource(resource); |
aoqi@0 | 221 | } catch (MalformedURLException ex) { |
aoqi@0 | 222 | LOGGER.severe(TubelineassemblyMessages.MASM_0009_CANNOT_FORM_VALID_URL(resource), ex); |
aoqi@0 | 223 | } |
aoqi@0 | 224 | return null; |
aoqi@0 | 225 | } |
aoqi@0 | 226 | |
aoqi@0 | 227 | private static URL locateResource(String resource, ResourceLoader[] loaders) { |
aoqi@0 | 228 | |
aoqi@0 | 229 | for (ResourceLoader loader : loaders) { |
aoqi@0 | 230 | URL url = locateResource(resource, loader); |
aoqi@0 | 231 | if (url != null) { |
aoqi@0 | 232 | return url; |
aoqi@0 | 233 | } |
aoqi@0 | 234 | } |
aoqi@0 | 235 | return null; |
aoqi@0 | 236 | } |
aoqi@0 | 237 | |
aoqi@0 | 238 | private static MetroConfig loadMetroConfig(@NotNull URL resourceUrl) { |
aoqi@0 | 239 | MetroConfig result = null; |
aoqi@0 | 240 | try { |
aoqi@0 | 241 | JAXBContext jaxbContext = createJAXBContext(); |
aoqi@0 | 242 | Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); |
aoqi@0 | 243 | XMLInputFactory factory = XmlUtil.newXMLInputFactory(true); |
aoqi@0 | 244 | final JAXBElement<MetroConfig> configElement = unmarshaller.unmarshal(factory.createXMLStreamReader(resourceUrl.openStream()), MetroConfig.class); |
aoqi@0 | 245 | result = configElement.getValue(); |
aoqi@0 | 246 | } catch (Exception e) { |
aoqi@0 | 247 | LOGGER.warning(TubelineassemblyMessages.MASM_0010_ERROR_READING_CFG_FILE_FROM_LOCATION(resourceUrl.toString()), e); |
aoqi@0 | 248 | } |
aoqi@0 | 249 | return result; |
aoqi@0 | 250 | } |
aoqi@0 | 251 | |
aoqi@0 | 252 | private static JAXBContext createJAXBContext() throws Exception { |
aoqi@0 | 253 | if (isJDKInternal()) { |
aoqi@0 | 254 | // since jdk classes are repackaged, extra privilege is necessary to create JAXBContext |
aoqi@0 | 255 | return AccessController.doPrivileged( |
aoqi@0 | 256 | new PrivilegedExceptionAction<JAXBContext>() { |
aoqi@0 | 257 | @Override |
aoqi@0 | 258 | public JAXBContext run() throws Exception { |
aoqi@0 | 259 | return JAXBContext.newInstance(MetroConfig.class.getPackage().getName()); |
aoqi@0 | 260 | } |
aoqi@0 | 261 | }, createSecurityContext() |
aoqi@0 | 262 | ); |
aoqi@0 | 263 | } else { |
aoqi@0 | 264 | // usage from JAX-WS/Metro/Glassfish |
aoqi@0 | 265 | return JAXBContext.newInstance(MetroConfig.class.getPackage().getName()); |
aoqi@0 | 266 | } |
aoqi@0 | 267 | } |
aoqi@0 | 268 | |
aoqi@0 | 269 | private static AccessControlContext createSecurityContext() { |
aoqi@0 | 270 | PermissionCollection perms = new Permissions(); |
aoqi@0 | 271 | perms.add(new RuntimePermission("accessClassInPackage.com" + ".sun.xml.internal.ws.runtime.config")); // avoid repackaging |
aoqi@0 | 272 | perms.add(new ReflectPermission("suppressAccessChecks")); |
aoqi@0 | 273 | return new AccessControlContext( |
aoqi@0 | 274 | new ProtectionDomain[]{ |
aoqi@0 | 275 | new ProtectionDomain(null, perms), |
aoqi@0 | 276 | }); |
aoqi@0 | 277 | } |
aoqi@0 | 278 | |
aoqi@0 | 279 | private static boolean isJDKInternal() { |
aoqi@0 | 280 | // avoid "string repackaging" |
aoqi@0 | 281 | return MetroConfigLoader.class.getName().startsWith("com." + "sun.xml.internal.ws"); |
aoqi@0 | 282 | } |
aoqi@0 | 283 | |
aoqi@0 | 284 | private static class MetroConfigUrlLoader extends ResourceLoader { |
aoqi@0 | 285 | |
aoqi@0 | 286 | Container container; // TODO remove the field together with the code path using it (see below) |
aoqi@0 | 287 | ResourceLoader parentLoader; |
aoqi@0 | 288 | |
aoqi@0 | 289 | MetroConfigUrlLoader(ResourceLoader parentLoader) { |
aoqi@0 | 290 | this.parentLoader = parentLoader; |
aoqi@0 | 291 | } |
aoqi@0 | 292 | |
aoqi@0 | 293 | MetroConfigUrlLoader(Container container) { |
aoqi@0 | 294 | this((container != null) ? container.getSPI(ResourceLoader.class) : null); |
aoqi@0 | 295 | this.container = container; |
aoqi@0 | 296 | } |
aoqi@0 | 297 | |
aoqi@0 | 298 | @Override |
aoqi@0 | 299 | public URL getResource(String resource) throws MalformedURLException { |
aoqi@0 | 300 | LOGGER.entering(resource); |
aoqi@0 | 301 | URL resourceUrl = null; |
aoqi@0 | 302 | try { |
aoqi@0 | 303 | if (parentLoader != null) { |
aoqi@0 | 304 | if (LOGGER.isLoggable(Level.FINE)) { |
aoqi@0 | 305 | LOGGER.fine(TubelineassemblyMessages.MASM_0011_LOADING_RESOURCE(resource, parentLoader)); |
aoqi@0 | 306 | } |
aoqi@0 | 307 | |
aoqi@0 | 308 | resourceUrl = parentLoader.getResource(resource); |
aoqi@0 | 309 | } |
aoqi@0 | 310 | |
aoqi@0 | 311 | if (resourceUrl == null) { |
aoqi@0 | 312 | resourceUrl = loadViaClassLoaders("com/sun/xml/internal/ws/assembler/" + resource); |
aoqi@0 | 313 | } |
aoqi@0 | 314 | |
aoqi@0 | 315 | if (resourceUrl == null && container != null) { |
aoqi@0 | 316 | // TODO: we should remove this code path, the config file should be loaded using ResourceLoader only |
aoqi@0 | 317 | resourceUrl = loadFromServletContext(resource); |
aoqi@0 | 318 | } |
aoqi@0 | 319 | |
aoqi@0 | 320 | return resourceUrl; |
aoqi@0 | 321 | } finally { |
aoqi@0 | 322 | LOGGER.exiting(resourceUrl); |
aoqi@0 | 323 | } |
aoqi@0 | 324 | } |
aoqi@0 | 325 | |
aoqi@0 | 326 | private static URL loadViaClassLoaders(final String resource) { |
aoqi@0 | 327 | URL resourceUrl = tryLoadFromClassLoader(resource, Thread.currentThread().getContextClassLoader()); |
aoqi@0 | 328 | if (resourceUrl == null) { |
aoqi@0 | 329 | resourceUrl = tryLoadFromClassLoader(resource, MetroConfigLoader.class.getClassLoader()); |
aoqi@0 | 330 | if (resourceUrl == null) { |
aoqi@0 | 331 | return ClassLoader.getSystemResource(resource); |
aoqi@0 | 332 | } |
aoqi@0 | 333 | } |
aoqi@0 | 334 | |
aoqi@0 | 335 | return resourceUrl; |
aoqi@0 | 336 | } |
aoqi@0 | 337 | |
aoqi@0 | 338 | private static URL tryLoadFromClassLoader(final String resource, final ClassLoader loader) { |
aoqi@0 | 339 | return (loader != null) ? loader.getResource(resource) : null; |
aoqi@0 | 340 | } |
aoqi@0 | 341 | |
aoqi@0 | 342 | private URL loadFromServletContext(String resource) throws RuntimeException { |
aoqi@0 | 343 | Object context = null; |
aoqi@0 | 344 | try { |
aoqi@0 | 345 | final Class<?> contextClass = Class.forName("javax.servlet.ServletContext"); |
aoqi@0 | 346 | context = container.getSPI(contextClass); |
aoqi@0 | 347 | if (context != null) { |
aoqi@0 | 348 | if (LOGGER.isLoggable(Level.FINE)) { |
aoqi@0 | 349 | LOGGER.fine(TubelineassemblyMessages.MASM_0012_LOADING_VIA_SERVLET_CONTEXT(resource, context)); |
aoqi@0 | 350 | } |
aoqi@0 | 351 | try { |
aoqi@0 | 352 | final Method method = context.getClass().getMethod("getResource", String.class); |
aoqi@0 | 353 | final Object result = method.invoke(context, "/WEB-INF/" + resource); |
aoqi@0 | 354 | return URL.class.cast(result); |
aoqi@0 | 355 | } catch (Exception e) { |
aoqi@0 | 356 | throw LOGGER.logSevereException(new RuntimeException(TubelineassemblyMessages.MASM_0013_ERROR_INVOKING_SERVLET_CONTEXT_METHOD("getResource()")), e); |
aoqi@0 | 357 | } |
aoqi@0 | 358 | } |
aoqi@0 | 359 | } catch (ClassNotFoundException e) { |
aoqi@0 | 360 | if (LOGGER.isLoggable(Level.FINE)) { |
aoqi@0 | 361 | LOGGER.fine(TubelineassemblyMessages.MASM_0014_UNABLE_TO_LOAD_CLASS("javax.servlet.ServletContext")); |
aoqi@0 | 362 | } |
aoqi@0 | 363 | } |
aoqi@0 | 364 | return null; |
aoqi@0 | 365 | } |
aoqi@0 | 366 | } |
aoqi@0 | 367 | |
aoqi@0 | 368 | } |