Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Changes log
communication-error response callback.
- HTTP/2 and HTTP/3 requests advertise `te: trailers`; stream header names are normalized
to lowercase at the HTTP boundary.
- Added the `Protocol.STDIO` pseudo-protocol constant for standard input/output connectors.
- Bugs fixed
- Slf4j bridge reports wrong line number and caller class in log4j. Issue #233.
- When GET is an allowed method of a server resource, HEAD is now also listed (e.g. in the Allow header of a 405 response). Issue #266.
Expand Down
6 changes: 6 additions & 0 deletions org.restlet/src/main/java/org/restlet/data/Protocol.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ public final class Protocol {
public static final Protocol RIAP =
new Protocol("riap", "RIAP", "Restlet Internal Access Protocol", UNKNOWN_PORT, true);

/** Standard Input/Output pseudo-protocol. */
public static final Protocol STDIO =
new Protocol("stdio", "STDIO", "Standard Input/Output Streams", UNKNOWN_PORT);

/**
* ZIP is a special scheme to access to representations inside Zip archive files. Example URI:
* "zip:file:///tmp/test.zip!/test.txt".
Expand Down Expand Up @@ -127,6 +131,8 @@ public static Protocol valueOf(String name) {
result = JDBC;
} else if (name.equalsIgnoreCase(RIAP.getSchemeName())) {
result = RIAP;
} else if (name.equalsIgnoreCase(STDIO.getSchemeName())) {
result = STDIO;
} else if (name.equalsIgnoreCase(ZIP.getSchemeName())) {
result = ZIP;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,18 @@ void valueOf_knownScheme_returnsSharedConstant() {
assertSame(Protocol.JAR, Protocol.valueOf("jar"));
assertSame(Protocol.JDBC, Protocol.valueOf("jdbc"));
assertSame(Protocol.RIAP, Protocol.valueOf("riap"));
assertSame(Protocol.STDIO, Protocol.valueOf("stdio"));
assertSame(Protocol.ZIP, Protocol.valueOf("zip"));
}

@Test
void stdio_isAnUnknownPortPseudoProtocol() {
assertEquals("stdio", Protocol.STDIO.getSchemeName());
assertEquals("STDIO", Protocol.STDIO.getName());
assertEquals(Protocol.UNKNOWN_PORT, Protocol.STDIO.getDefaultPort());
assertFalse(Protocol.STDIO.isConfidential());
}

@Test
void valueOf_unknownScheme_createsNewProtocol() {
Protocol protocol = Protocol.valueOf("custom");
Expand Down
Loading