public FlexContext(Request request, Stream stream, FlexConnection connection) { Assert.notNull(request, "The request must be not null."); this.request = request; this.connection = connection; this.stream = stream; }
/** * Create a new {@code ClassPathResource} for {@code Class} usage. * The path can be relative to the given class, or absolute within * the classpath via a leading slash. * @param path relative or absolute path within the class path * @param clazz the class to load resources with * @see java.lang.Class#getResourceAsStream */ public ClassPathResource(String path, Class<?> clazz) { Assert.notNull(path, "Path must not be null"); this.path = StringUtils.cleanPath(path); this.clazz = clazz; }
public Frame(byte magic, FrameType type, byte version) { Assert.isTrue(magic == MAGIC, "The protocol format error"); this.magic = magic; this.type = type; this.version = version; }
public static String getContentTypeMIMEType(String contentType) { if (contentType != null) { // parsing content-type String[] strings = StringUtils.split(contentType, ';'); return strings[0]; } else { return null; } }
/** * Get the class name without the qualified package name. * * @param clazz the class to get the short name for * @return the class name of the class without the package name */ public static String getShortName(Class<?> clazz) { return getShortName(getQualifiedName(clazz)); }
/** * Adapt an enumeration to an iterator. * * @param enumeration the enumeration * @return the iterator */ public static <E> Iterator<E> toIterator(Enumeration<E> enumeration) { return new EnumerationIterator<E>(enumeration); }
/** * Return all interfaces that the given class implements as array, * including ones implemented by superclasses. * <p>If the class itself is an interface, it gets returned as sole interface. * * @param clazz the class to analyze for interfaces * @return all interfaces that the given object implements as array */ public static Class<?>[] getAllInterfacesForClass(Class<?> clazz) { return getAllInterfacesForClass(clazz, null); }
/** * Convert a {@code Collection} into a delimited {@code String} (e.g., CSV). * <p>Useful for {@code toString()} implementations. * * @param coll the {@code Collection} to convert * @return the delimited {@code String} */ public static String collectionToCommaDelimitedString(Collection<?> coll) { return collectionToDelimitedString(coll, ","); }
/** * Determine whether the given class has a public constructor with the given signature. * <p>Essentially translates {@code NoSuchMethodException} to "false". * @param clazz the clazz to analyze * @param paramTypes the parameter types of the method * @return whether the class has a corresponding constructor * @see Class#getMethod */ public static boolean hasConstructor(Class<?> clazz, Class<?>... paramTypes) { return (getConstructorIfAvailable(clazz, paramTypes) != null); }
/** * Create a new DefaultResourceLoader. * <p>ClassLoader access will happen using the thread context class loader * at the time of this ResourceLoader's initialization. * * @see java.lang.Thread#getContextClassLoader() */ public DefaultResourceLoader() { this.classLoader = ClassUtils.getDefaultClassLoader(); }
/** * Truncate arbitrary reason into something that will fit into the CloseFrame limits. * * @param reason the arbitrary reason to possibly truncate. * @return the possibly truncated reason string. */ public static String truncate(String reason) { return StringUtils.truncate(reason, (ControlFrame.MAX_CONTROL_PAYLOAD - 2)); } }
@Override public void setListener(Listener listener) { Assert.notNull(listener, "The session listener must be not null"); this.listener = listener; }
/** * Create a new {@code ClassPathResource} for {@code Class} usage. * The path can be relative to the given class, or absolute within * the classpath via a leading slash. * * @param path relative or absolute path within the class path * @param clazz the class to load resources with * @see java.lang.Class#getResourceAsStream */ public ClassPathResource(String path, Class<?> clazz) { Assert.notNull(path, "Path must not be null"); this.path = StringUtils.cleanPath(path); this.clazz = clazz; }
private EncodedResource(Resource resource, String encoding, Charset charset) { super(); Assert.notNull(resource, "Resource must not be null"); this.resource = resource; this.encoding = encoding; this.charset = charset; }
private EncodedResource(Resource resource, String encoding, Charset charset) { super(); Assert.notNull(resource, "Resource must not be null"); this.resource = resource; this.encoding = encoding; this.charset = charset; }