public class IOUtils
extends java.lang.Object
| Constructor and Description |
|---|
IOUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
close(java.io.Closeable... closeableArray)
Tries to close the given objects and log the
IOException at INFO level
to make the code more readable when we assume that the IOException won't be managed. |
static void |
deliver(java.lang.Object o,
DeliverTo deliverConfig,
DeliverTo.DELIVER_TO defaultDeliver,
AtmosphereResource r)
Delivers the given message according to the specified {@link org.atmosphere.config.service.DeliverTo configuration).
|
static byte[] |
forceReadEntirelyAsByte(AtmosphereResource r)
Reads request body as bytes without respect
ApplicationConfig.READ_GET_BODY parameter |
static java.lang.String |
getCleanedServletPath(java.lang.String fullServletPath)
Used to remove trailing slash and wildcard from a servlet path.
Examples : - "/foo/" becomes "/foo" - "foo/bar" becomes "/foo/bar" |
static java.lang.String |
guestRawServletPath(AtmosphereConfig config) |
static java.lang.String |
guestServletPath(AtmosphereConfig config) |
static boolean |
isAtmosphere(java.lang.String className) |
static boolean |
isBodyBinary(AtmosphereRequest request) |
static boolean |
isBodyEmpty(java.lang.Object o) |
static java.lang.Class<?> |
loadClass(java.lang.Class<?> thisClass,
java.lang.String className)
Loading the specified class using some heuristics to support various containers
The order of preferece is:
1.
|
static java.lang.Object |
readEntirely(AtmosphereResource r) |
static byte[] |
readEntirelyAsByte(AtmosphereResource r) |
static java.lang.StringBuilder |
readEntirelyAsString(AtmosphereResource r) |
static java.util.Map<java.lang.String,AtmosphereFramework.MetaServiceAction> |
readServiceFile(java.lang.String path)
This method reads the given file stored under "META-INF/services" and accessed through the framework's class loader
to specify a list of
actions to be done on different
service classes (AtmosphereInterceptor, BroadcastFilter, etc). |
static java.lang.String |
realPath(javax.servlet.ServletContext servletContext,
java.lang.String targetPath) |
public static void deliver(java.lang.Object o,
DeliverTo deliverConfig,
DeliverTo.DELIVER_TO defaultDeliver,
AtmosphereResource r)
Delivers the given message according to the specified {@link org.atmosphere.config.service.DeliverTo configuration).
o - the messagedeliverConfig - the annotation statedefaultDeliver - the strategy applied if deliverConfig is nullr - the resourcepublic static java.lang.Object readEntirely(AtmosphereResource r) throws java.io.IOException
java.io.IOExceptionpublic static final boolean isBodyBinary(AtmosphereRequest request)
public static final boolean isBodyEmpty(java.lang.Object o)
public static java.lang.StringBuilder readEntirelyAsString(AtmosphereResource r) throws java.io.IOException
java.io.IOExceptionpublic static byte[] readEntirelyAsByte(AtmosphereResource r) throws java.io.IOException
java.io.IOExceptionpublic static byte[] forceReadEntirelyAsByte(AtmosphereResource r) throws java.io.IOException
ApplicationConfig.READ_GET_BODY parameterjava.io.IOExceptionpublic static java.lang.String guestServletPath(AtmosphereConfig config)
public static java.lang.String guestRawServletPath(AtmosphereConfig config)
public static java.lang.String getCleanedServletPath(java.lang.String fullServletPath)
fullServletPath - : Servlet mappingpublic static java.lang.Class<?> loadClass(java.lang.Class<?> thisClass,
java.lang.String className)
throws java.lang.Exception
thisClass - className - java.lang.Exceptionpublic static boolean isAtmosphere(java.lang.String className)
public static java.util.Map<java.lang.String,AtmosphereFramework.MetaServiceAction> readServiceFile(java.lang.String path)
This method reads the given file stored under "META-INF/services" and accessed through the framework's class loader
to specify a list of actions to be done on different
service classes (AtmosphereInterceptor, BroadcastFilter, etc).
The file content should follows the following format:
INSTALL com.mycompany.MyInterceptor com.mycompany.MyFilter EXCLUDE org.atmosphere.interceptor.HeartbeatInterceptor
If you don't specify any AtmosphereFramework.MetaServiceAction before a class, then
default action will be AtmosphereFramework.MetaServiceAction.INSTALL.
Important note: you must specify a class declared inside a package. Since creating classes in the source root is a bad practice, the method does not deal with it to improve its performances.
path - the service file to readpublic static void close(java.io.Closeable... closeableArray)
Tries to close the given objects and log the IOException at INFO level
to make the code more readable when we assume that the IOException won't be managed.
Also ignore null parameters.
closeableArray - the objects to closepublic static java.lang.String realPath(javax.servlet.ServletContext servletContext,
java.lang.String targetPath)
throws java.net.MalformedURLException
java.net.MalformedURLExceptionCopyright © 2022. All Rights Reserved.