
org.xlightweb.HttpRequestWrapper Maven / Gradle / Ivy
/*
* Copyright (c) xlightweb.org, 2008. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Please refer to the LGPL license at: http://www.gnu.org/copyleft/lesser.txt
* The latest copy of this software may be found on http://www.xlightweb.org/
*/
package org.xlightweb;
import java.io.IOException;
/**
* Provides a convenient implementation of the HttpRequest interface that can
* be subclassed by developers wishing to adapt the request. This class implements
* the Wrapper or Decorator pattern. Methods default to calling through to the
* wrapped request object.
*
* @author [email protected]
*/
public class HttpRequestWrapper extends HttpRequestHeaderWrapper implements IHttpRequest {
private IHttpRequest request = null;
/**
* constructor
*
* @param request the request to wrap
*/
public HttpRequestWrapper(IHttpRequest request) {
this(request.getRequestHeader(), request);
}
/**
* constructor
*
* @param requestHeader the delegee header
* @param request the delegee message
*/
HttpRequestWrapper(IHttpRequestHeader requestHeader, IHttpRequest request) {
super(requestHeader);
this.request = request;
}
/**
* {@inheritDoc}
*/
public String getContextPath() {
return request.getContextPath();
}
/**
* {@inheritDoc}
*/
public String getRequestHandlerPath() {
return request.getRequestHandlerPath();
}
/**
* {@inheritDoc}
*/
public IHttpRequestHeader getRequestHeader() {
return request.getRequestHeader();
}
/**
* {@inheritDoc}
*/
public String getConnection() {
return request.getConnection();
}
/**
* {@inheritDoc}
*/
public String getDate() {
return request.getDate();
}
/**
* {@inheritDoc}
*/
public String getHost() {
return request.getHost();
}
/**
* {@inheritDoc}
*/
public String getKeepAlive() {
return request.getKeepAlive();
}
/**
* {@inheritDoc}
*/
public String getServer() {
return request.getServer();
}
/**
* {@inheritDoc}
*/
public String getUpgrade() {
return request.getUpgrade();
}
/**
* {@inheritDoc}
*/
public String getUserAgent() {
return request.getUserAgent();
}
/**
* {@inheritDoc}
*/
public void setConnection(String connection) {
request.setConnection(connection);
}
/**
* {@inheritDoc}
*/
public void setDate(String date) {
request.setDate(date);
}
/**
* {@inheritDoc}
*/
public void setHost(String host) {
request.setHost(host);
}
/**
* {@inheritDoc}
*/
public void setKeepAlive(String keepAlive) {
request.setKeepAlive(keepAlive);
}
/**
* {@inheritDoc}
*/
public void setServer(String server) {
request.setServer(server);
}
/**
* {@inheritDoc}
*/
public void setUpgrade(String upgrade) {
request.setUpgrade(upgrade);
}
/**
* {@inheritDoc}
*/
public void setUserAgent(String userAgent) {
request.setUserAgent(userAgent);
}
/**
* {@inheritDoc}
*/
public void setContextPath(String contextPath) {
request.setContextPath(contextPath);
}
/**
* {@inheritDoc}
*/
public void setRequestHandlerPath(String requestHandlerPath) {
request.setRequestHandlerPath(requestHandlerPath);
}
/**
* {@inheritDoc}
*/
public BlockingBodyDataSource getBlockingBody() throws IOException {
return request.getBlockingBody();
}
/**
* {@inheritDoc}
*/
public IHttpHeader getMessageHeader() {
return request.getMessageHeader();
}
/**
* {@inheritDoc}
*/
public NonBlockingBodyDataSource getNonBlockingBody() throws IOException {
return request.getNonBlockingBody();
}
/**
* {@inheritDoc}
*/
public boolean hasBody() {
return request.hasBody();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy