Class Utils

java.lang.Object
me.desair.tus.server.util.Utils

public class Utils extends Object
Utility class that contains various static helper methods
  • Method Details

    • getHeader

      public static String getHeader(jakarta.servlet.http.HttpServletRequest request, String header)
    • getLongHeader

      public static Long getLongHeader(jakarta.servlet.http.HttpServletRequest request, String header)
    • buildRemoteIpList

      public static String buildRemoteIpList(jakarta.servlet.http.HttpServletRequest servletRequest)
      Build a comma-separated list based on the remote address of the request and the X-Forwareded-For header. The list is constructed as "client, proxy1, proxy2".
      Returns:
      A comma-separated list of ip-addresses
    • parseConcatenationIDsFromHeader

      public static List<String> parseConcatenationIDsFromHeader(String uploadConcatValue)
    • readSerializable

      public static <T> T readSerializable(Path path, Class<T> clazz) throws IOException
      Throws:
      IOException
    • writeSerializable

      public static void writeSerializable(Serializable object, Path path) throws IOException
      Throws:
      IOException
    • lockFileExclusively

      public static FileLock lockFileExclusively(FileChannel channel) throws IOException
      Throws:
      IOException
    • lockFileShared

      public static FileLock lockFileShared(FileChannel channel) throws IOException
      Throws:
      IOException
    • sleep

      public static void sleep(long sleepTimeMillis)
      Sleep the specified number of milliseconds
      Parameters:
      sleepTimeMillis - The time to sleep in milliseconds