001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more contributor license 003 * agreements. See the NOTICE file distributed with this work for additional information regarding 004 * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the 005 * "License"); you may not use this file except in compliance with the License. You may obtain a 006 * copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable 007 * law or agreed to in writing, software distributed under the License is distributed on an "AS IS" 008 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License 009 * for the specific language governing permissions and limitations under the License. 010 */ 011 package javax.portlet.faces; 012 013 import javax.faces.context.FacesContext; 014 import javax.portlet.Event; 015 import javax.portlet.faces.event.EventNavigationResult; 016 017 018 /** 019 * The <code>BridgeWriteBehindResponse</code> interface defines the api the bridge relies 020 * on to acquire the buffered JSP output from the response(Wrapper) used to handle the Faces 021 * implementation dependent writeBehindResponse methodlogy/interface.<p> 022 * 023 * Note: the Portlet 1.0 Bridge relied on Portlet 1.0 which didn't support response wrappers. 024 * In that version the writeBehindResponse behavior is provided in a Servlet ResponseWrapper inserted 025 * in a Servlet filter set up to be called on included JSPs. In Portlet 2.0 Bridge this behavior can 026 * now be implemented directly in a Portlet ResponseWrapper which can then be registered for use with the bridge. 027 * So that the bridge recognizes and use this support, such wrappers must implement this interface.<p> 028 * 029 * Implementations must be one of the Portlet 2.0 <code>ResponseWrappers</code> and have a null constructor that utilizes 030 * <code>FacesContext.getCurrentInstance().getExternalContext().getResponse()</code> 031 * to acquire the response to be wrapped. 032 */ 033 034 public interface BridgeWriteBehindResponse 035 { 036 /** 037 * Called by the bridge after dispatching is complete to determine whether the 038 * JSP AfterViewContent was written as chars (written via a <code>PrintWriter</code> 039 * 040 * 041 * @return <code>true</code> if the response (buffer) is represented as chars 042 * written via the <code>PrintWriter</code>, false otherwise. 043 */ 044 public boolean isChars(); 045 046 /** 047 * Called by the bridge after dispatching is complete to acquire the AfterJSPContent 048 * when the response has been written as characters. The bridge writes this buffer 049 * to the (real) response. 050 * 051 * @return the response as a char[]. 052 */ 053 public char[] getChars(); 054 055 /** 056 * Called by the bridge after dispatching is complete to determine whether the 057 * JSP AfterViewContent was written as bytes (written via an <code>OutputStream</code> 058 * 059 * 060 * @return <code>true</code> if the response (buffer) is represented as bytes 061 * written via the <code>OutputStream</code>, false otherwise. 062 */ 063 public boolean isBytes(); 064 065 /** 066 * Called by the bridge after dispatching is complete to acquire the AfterJSPContent 067 * when the response has been written as bytes. The bridge writes this buffer 068 * to the (real) response. 069 * 070 * @return the response as a byte[]. 071 */ 072 public byte[] getBytes(); 073 }