@@ -153,11 +153,11 @@ default boolean accept(MediaType contentType) {
153153 return contentType .matches (accept );
154154 }
155155
156- @ Nonnull default MediaType requestType () {
156+ @ Nullable default MediaType contentType () {
157157 return header ("Content-Type" ).toOptional ().map (MediaType ::valueOf ).orElse (null );
158158 }
159159
160- default long requestLength () {
160+ default long contentLength () {
161161 return header ("Content-Length" ).longValue (-1 );
162162 }
163163
@@ -321,45 +321,45 @@ default long requestLength() {
321321 * **********************************************************************************************
322322 */
323323
324- @ Nonnull default Context header (@ Nonnull String name , @ Nonnull Date value ) {
325- return header (name , RFC1123 .format (Instant .ofEpochMilli (value .getTime ())));
324+ @ Nonnull default Context setHeader (@ Nonnull String name , @ Nonnull Date value ) {
325+ return setHeader (name , RFC1123 .format (Instant .ofEpochMilli (value .getTime ())));
326326 }
327327
328- @ Nonnull default Context header (@ Nonnull String name , @ Nonnull Instant value ) {
329- return header (name , RFC1123 .format (value ));
328+ @ Nonnull default Context setHeader (@ Nonnull String name , @ Nonnull Instant value ) {
329+ return setHeader (name , RFC1123 .format (value ));
330330 }
331331
332- @ Nonnull default Context header (@ Nonnull String name , @ Nonnull Object value ) {
332+ @ Nonnull default Context setHeader (@ Nonnull String name , @ Nonnull Object value ) {
333333 if (value instanceof Date ) {
334- return header (name , (Date ) value );
334+ return setHeader (name , (Date ) value );
335335 }
336336 if (value instanceof Instant ) {
337- return header (name , (Instant ) value );
337+ return setHeader (name , (Instant ) value );
338338 }
339- return header (name , value .toString ());
339+ return setHeader (name , value .toString ());
340340 }
341341
342- @ Nonnull Context header (@ Nonnull String name , @ Nonnull String value );
342+ @ Nonnull Context setHeader (@ Nonnull String name , @ Nonnull String value );
343343
344- @ Nonnull Context responseLength (long length );
344+ @ Nonnull Context setContentLength (long length );
345345
346- @ Nonnull default Context responseType (@ Nonnull String contentType ) {
347- return responseType (MediaType .valueOf (contentType ));
346+ @ Nonnull default Context setContentType (@ Nonnull String contentType ) {
347+ return setContentType (MediaType .valueOf (contentType ));
348348 }
349349
350- @ Nonnull default Context responseType (@ Nonnull MediaType contentType ) {
351- return responseType (contentType , contentType .charset ());
350+ @ Nonnull default Context setContentType (@ Nonnull MediaType contentType ) {
351+ return setContentType (contentType , contentType .charset ());
352352 }
353353
354- @ Nonnull default Context defaultResponseType (@ Nonnull String contentType ) {
355- return defaultResponseType (MediaType .valueOf (contentType ));
354+ @ Nonnull default Context setDefaultContentType (@ Nonnull String contentType ) {
355+ return setDefaultContentType (MediaType .valueOf (contentType ));
356356 }
357357
358- @ Nonnull Context defaultResponseType (@ Nonnull MediaType contentType );
358+ @ Nonnull Context setDefaultContentType (@ Nonnull MediaType contentType );
359359
360- @ Nonnull Context responseType (@ Nonnull MediaType contentType , @ Nullable Charset charset );
360+ @ Nonnull Context setContentType (@ Nonnull MediaType contentType , @ Nullable Charset charset );
361361
362- @ Nonnull MediaType responseType ();
362+ @ Nonnull MediaType responseContentType ();
363363
364364 @ Nonnull default Context statusCode (StatusCode statusCode ) {
365365 return statusCode (statusCode .value ());
@@ -384,13 +384,13 @@ default long requestLength() {
384384 @ Nonnull OutputStream responseStream ();
385385
386386 default @ Nonnull OutputStream responseStream (MediaType contentType ) {
387- responseType (contentType );
387+ setContentType (contentType );
388388 return responseStream ();
389389 }
390390
391391 default @ Nonnull Context responseStream (MediaType contentType ,
392392 Throwing .Consumer <OutputStream > consumer ) throws Exception {
393- responseType (contentType );
393+ setContentType (contentType );
394394 return responseStream (consumer );
395395 }
396396
@@ -436,7 +436,7 @@ default long requestLength() {
436436 }
437437
438438 default @ Nonnull Context sendRedirect (@ Nonnull StatusCode redirect , @ Nonnull String location ) {
439- header ("location" , location );
439+ setHeader ("location" , location );
440440 return sendStatusCode (redirect );
441441 }
442442
@@ -457,13 +457,13 @@ default long requestLength() {
457457 @ Nonnull Context sendStream (@ Nonnull InputStream input );
458458
459459 default Context sendAttachment (AttachedFile file ) {
460- header ("Content-Disposition" , file .contentDisposition ());
460+ setHeader ("Content-Disposition" , file .contentDisposition ());
461461 InputStream content = file .content ();
462462 long length = file .length ();
463463 if (length > 0 ) {
464- responseLength (length );
464+ setContentLength (length );
465465 }
466- defaultResponseType (file .contentType ());
466+ setDefaultContentType (file .contentType ());
467467 if (content instanceof FileInputStream ) {
468468 sendFile (((FileInputStream ) content ).getChannel ());
469469 } else {
0 commit comments