All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.micronaut.http.HttpRequestWrapper Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2017-2020 original authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.micronaut.http;

import io.micronaut.core.annotation.NonNull;
import io.micronaut.http.cookie.Cookies;

import javax.net.ssl.SSLSession;
import java.net.InetSocketAddress;
import java.net.URI;
import java.security.Principal;
import java.security.cert.Certificate;
import java.util.Collection;
import java.util.Locale;
import java.util.Optional;

/**
 * A wrapper around a {@link HttpRequest}.
 *
 * @param  The Http body type
 * @author Graeme Rocher
 * @since 1.0
 */
public class HttpRequestWrapper extends HttpMessageWrapper implements HttpRequest {

    /**
     * @param delegate The Http Request
     */
    public HttpRequestWrapper(HttpRequest delegate) {
        super(delegate);
    }

    @Override
    public HttpRequest getDelegate() {
        return (HttpRequest) super.getDelegate();
    }

    @Override
    public HttpVersion getHttpVersion() {
        return getDelegate().getHttpVersion();
    }

    @Override
    public Collection accept() {
        return getDelegate().accept();
    }

    @NonNull
    @Override
    public Optional getUserPrincipal() {
        return getDelegate().getUserPrincipal();
    }

    @NonNull
    @Override
    public  Optional getUserPrincipal(Class principalType) {
        return getDelegate().getUserPrincipal(principalType);
    }

    @Override
    public HttpRequest setAttribute(CharSequence name, Object value) {
        return getDelegate().setAttribute(name, value);
    }

    @Override
    public Optional getLocale() {
        return getDelegate().getLocale();
    }

    @Override
    public Optional getCertificate() {
        return getDelegate().getCertificate();
    }

    @Override
    public Optional getSslSession() {
        return getDelegate().getSslSession();
    }

    @Override
    public Cookies getCookies() {
        return getDelegate().getCookies();
    }

    @Override
    public HttpParameters getParameters() {
        return getDelegate().getParameters();
    }

    @Override
    public HttpMethod getMethod() {
        return getDelegate().getMethod();
    }

    @Override
    public String getMethodName() {
        return getDelegate().getMethodName();
    }

    @Override
    public URI getUri() {
        return getDelegate().getUri();
    }

    @Override
    public String getPath() {
        return getDelegate().getPath();
    }

    @Override
    public InetSocketAddress getRemoteAddress() {
        return getDelegate().getRemoteAddress();
    }

    @Override
    public InetSocketAddress getServerAddress() {
        return getDelegate().getServerAddress();
    }

    @Override
    public String getServerName() {
        return getDelegate().getServerName();
    }

    @Override
    public boolean isSecure() {
        return getDelegate().isSecure();
    }
}