@Test public void contentLength() { HashRequestHeaders hs = withHeader(Http.Header.CONTENT_LENGTH, "1024"); assertThat(hs.contentLength().isPresent(), is(true)); assertThat(hs.contentLength().getAsLong(), is(1024L)); }
@Override public OptionalLong contentLength() { Optional<String> v = first(Http.Header.CONTENT_LENGTH); if (v.isPresent()) { return OptionalLong.of(Long.parseLong(v.get())); } else { return OptionalLong.empty(); } }
HashRequestHeaders extends ReadOnlyParameters implements RequestHeaders { @Override public OptionalLong contentLength() { Optional<String> v = first(Http.Header.CONTENT_LENGTH); if (v.isPresent()) { return OptionalLong.of(Long.parseLong(v.get())); } else { return OptionalLong.empty(); } } }
HashRequestHeaders extends ReadOnlyParameters implements RequestHeaders { @Override public OptionalLong contentLength() { Optional<String> v = first(Http.Header.CONTENT_LENGTH); if (v.isPresent()) { return OptionalLong.of(Long.parseLong(v.get())); } else { return OptionalLong.empty(); } } HashRequestHeaders();   HashRequestHeaders(Map<String, List<String>> initialContent); }
HashRequestHeaders extends ReadOnlyParameters implements RequestHeaders { @Override public OptionalLong contentLength() { Optional<String> v = first(Http.Header.CONTENT_LENGTH); if (v.isPresent()) { return OptionalLong.of(Long.parseLong(v.get())); } else { return OptionalLong.empty(); } } HashRequestHeaders();   HashRequestHeaders(Map<String, List<String>> initialContent); @Override Optional<MediaType> contentType(); @Override OptionalLong contentLength(); @Override Parameters cookies(); @Override List<MediaType> acceptedTypes(); @Override boolean isAccepted(MediaType mediaType); @Override Optional<MediaType> bestAccepted(MediaType... mediaTypes); @Override Optional<ZonedDateTime> acceptDatetime(); @Override Optional<ZonedDateTime> date(); @Override Optional<ZonedDateTime> ifModifiedSince(); @Override Optional<ZonedDateTime> ifUnmodifiedSince(); @Override Optional<URI> referer(); }
HashRequestHeaders extends ReadOnlyParameters implements RequestHeaders { @Override public OptionalLong contentLength() { Optional<String> v = first(Http.Header.CONTENT_LENGTH); if (v.isPresent()) { return OptionalLong.of(Long.parseLong(v.get())); } else { return OptionalLong.empty(); } } HashRequestHeaders();   HashRequestHeaders(Map<String, List<String>> initialContent); @Override Optional<MediaType> contentType(); @Override OptionalLong contentLength(); @Override Parameters cookies(); @Override List<MediaType> acceptedTypes(); @Override boolean isAccepted(MediaType mediaType); @Override Optional<MediaType> bestAccepted(MediaType... mediaTypes); @Override Optional<ZonedDateTime> acceptDatetime(); @Override Optional<ZonedDateTime> date(); @Override Optional<ZonedDateTime> ifModifiedSince(); @Override Optional<ZonedDateTime> ifUnmodifiedSince(); @Override Optional<URI> referer();  }