javax.portlet.filter.RenderResponseWrapper Maven / Gradle / Ivy
/* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*
* http://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.
*/
/*
* NOTE: this source code is based on an early draft version of JSR 286 and not intended for product
* implementations. This file may change or vanish in the final version of the JSR 286 specification.
*/
/*
* This source code implements specifications defined by the Java
* Community Process. In order to remain compliant with the specification
* DO NOT add / change / or delete method signatures!
*/
/*
* Copyright 2006 IBM Corporation.
*
*/
package javax.portlet.filter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Locale;
import javax.portlet.CacheControl;
import javax.portlet.PortletMode;
import javax.portlet.PortletURL;
import javax.portlet.RenderResponse;
import javax.portlet.ResourceURL;
/**
* The RenderResponseWrapper
provides a convenient
* implementation of the RenderResponse
interface
* that can be subclassed by developers wishing to adapt the response.
* This class implements the Wrapper or Decorator pattern.
* Methods default to calling through to the wrapped response object.
*
* @since 2.0
* @see RenderResponse
*/
public class RenderResponseWrapper extends PortletResponseWrapper implements RenderResponse {
RenderResponse response;
/**
* Creates an RenderResponse
adaptor
* wrapping the given response object.
*
* @param response the event response to wrap
* @throws java.lang.IllegalArgumentException if the response is null
*/
public RenderResponseWrapper(RenderResponse response) {
super(response);
this.response = response;
}
/**
* The default behavior of this method is to call
* flushBuffer()
on the wrapped response object.
*/
public void flushBuffer() throws IOException {
response.flushBuffer();
}
/**
* The default behavior of this method is to call
* getBufferSize()
on the wrapped response object.
*/
public int getBufferSize() {
return response.getBufferSize();
}
/**
* The default behavior of this method is to call
* getCharacterEncoding()
on the wrapped response object.
*/
public String getCharacterEncoding() {
return response.getCharacterEncoding();
}
/**
* The default behavior of this method is to call
* getContentType()
on the wrapped response object.
*/
public String getContentType() {
return response.getContentType();
}
/**
* The default behavior of this method is to call
* getLocale()
on the wrapped response object.
*/
public Locale getLocale() {
return response.getLocale();
}
/**
* The default behavior of this method is to call
* getPortletOutputStream()
on the wrapped response object.
*/
public OutputStream getPortletOutputStream() throws IOException {
return response.getPortletOutputStream();
}
/**
* The default behavior of this method is to call
* getWriter()
on the wrapped response object.
*/
public PrintWriter getWriter() throws IOException {
return response.getWriter();
}
/**
* The default behavior of this method is to call
* isCommitted()
on the wrapped response object.
*/
public boolean isCommitted() {
return response.isCommitted();
}
/**
* The default behavior of this method is to call
* reset()
on the wrapped response object.
*/
public void reset() {
response.reset();
}
/**
* The default behavior of this method is to call
* resetBuffer()
on the wrapped response object.
*/
public void resetBuffer() {
response.resetBuffer();
}
/**
* The default behavior of this method is to call
* setBufferSize(size)
on the wrapped response object.
*/
public void setBufferSize(int size) {
response.setBufferSize(size);
}
/**
* The default behavior of this method is to call
* setContentType(type)
on the wrapped response object.
*/
public void setContentType(String type) {
response.setContentType(type);
}
/**
* The default behavior of this method is to call
* setTitle(title)
on the wrapped response object.
*/
public void setTitle(String title) {
response.setTitle(title);
}
/**
* The default behavior of this method is to call
* getCacheControl()
on the wrapped response object.
*/
public CacheControl getCacheControl() {
return response.getCacheControl();
}
/**
* The default behavior of this method is to call
* setNextPossiblePortletModes()
on the wrapped response object.
*/
public void setNextPossiblePortletModes(Collection portletModes) {
response.setNextPossiblePortletModes(portletModes);
}
/**
* Return the wrapped response object.
*
* @return the wrapped response
*/
public RenderResponse getResponse() {
return response;
}
/**
* Sets the response object being wrapped.
*
* @param response the response to set
* @throws java.lang.IllegalArgumentException if the response is null.
*/
public void setResponse(RenderResponse response) {
if ( response == null)
throw new java.lang.IllegalArgumentException("Response is null");
this.response = response;
}
/**
* The default behavior of this method is to call
* createActionURL()
on the wrapped response object.
*/
public PortletURL createActionURL() throws IllegalStateException {
return response.createActionURL();
}
/**
* The default behavior of this method is to call
* createRenderURL()
on the wrapped response object.
*/
public PortletURL createRenderURL() throws IllegalStateException {
return response.createRenderURL();
}
/**
* The default behavior of this method is to call
* createResourceURL()
on the wrapped response object.
*/
public ResourceURL createResourceURL() throws IllegalStateException {
return response.createResourceURL();
}
}