org.debux.webmotion.server.tools.upload.RequestContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of toolkit-server Show documentation
Show all versions of toolkit-server Show documentation
ObServe Toolkit Server module
package org.debux.webmotion.server.tools.upload;
/*-
* #%L
* Toolkit :: Server
* %%
* Copyright (C) 2017 - 2024 Ultreia.io
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* .
* #L%
*/
import org.apache.commons.fileupload2.core.AbstractRequestContext;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
/**
* Created at 24/11/2023.
*
* @author Tony Chemit - [email protected]
* @since 9.3.0
*/
public class RequestContext extends AbstractRequestContext {
/**
* The request for which the context is being provided.
*/
private final HttpServletRequest request;
protected RequestContext(HttpServletRequest request) {
super(request::getHeader, request::getContentLength, request);
this.request = request;
}
/**
* Gets the character encoding for the request.
*
* @return The character encoding for the request.
*/
@Override
public String getCharacterEncoding() {
return request.getCharacterEncoding();
}
/**
* Gets the content type of the request.
*
* @return The content type of the request.
*/
@Override
public String getContentType() {
return request.getContentType();
}
/**
* Gets the input stream for the request.
*
* @return The input stream for the request.
* @throws java.io.IOException if a problem occurs.
*/
@Override
public InputStream getInputStream() throws IOException {
return request.getInputStream();
}
}