MCPcopy Create free account
hub / github.com/apache/tomcat / getDecoders

Method getDecoders

java/org/apache/tomcat/websocket/Util.java:335–363  ·  view source on GitHub ↗

Build the list of decoder entries from a set of decoder implementations. @param decoderClazzes Decoder implementation classes @param instanceManager Instance manager to use to create Decoder instances @return List of mappings from target type to associated decoder @throws DeploymentException If

(List<Class<? extends Decoder>> decoderClazzes,
            InstanceManager instanceManager)

Source from the content-addressed store, hash-verified

333 * @throws DeploymentException If a provided decoder class is not valid
334 */
335 public static List<DecoderEntry> getDecoders(List<Class<? extends Decoder>> decoderClazzes,
336 InstanceManager instanceManager) throws DeploymentException {
337
338 List<DecoderEntry> result = new ArrayList<>();
339 if (decoderClazzes != null) {
340 for (Class<? extends Decoder> decoderClazz : decoderClazzes) {
341 // Need to instantiate decoder to ensure it is valid and that
342 // deployment can be failed if it is not
343 Decoder instance;
344 try {
345 if (instanceManager == null) {
346 instance = decoderClazz.getConstructor().newInstance();
347 } else {
348 instance = (Decoder) instanceManager.newInstance(decoderClazz);
349 // Don't need this instance, so destroy it
350 instanceManager.destroyInstance(instance);
351 }
352 } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException |
353 NamingException e) {
354 throw new DeploymentException(
355 sm.getString("pojoMethodMapping.invalidDecoder", decoderClazz.getName()), e);
356 }
357 DecoderEntry entry = new DecoderEntry(getDecoderType(decoderClazz), decoderClazz);
358 result.add(entry);
359 }
360 }
361
362 return result;
363 }
364
365
366 static Set<MessageHandlerResult> getMessageHandlers(Class<?> target, MessageHandler listener,

Callers 2

matchDecodersMethod · 0.95
PojoMethodMappingMethod · 0.95

Calls 7

getDecoderTypeMethod · 0.95
newInstanceMethod · 0.65
destroyInstanceMethod · 0.65
getStringMethod · 0.65
getNameMethod · 0.65
addMethod · 0.65
getConstructorMethod · 0.45

Tested by

no test coverage detected