Home / Function/ String() — netty Function Reference

String() — netty Function Reference

Architecture documentation for the String() function in Http2StaticFileServerHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  bee797c3_b154_b94c_1693_d12a0b7044ff["String()"]
  0106d702_a5aa_70a0_2d44_3e8c79971862["Http2StaticFileServerHandler"]
  bee797c3_b154_b94c_1693_d12a0b7044ff -->|defined in| 0106d702_a5aa_70a0_2d44_3e8c79971862
  style bee797c3_b154_b94c_1693_d12a0b7044ff fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http2/file/Http2StaticFileServerHandler.java lines 225–247

    private static String sanitizeUri(String uri) throws UnsupportedEncodingException {
        // Decode the path.
        uri = URLDecoder.decode(uri, "UTF-8");

        if (uri.isEmpty() || uri.charAt(0) != '/') {
            return null;
        }

        // Convert file separators.
        uri = uri.replace('/', File.separatorChar);

        // Simplistic dumb security check.
        // You will have to do something serious in the production environment.
        if (uri.contains(File.separator + '.') ||
                uri.contains('.' + File.separator) ||
                uri.charAt(0) == '.' || uri.charAt(uri.length() - 1) == '.' ||
                INSECURE_URI.matcher(uri).matches()) {
            return null;
        }

        // Convert to absolute path.
        return SystemPropertyUtil.get("user.dir") + File.separator + uri;
    }

Domain

Subdomains

Frequently Asked Questions

What does String() do?
String() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/http2/file/Http2StaticFileServerHandler.java.
Where is String() defined?
String() is defined in example/src/main/java/io/netty/example/http2/file/Http2StaticFileServerHandler.java at line 225.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free