Ether Framework
Unified API docs for Ether modules
Loading...
Searching...
No Matches
DelegatingResourceHandler.java
Go to the documentation of this file.
1package dev.rafex.ether.http.jetty12;
2
3/*-
4 * #%L
5 * ether-http-jetty12
6 * %%
7 * Copyright (C) 2025 - 2026 Raúl Eduardo González Argote
8 * %%
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 * THE SOFTWARE.
26 * #L%
27 */
28
29import java.util.Objects;
30import java.util.Set;
31
32import dev.rafex.ether.http.core.HttpExchange;
33import dev.rafex.ether.http.core.HttpResource;
34import dev.rafex.ether.http.jetty12.handler.ResourceHandler;
35import dev.rafex.ether.json.JsonCodec;
36
37final class DelegatingResourceHandler extends ResourceHandler {
38
39 private final String basePath;
40 private final HttpResource delegate;
41
42 DelegatingResourceHandler(final String basePath, final HttpResource delegate, final JsonCodec jsonCodec) {
43 super(jsonCodec);
44 this.basePath = Objects.requireNonNull(basePath, "basePath");
45 this.delegate = Objects.requireNonNull(delegate, "delegate");
46 }
47
48 @Override
49 protected String basePath() {
50 return basePath;
51 }
52
53 @Override
54 public boolean get(final HttpExchange x) throws Exception {
55 return delegate.get(x);
56 }
57
58 @Override
59 public boolean post(final HttpExchange x) throws Exception {
60 return delegate.post(x);
61 }
62
63 @Override
64 public boolean put(final HttpExchange x) throws Exception {
65 return delegate.put(x);
66 }
67
68 @Override
69 public boolean delete(final HttpExchange x) throws Exception {
70 return delegate.delete(x);
71 }
72
73 @Override
74 public boolean patch(final HttpExchange x) throws Exception {
75 return delegate.patch(x);
76 }
77
78 @Override
79 public boolean options(final HttpExchange x) throws Exception {
80 return delegate.options(x);
81 }
82
83 @Override
84 public Set<String> supportedMethods() {
85 return delegate.supportedMethods();
86 }
87}
default Set< String > supportedMethods()
default boolean patch(final HttpExchange x)
default boolean delete(final HttpExchange x)
default boolean put(final HttpExchange x)
default boolean get(final HttpExchange x)
default boolean options(final HttpExchange x)
default boolean post(final HttpExchange x)