/** * Handles an {@link HttpMethod#POST POST} request. * This method sends a {@link HttpStatus#METHOD_NOT_ALLOWED 405 Method Not Allowed} response by default. * * @deprecated Use {@link #doPost(ServiceRequestContext, HttpRequest)}. */ @Deprecated protected void doPost(ServiceRequestContext ctx, HttpRequest req, HttpResponseWriter res) throws Exception { res.respond(HttpStatus.METHOD_NOT_ALLOWED); }
/** * Handles an {@link HttpMethod#PUT PUT} request. * This method sends a {@link HttpStatus#METHOD_NOT_ALLOWED 405 Method Not Allowed} response by default. * * @deprecated Use {@link #doPut(ServiceRequestContext, HttpRequest)}. */ @Deprecated protected void doPut(ServiceRequestContext ctx, HttpRequest req, HttpResponseWriter res) throws Exception { res.respond(HttpStatus.METHOD_NOT_ALLOWED); }
/** * Handles an {@link HttpMethod#DELETE DELETE} request. * This method sends a {@link HttpStatus#METHOD_NOT_ALLOWED 405 Method Not Allowed} response by default. * * @deprecated Use {@link #doDelete(ServiceRequestContext, HttpRequest)}. */ @Deprecated protected void doDelete(ServiceRequestContext ctx, HttpRequest req, HttpResponseWriter res) throws Exception { res.respond(HttpStatus.METHOD_NOT_ALLOWED); }
/** * Handles an {@link HttpMethod#OPTIONS OPTIONS} request. * This method sends a {@link HttpStatus#METHOD_NOT_ALLOWED 405 Method Not Allowed} response by default. * * @deprecated Use {@link #doOptions(ServiceRequestContext, HttpRequest)}. */ @Deprecated protected void doOptions(ServiceRequestContext ctx, HttpRequest req, HttpResponseWriter res) throws Exception { res.respond(HttpStatus.METHOD_NOT_ALLOWED); }
/** * Handles an {@link HttpMethod#GET GET} request. * This method sends a {@link HttpStatus#METHOD_NOT_ALLOWED 405 Method Not Allowed} response by default. * * @deprecated Use {@link #doGet(ServiceRequestContext, HttpRequest)}. */ @Deprecated protected void doGet(ServiceRequestContext ctx, HttpRequest req, HttpResponseWriter res) throws Exception { res.respond(HttpStatus.METHOD_NOT_ALLOWED); }
/** * Handles an {@link HttpMethod#HEAD HEAD} request. * This method sends a {@link HttpStatus#METHOD_NOT_ALLOWED 405 Method Not Allowed} response by default. * * @deprecated Use {@link #doHead(ServiceRequestContext, HttpRequest)}. */ @Deprecated protected void doHead(ServiceRequestContext ctx, HttpRequest req, HttpResponseWriter res) throws Exception { res.respond(HttpStatus.METHOD_NOT_ALLOWED); }
/** * Handles an {@link HttpMethod#PATCH PATCH} request. * This method sends a {@link HttpStatus#METHOD_NOT_ALLOWED 405 Method Not Allowed} response by default. * * @deprecated Use {@link #doPatch(ServiceRequestContext, HttpRequest)}. */ @Deprecated protected void doPatch(ServiceRequestContext ctx, HttpRequest req, HttpResponseWriter res) throws Exception { res.respond(HttpStatus.METHOD_NOT_ALLOWED); }
/** * Handles an {@link HttpMethod#TRACE TRACE} request. * This method sends a {@link HttpStatus#METHOD_NOT_ALLOWED 405 Method Not Allowed} response by default. * * @deprecated Use {@link #doTrace(ServiceRequestContext, HttpRequest)}. */ @Deprecated protected void doTrace(ServiceRequestContext ctx, HttpRequest req, HttpResponseWriter res) throws Exception { res.respond(HttpStatus.METHOD_NOT_ALLOWED); } }
/** * Writes the HTTP response of the specified {@link HttpStatus} and closes the stream. * * @param mediaType the {@link MediaType} of the response content * @param content the content of the response * * @deprecated Use {@link HttpResponse#of(HttpStatus, MediaType, HttpData)}. */ @Deprecated default void respond(HttpStatus status, MediaType mediaType, HttpData content) { requireNonNull(status, "status"); requireNonNull(mediaType, "mediaType"); requireNonNull(content, "content"); respond(status, mediaType, content, HttpHeaders.EMPTY_HEADERS); }
/** * Writes the HTTP response of the specified {@code statusCode} and closes the stream if the * {@link HttpStatusClass} is not {@linkplain HttpStatusClass#INFORMATIONAL informational} (1xx). * * @deprecated Use {@link HttpResponse#of(int)}. */ @Deprecated default void respond(int statusCode) { respond(HttpStatus.valueOf(statusCode)); }
/** * Writes the HTTP response of the specified {@link HttpStatus} and closes the stream. * * @param mediaType the {@link MediaType} of the response content * @param content the content of the response * * @deprecated Use {@link HttpResponse#of(HttpStatus, MediaType, byte[])}. */ @Deprecated default void respond(HttpStatus status, MediaType mediaType, byte[] content) { requireNonNull(status, "status"); requireNonNull(mediaType, "mediaType"); requireNonNull(content, "content"); respond(status, mediaType, HttpData.of(content)); }
/** * Writes the HTTP response of the specified {@link HttpStatus} and closes the stream. * * @param mediaType the {@link MediaType} of the response content * @param content the content of the response * * @deprecated Use {@link HttpResponse#of(HttpStatus, MediaType, String)}. */ @Deprecated default void respond(HttpStatus status, MediaType mediaType, String content) { requireNonNull(status, "status"); requireNonNull(mediaType, "mediaType"); requireNonNull(content, "content"); respond(status, mediaType, content.getBytes(mediaType.charset().orElse(StandardCharsets.UTF_8))); }
/** * Writes the HTTP response of the specified {@link HttpStatus} and closes the stream. * * @param mediaType the {@link MediaType} of the response content * @param content the content of the response * @param offset the start offset of {@code content} * @param length the length of {@code content} * * @deprecated Use {@link HttpResponse#of(HttpStatus, MediaType, byte[], int, int)}. */ @Deprecated default void respond(HttpStatus status, MediaType mediaType, byte[] content, int offset, int length) { requireNonNull(status, "status"); requireNonNull(mediaType, "mediaType"); requireNonNull(content, "content"); respond(status, mediaType, HttpData.of(content, offset, length)); }
/** * Writes the HTTP response of the specified {@link HttpStatus} and closes the stream. * The content of the response is formatted by {@link String#format(Locale, String, Object...)} with * {@linkplain Locale#ENGLISH English locale}. * * @param mediaType the {@link MediaType} of the response content * @param format {@linkplain Formatter the format string} of the response content * @param args the arguments referenced by the format specifiers in the format string * * @deprecated Use {@link HttpResponse#of(HttpStatus, MediaType, String, Object...)}. */ @Deprecated default void respond(HttpStatus status, MediaType mediaType, String format, Object... args) { requireNonNull(status, "status"); requireNonNull(mediaType, "mediaType"); requireNonNull(format, "format"); requireNonNull(args, "args"); respond(status, mediaType, String.format(Locale.ENGLISH, format, args).getBytes( mediaType.charset().orElse(StandardCharsets.UTF_8))); }
/** * Writes the HTTP response of the specified {@link HttpStatus} and closes the stream if the * {@link HttpStatusClass} is not {@linkplain HttpStatusClass#INFORMATIONAL informational} (1xx). * * @deprecated Use {@link HttpResponse#of(HttpStatus)}. */ @Deprecated default void respond(HttpStatus status) { requireNonNull(status, "status"); if (status.codeClass() == HttpStatusClass.INFORMATIONAL) { write(HttpHeaders.of(status)); } else if (isContentAlwaysEmpty(status)) { write(HttpHeaders.of(status)); close(); } else { respond(status, MediaType.PLAIN_TEXT_UTF_8, status.toHttpData()); } }