Skip to content
This repository was archived by the owner on Mar 3, 2026. It is now read-only.

Commit 7c3316f

Browse files
committed
Rename consume -> consumes in WebSocket and Route
1 parent 4f54865 commit 7c3316f

5 files changed

Lines changed: 9 additions & 27 deletions

File tree

jooby-core/src/main/java/jooby/Route.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ public Map<String, String> vars() {
326326
}
327327

328328
@Override
329-
public List<MediaType> consume() {
330-
return route.consume();
329+
public List<MediaType> consumes() {
330+
return route.consumes();
331331
}
332332

333333
@Override
@@ -478,7 +478,7 @@ private static String message(final Response.Status status, final String tail) {
478478

479479
Map<String, String> vars();
480480

481-
List<MediaType> consume();
481+
List<MediaType> consumes();
482482

483483
List<MediaType> produces();
484484

jooby-core/src/main/java/jooby/WebSocket.java

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import java.io.Closeable;
66
import java.io.Serializable;
7-
import java.util.Arrays;
8-
import java.util.List;
97
import java.util.Map;
108
import java.util.Optional;
119

@@ -146,22 +144,6 @@ public Definition name(final String name) {
146144
return this;
147145
}
148146

149-
/**
150-
* @param candidate A media type to test.
151-
* @return True, if the route can consume the given media type.
152-
*/
153-
public boolean canConsume(@Nonnull final MediaType candidate) {
154-
return MediaType.matcher(Arrays.asList(candidate)).matches(consumes);
155-
}
156-
157-
/**
158-
* @param candidates A media types to test.
159-
* @return True, if the route can produces the given media type.
160-
*/
161-
public boolean canProduce(final List<MediaType> candidates) {
162-
return MediaType.matcher(candidates).matches(produces);
163-
}
164-
165147
/**
166148
* Set the media types the route can consume.
167149
*
@@ -300,7 +282,7 @@ private WebSocket asWebSocket(final RouteMatcher matcher) {
300282

301283
Map<String, String> vars();
302284

303-
MediaType consume();
285+
MediaType consumes();
304286

305287
MediaType produces();
306288

jooby-core/src/main/java/jooby/internal/RouteImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public Map<String, String> vars() {
8888
}
8989

9090
@Override
91-
public List<MediaType> consume() {
91+
public List<MediaType> consumes() {
9292
return consumes;
9393
}
9494

@@ -104,7 +104,7 @@ public String toString() {
104104
buffer.append(" pattern: ").append(pattern()).append("\n");
105105
buffer.append(" name: ").append(name()).append("\n");
106106
buffer.append(" vars: ").append(vars()).append("\n");
107-
buffer.append(" consume: ").append(consume()).append("\n");
107+
buffer.append(" consumes: ").append(consumes()).append("\n");
108108
buffer.append(" produces: ").append(produces()).append("\n");
109109
return buffer.toString();
110110
}

jooby-core/src/main/java/jooby/internal/WebSocketImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public Map<String, String> vars() {
200200
}
201201

202202
@Override
203-
public MediaType consume() {
203+
public MediaType consumes() {
204204
return consumes;
205205
}
206206

@@ -221,7 +221,7 @@ public String toString() {
221221
buffer.append(" pattern: ").append(pattern()).append("\n");
222222
buffer.append(" name: ").append(name()).append("\n");
223223
buffer.append(" vars: ").append(vars()).append("\n");
224-
buffer.append(" consume: ").append(consume()).append("\n");
224+
buffer.append(" consumes: ").append(consumes()).append("\n");
225225
buffer.append(" produces: ").append(produces()).append("\n");
226226
return buffer.toString();
227227
}

jooby-core/src/main/java/jooby/internal/jetty/JettyWebSocketHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void onWebSocketText(final String value) {
4545
try {
4646
// for Web Socket, charset is always UTF-8
4747
Variant variant = new VariantImpl(injector, "message", ImmutableList.of(value),
48-
socket.consume(), Charsets.UTF_8);
48+
socket.consumes(), Charsets.UTF_8);
4949
socket.fireMessage(variant);
5050
} catch (Exception ex) {
5151
onWebSocketError(ex);

0 commit comments

Comments
 (0)