Top Description Inners Fields Constructors Methods
org.apache.tomcat.websocket

public Class Util

extends Object
Class Inheritance
Imports
java.io.InputStream, .Reader, java.lang.reflect.GenericArrayType, .Method, .ParameterizedType, .Type, .TypeVariable, java.nio.ByteBuffer, java.security.NoSuchAlgorithmException, .SecureRandom, java.util.ArrayList, .HashSet, .List, .Queue, .Set, java.util.concurrent.ConcurrentLinkedQueue, javax.naming.NamingException, jakarta.websocket.CloseReason.CloseCode, .CloseReason.CloseCodes, .Decoder, .Decoder.Binary, .Decoder.BinaryStream, .Decoder.Text, .Decoder.TextStream, .DeploymentException, .Encoder, .EndpointConfig, .Extension, .MessageHandler, .PongMessage, .Session, org.apache.tomcat.InstanceManager, org.apache.tomcat.util.res.StringManager, org.apache.tomcat.websocket.pojo.PojoMessageHandlerPartialBinary, .PojoMessageHandlerWholeBinary, .PojoMessageHandlerWholeText

Utility class for internal use only within the org.apache.tomcat.websocket package.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
private static class

Field Summary

Modifier and TypeField and Description
private static final Queue<SecureRandom>
private static final StringManager

Constructor Summary

AccessConstructor and Description
private
Util()

Method Summary

Modifier and TypeMethod and Description
public static Object
coerceToType(Class<?> type, String value)

private static boolean
pack-priv static byte[]
pack-priv static CloseReason.CloseCode
getCloseCode(int code)

public static List<DecoderEntry>

Returns:

List of mappings from target type to associated decoder
getDecoders
(List<Class<? extends Decoder>>
Decoder implementation classes
decoderClazzes
,
InstanceManager
Instance manager to use to create Decoder instances
instanceManager
)

Build the list of decoder entries from a set of decoder implementations.

private static Class<?>
getDecoderType(Class<? extends Decoder> decoder)

pack-priv static Class<?>
getEncoderType(Class<? extends Encoder> encoder)

private static <T> Util.TypeResult
getGenericType(Class<T> type, Class<? extends T> clazz)

pack-priv static Set<MessageHandlerResult>
getMessageHandlers(Class<?> target, MessageHandler listener, EndpointConfig endpointConfig, Session session)

pack-priv static Class<?>
private static Method
private static Method
private static Util.TypeResult
getTypeParameter(Class<?> clazz, Type argType)

pack-priv static boolean
isContinuation(byte opCode)

pack-priv static boolean
isControl(byte opCode)

public static boolean
isPrimitive(Class<?> clazz)

pack-priv static boolean
isText(byte opCode)

private static List<Class<? extends Decoder>>
matchDecoders(Class<?> target, EndpointConfig endpointConfig, boolean binary, InstanceManager instanceManager)

private static Util.DecoderMatch
matchDecoders(Class<?> target, EndpointConfig endpointConfig, InstanceManager instanceManager)

public static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

randomsback to summary
private static final Queue<SecureRandom> randoms
smback to summary
private static final StringManager sm

Constructor Detail

Utilback to summary
private Util()

Method Detail

coerceToTypeback to summary
public static Object coerceToType(Class<?> type, String value)
containsDelimsback to summary
private static boolean containsDelims(String input)
generateMaskback to summary
pack-priv static byte[] generateMask()
getCloseCodeback to summary
pack-priv static CloseReason.CloseCode getCloseCode(int code)
getDecodersback to summary
public static List<DecoderEntry> getDecoders(List<Class<? extends Decoder>> decoderClazzes, InstanceManager instanceManager) throws DeploymentException

Build the list of decoder entries from a set of decoder implementations.

Parameters
decoderClazzes:List<Class<? extends Decoder>>

Decoder implementation classes

instanceManager:InstanceManager

Instance manager to use to create Decoder instances

Returns:List<DecoderEntry>

List of mappings from target type to associated decoder

Exceptions
DeploymentException:
If a provided decoder class is not valid
getDecoderTypeback to summary
private static Class<?> getDecoderType(Class<? extends Decoder> decoder)
getEncoderTypeback to summary
pack-priv static Class<?> getEncoderType(Class<? extends Encoder> encoder)
getGenericTypeback to summary
private static <T> Util.TypeResult getGenericType(Class<T> type, Class<? extends T> clazz)
getMessageHandlersback to summary
pack-priv static Set<MessageHandlerResult> getMessageHandlers(Class<?> target, MessageHandler listener, EndpointConfig endpointConfig, Session session)
getMessageTypeback to summary
pack-priv static Class<?> getMessageType(MessageHandler listener)
getOnMessageMethodback to summary
private static Method getOnMessageMethod(MessageHandler listener)
getOnMessagePartialMethodback to summary
private static Method getOnMessagePartialMethod(MessageHandler listener)
getTypeParameterback to summary
private static Util.TypeResult getTypeParameter(Class<?> clazz, Type argType)
isContinuationback to summary
pack-priv static boolean isContinuation(byte opCode)
isControlback to summary
pack-priv static boolean isControl(byte opCode)
isPrimitiveback to summary
public static boolean isPrimitive(Class<?> clazz)
isTextback to summary
pack-priv static boolean isText(byte opCode)
matchDecodersback to summary
private static List<Class<? extends Decoder>> matchDecoders(Class<?> target, EndpointConfig endpointConfig, boolean binary, InstanceManager instanceManager)
matchDecodersback to summary
private static Util.DecoderMatch matchDecoders(Class<?> target, EndpointConfig endpointConfig, InstanceManager instanceManager)
parseExtensionHeaderback to summary
public static void parseExtensionHeader(List<Extension> extensions, String header)
org.apache.tomcat.websocket back to summary

public Class Util.DecoderMatch

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final List<Class<? extends Decoder>>
private final Class<?>
private final List<Class<? extends Decoder>>

Constructor Summary

AccessConstructor and Description
public
DecoderMatch(Class<?> target, List<DecoderEntry> decoderEntries)

Method Summary

Modifier and TypeMethod and Description
public List<Class<? extends Decoder>>
public Class<?>
public List<Class<? extends Decoder>>
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

binaryDecodersback to summary
private final List<Class<? extends Decoder>> binaryDecoders
targetback to summary
private final Class<?> target
textDecodersback to summary
private final List<Class<? extends Decoder>> textDecoders

Constructor Detail

DecoderMatchback to summary
public DecoderMatch(Class<?> target, List<DecoderEntry> decoderEntries)

Method Detail

getBinaryDecodersback to summary
public List<Class<? extends Decoder>> getBinaryDecoders()
getTargetback to summary
public Class<?> getTarget()
getTextDecodersback to summary
public List<Class<? extends Decoder>> getTextDecoders()
hasMatchesback to summary
public boolean hasMatches()
org.apache.tomcat.websocket back to summary

private Class Util.TypeResult

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Class<?>
private int
private final int

Constructor Summary

AccessConstructor and Description
pack-priv
TypeResult(Class<?> clazz, int index, int dimension)

Method Summary

Modifier and TypeMethod and Description
public Class<?>
public int
public int
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clazzback to summary
private final Class<?> clazz
dimensionback to summary
private int dimension
indexback to summary
private final int index

Constructor Detail

TypeResultback to summary
pack-priv TypeResult(Class<?> clazz, int index, int dimension)

Method Detail

getClazzback to summary
public Class<?> getClazz()
getDimensionback to summary
public int getDimension()
getIndexback to summary
public int getIndex()
incrementDimensionback to summary
public void incrementDimension(int inc)