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.portlet.ActionRequest;
014    import javax.portlet.ActionResponse;
015    import javax.portlet.EventRequest;
016    import javax.portlet.EventResponse;
017    import javax.portlet.PortletConfig;
018    import javax.portlet.PortletException;
019    import javax.portlet.RenderRequest;
020    import javax.portlet.RenderResponse;
021    import javax.portlet.ResourceRequest;
022    import javax.portlet.ResourceResponse;
023    import javax.portlet.UnavailableException;
024    
025    /**
026     * The <CODE>Bridge</CODE> interface is used by a portlet to execute a JSF artifact. Its lifecycle
027     * follows the pattern used by other web components such as portlets or servlets, namely:
028     * <ul>
029     * <li><code>init</code>: one time (per portlet) initialization. Usually invoked during portlet
030     * <code>init</code> but may also occur lazily. Context is passed to the Bridge at initialization
031     * via <code>PortletContext</code> attributes. See method description for details. </li>
032     * <li><code>doFacesRequest</code>: called for each portlet request that is to be handled by
033     * Faces. Must only be called after the bridge has been initialized. </li>
034     * <li><code>destroy</code>: called to destroy this bridge instance. Usually invoked during
035     * portlet <code>destroy</code> but may also occur earlier if the portlet decides to reclaim
036     * resources. </li>
037     * </ul>
038     * <P>
039     * Portlet developers are encouraged to allow deployers an ability to configure the particular
040     * Bridge implementation it uses within a given deployment. This ensures a best fit solution for a
041     * given application server, portlet container, and/or Faces environment. The specifics for this
042     * configuation are undefined. Each portlet can define a preferred mechanism. Subclasses of
043     * {@link GenericFacesPortlet} automatically inherit this behavior as it recognizes a defined
044     * portlet initialization parameter.
045     * <p>
046     * Implementations of this <code>Bridge</code> interface are required to have a <code>code</code>
047     * constructor.
048     */
049    public interface
050    
051    Bridge
052    {
053    
054      // Base Bridge attribute/context parameter prefix
055      public static final String BRIDGE_PACKAGE_PREFIX = "javax.portlet.faces.";
056    
057      // Following are the names of context init parameters that control
058      // Bridge behavior. These are specified in the web.xml
059    
060      /**
061       * Context initialization parameter that specifies the maximum number of bridge
062       * request scopes to preserved across all uses within this application.
063       */
064      public static final String MAX_MANAGED_REQUEST_SCOPES = 
065        BRIDGE_PACKAGE_PREFIX + "MAX_MANAGED_REQUEST_SCOPES";
066    
067      /**
068       * Context initialization parameter that defines the policy the bridge uses for
069       * rendering.  Parameter value is the string representaiton of one of the 
070       * BridgeRenderPolicy enum values.
071       */
072      public static final String RENDER_POLICY = BRIDGE_PACKAGE_PREFIX + "RENDER_POLICY";
073    
074      /**
075       * Context initialization parameter that defines the lifecycle ID used to 
076       * identify the Faces Lifecycle used for this application.
077       */
078      public static final String LIFECYCLE_ID = "javax.faces.LIFECYCLE_ID";
079    
080      /**
081       * Context initialization parameter that defines the SAVESTATE_FIELD_MARKER
082       * in use in the given deployment.  If not set, consult your bridge implementation
083       * documentation to determine which Faces implementations it automatically
084       * detects and supports.  For example the bridge RI will detect and run
085       * properly in either the Faces RI or MyFaces environments without this being set.
086       */
087      public static final String SAVESTATE_FIELD_MARKER = 
088        BRIDGE_PACKAGE_PREFIX + "SAVESTATE_FIELD_MARKER";
089    
090      // Following are the names of context init attributes set by the portlet to control
091      // Bridge behavior. For the GenericFacesPortlet, the values for these come from 
092      // portlet initialization parameters in the portlet.xml
093      
094      /** A PortletContext attribute that a portlet can set prior
095       * to calling the bridge's init() method to configure the bridge to exclude
096       * specific attributes from its bridge request scope. Value is a comma delimited
097       * list containing either a fully qualified attribute name or package name terminated
098       * with a ".*" wildcard indicator.  In this later case, all attributes in the package
099       * name which precedes the ".*" are excluded, non recursive.<br>
100       *
101       * As this attribute is scoped to a specific portlet in an application-wide context
102       * the attribute name must be include the portlet name as follows:
103       * BRIDGE_PACKAGE_PREFIX + context.getPortletName() + excludedRequestAttributes
104       */
105      public static final String EXCLUDED_REQUEST_ATTRIBUTES = "excludedRequestAttributes";
106    
107      /** PortletContext attribute that a portlet must set prior
108       * to calling the bridge's init() method to convey to the bridge the set of default
109       * viewIds that correspond to this portlet's supported <code>PortletMode</code>s. 
110       * Its value is a Map with one entry per mode.  The mode name is the key.  The entry's
111       * value is the corresponding default viewId the bridge should use for this mode.
112       * <br>
113       *
114       * As this attribute is scoped to a specific portlet in an application-wide context
115       * the attribute name must be include the portlet name as follows:
116       * BRIDGE_PACKAGE_PREFIX + context.getPortletName() + DEFAULT_VIEWID_MAP
117       */
118      public static final String DEFAULT_VIEWID_MAP = "defaultViewIdMap";
119    
120    
121      /** A PortletContext attribute that a portlet can set prior
122       * to calling the bridge's init() method to configure the bridge to preserve
123       * action parameters received by this portlet along with bridge's request scope so
124       * that they may be restored and acessed in subsequent renders.  If "true", the
125       * action parameters are preserved.  If "false", they are not preserved.  The bridge
126       * default is "false".<br>
127       *
128       * As this attribute is scoped to a specific portlet in an application-wide context
129       * the attribute name must be include the portlet name as follows:
130       * BRIDGE_PACKAGE_PREFIX + context.getPortletName() + preserveActionParams
131       */
132      public static final String PRESERVE_ACTION_PARAMS = "preserveActionParams";
133      
134      /** A PortletContext attribute that a portlet can set prior
135       * to calling the bridge's init() method to configure the bridge to use/call
136       * the associated eventHandler when processing an event. Value is an instance of
137       * <code>BridgeEventHandler</code>.
138       *
139       * As this attribute is scoped to a specific portlet in an application-wide context
140       * the attribute name must be include the portlet name as follows:
141       * BRIDGE_PACKAGE_PREFIX + context.getPortletName() + bridgeEventHandler
142       */
143      public static final String BRIDGE_EVENT_HANDLER = "bridgeEventHandler";
144      
145      /** A PortletContext attribute that a portlet can set prior
146       * to calling the bridge's init() method to configure the bridge to use/call
147       * the associated publicRenderParameterHandler.  This handler is used to
148       * process updates that result from public render parameter changes passed in 
149       * a request.  The bridge first pushs all the public render parameter values into the models and
150       * then calls this handler's processUpdates method.  The handler can then compute
151       * further model changes based on the changes. Value is an instance of
152       * <code>BridgePublicRenderParameterHandler</code>.
153       *
154       * As this attribute is scoped to a specific portlet in an application-wide context
155       * the attribute name must be include the portlet name as follows:
156       * BRIDGE_PACKAGE_PREFIX + context.getPortletName() + bridgeEventHandler
157       */
158      public static final String BRIDGE_PUBLIC_RENDER_PARAMETER_HANDLER = "bridgePublicRenderParameterHandler";
159      
160      
161      /** A PortletContext attribute that a portlet can set prior
162       * to calling the bridge's init() method to configure the bridge to default
163       * the renderKitId used for rendering this portlet to the named Id.  In Faces, the 
164       * default renderKitId is set in the faces-config.xml and is application wide.  In 1.2
165       * this can be overidden by a specially named request parameter. To allow differing portlets
166       * in the same app to use different default render kits, without having to add this 
167       * parameter, the portlet can set this attribute prior to the bridge init().  The bridge 
168       * will recognize this configuration value and on each request add the special faces
169       * request parameter to the request (if its not already present).
170       */
171      public static final String DEFAULT_RENDERKIT_ID = "defaultRenderKitId";
172     
173    
174      // The following are request attributes a portlet can set to control the request
175      // processing of the bridge.  
176    
177      /** PortletRequest attribute that a portlet may set prior
178       * to calling the bridge's doFacesRequest() method.  The value of this
179       * attribute is a <code>String</code> representing the Faces viewId the
180       * bridge is to target for this request.  Used by a portlet to specifically 
181       * control a request's view target in situations such as navigating from
182       * a nonFaces view to a specific Faces view (other than the default).<p>
183       * Generally, the use of this attribute is mutually exclusive with the use
184       * of VIEW_PATH.  If both have been set in a given request, the bridge gives
185       * precedence to VIEW_ID.
186       */
187      public static final String VIEW_ID = BRIDGE_PACKAGE_PREFIX + "viewId";
188    
189      /** PortletRequest attribute that a portlet may set prior
190       * to calling the bridge's doFacesRequest() method.  The value of this
191       * attribute is a <code>String</code> containing a <code>ContextPath</code>
192       * relative path in which the Faces viewId is encoded.  Like VIEW_ID, this
193       * attribute provides a means for a portlet to explicitly control the Faces
194       * target for a specific request.  It is used in situations such as navigating from
195       * a nonFaces view to a specific Faces view (other than the default).<p>
196       * Generally, the use of this attribute is mutually exclusive with the use
197       * of VIEW_PATH.  If both have been set in a given request, the bridge gives
198       * precedence to VIEW_ID.
199       */
200      public static final String VIEW_PATH = BRIDGE_PACKAGE_PREFIX + "viewPath";
201    
202      // Names for special QueryString parameters names the Bridge recognizes in
203      // encodeActionURL as signifying to change the corresponding portlet values
204      // in the resulting URL
205    
206      /**
207       * Special token parameter in the url passed to the bridge's ExternalContext.encodeActionURL()
208       * that it recognizes as an indication that this action should encode a PortletMode
209       * change to the one indicated by the parameter's value.
210       */
211      public static final String PORTLET_MODE_PARAMETER = BRIDGE_PACKAGE_PREFIX + "PortletMode";
212    
213      /**
214       * Special token parameter in the url passed to the bridge's ExternalContext.encodeActionURL()
215       * that it recognizes as an indication that this action should encode a WindowState change to
216       * the one indicated by the parameter's value.
217       */
218      public static final String PORTLET_WINDOWSTATE_PARAMETER = BRIDGE_PACKAGE_PREFIX + "WindowState";
219    
220      /**
221       * Special token parameter in the url passed to the bridge's ExternalContext.encodeActionURL()
222       * that it recognizes as an indication that this action should encode a security level change to
223       * the one indicated by the parameter's value.
224       */
225      public static final String PORTLET_SECURE_PARAMETER = BRIDGE_PACKAGE_PREFIX + "Secure";
226    
227      /**
228       * Special token parameter in the url passed to the bridge's ExternalContext.encodeActionURL()
229       * that it recognizes as an indication that this action should be treated as a direct link
230       * and hence shouldn't be encoded as a Portlet action.  Rather encodeActionURL merely returns
231       * this url unchanged.
232       */
233      public static final String DIRECT_LINK = BRIDGE_PACKAGE_PREFIX + "DirectLink";
234      
235      /**
236       * Special token parameter in the url passed to the bridge's ExternalContext.encodeResourceURL()
237       * that it recognizes as an indication that this resource should be handled in protocol.
238       */
239      public static final String IN_PROTOCOL_RESOURCE_LINK = 
240        BRIDGE_PACKAGE_PREFIX + "InProtocolResourceLink";
241    
242      /**
243       * Special token parameter in the url passed to the bridge's ExternalContext.encodeResourceURL()
244       * that it recognizes as an indication that an URL refering back to the page which
245       * contains this portlet should be encoded in the resource url. This reference is
246       * encoded as the value of a query string parameter whose name is the value of this back
247       * link token parameter.
248       */
249      public static final String BACK_LINK = BRIDGE_PACKAGE_PREFIX + "BackLink";
250    
251      /**
252       * Special token parameter in the url passed to the bridge's ExternalContext.encodeResourceURL()
253       * that it recognizes as an indication that this url refers to Faces view (navigation) and
254       * hence should be encoded as an portlet ActionURL rather then a portlet resource url.  This token
255       * is intended for use in urls signifying a view navigation using components such as
256       * <code>h:outputLink</code>. 
257       */
258      public static final String VIEW_LINK = BRIDGE_PACKAGE_PREFIX + "ViewLink";
259    
260    
261      // Request attributes set by the bridge that can be used by Faces extensions
262      // and/or applications to properly run in a portlet environment. 
263    
264      /**
265       * A PortletRequest attribute set by the bridge when processing a Faces request
266       * that signals this request is a Faces postback.  Its provided as
267       * an alternative signal to the common reliance on the view state parameter as
268       * an indicator that this is a postback request.  Implementations needing this 
269       * information and not using the view state parameter indicator can check this 
270       * attribute when running in a portlet environment.
271       */
272      public static final String IS_POSTBACK_ATTRIBUTE = BRIDGE_PACKAGE_PREFIX + "isPostback";
273    
274      /** A PortletRequest attribute set by the bridge in its
275       * <code>ViewHandler.renderView</code> prior to dispatching the request
276       * to the view (jsp)to indicating a filter should
277       * put the AFTER_VIEW_CONTENT in a buffer on the request for it to process after
278       * rendering the view components.  In conjunction with the filter this enables
279       * preserving rendering order of native JSP rendering and Faces rendering in a jsp.
280       */
281      public static final String RENDER_CONTENT_AFTER_VIEW = 
282        BRIDGE_PACKAGE_PREFIX + "RenderContentAfterView";
283    
284      /** A PortletRequest attribute set by an include filter in recognition of the
285       * RenderContentAfterView bridge attribute.  Its value is either char[] or byte[]
286       * holding the AFTER_VIEW_CONTENT generated while rendering this jsp.
287       * In conjunction with the bridge this enables
288       * preserving rendering order of native JSP rendering and Faces rendering in a jsp.
289       */
290      public static final String AFTER_VIEW_CONTENT = BRIDGE_PACKAGE_PREFIX + "AfterViewContent";
291    
292      /** PortletRequest attribute set by the bridge prior to creating/acquiring a
293       * <code>FacesContext</code>.  Its value indicates which portlet phase this 
294       * Faces is executing in.  It can be used by Faces subsystems not only to determine
295       * the portlet exectution phase but if present (not null) as an indication the request
296       * is being processed in a portlet container.
297       */
298      public static final String PORTLET_LIFECYCLE_PHASE = BRIDGE_PACKAGE_PREFIX + "phase";
299    
300      /** PortletSession attribute set by the bridge to hold the last viewId accessed in a given mode.  
301       * The attribute (key) is composed of this name + the mode name.  I.e. 
302       * javax.portlet.faces.viewIdHistory.view.  There is one attribute per supported portlet
303       * mode.  The attributes are always set even if the user session has never entered the
304       * mode.  Its initial setting/value is determined by the default viewId configured
305       * for the mode.  Attribute is used by developers to reference/return to the last view in
306       * a given Mode from another mode.
307       */
308      public static final String VIEWID_HISTORY = BRIDGE_PACKAGE_PREFIX + "viewIdHistory";
309    
310    
311      /** Name of PortletResponse property set by the bridge when it recognizes that the 
312       * view has been rendered using a <code>NamingContainer</code> that ensures all
313       * generated ids are namespaced using the consumer provided unique portlet id.
314       */
315      public static final String PORTLET_NAMESPACED_RESPONSE_PROPERTY = 
316        "X-JAVAX-PORTLET-FACES-NAMESPACED-RESPONSE";
317    
318      /** Name of the render parameter set by the bridge when it encodes a navigation
319       *  link to a nonFaces target. Though the bridge recognizes nonFaces targets when
320       *  it encodes a navigational link, it does not handle the subsequent request. 
321       *  It only handles requests for Faces targets.  It is the portlet's responsibility
322       *  to detect and handle these requests.  When the nonFaces target is a path based
323       *  resource (such as a jsp or servlet), the <code>ContextPath</code> relative path
324       *  of the resource is written as the value of this render parameter.  For convenience,
325       *  the GenericFacesPortlet recognizes this render parameter in received requests
326       *  and uses the <code>PortletRequestDispatcher</code> to dispatch to the encoded
327       *  path instead of calling the bridge to execute the request.
328       */
329      public static final String NONFACES_TARGET_PATH_PARAMETER = "_jsfBridgeNonFacesView";
330    
331      /** Name of a request parameter (generally) encoded in a link from a nonFaces
332       *  view response.  It acts as a marker to the portlet that the nonFaces view
333       *  intends to navigate to the Faces view expressed in the value of this parameter.
334       *  It differs from the <code>FACES_VIEW_PATH_PARAMETER</code> in that its value
335       *  is the actual Faces viewId of the target while the formaer is a
336       *  <code>ContextPath</code> relative path containing the viewId.<p>
337       *  Portlets receiving such a parameter should set the the corresponding request
338       *  attribute <code>javax.portlet.faces.viewId</code> before calling the bridge
339       *  to handle the request.
340       */
341      public static final String FACES_VIEW_ID_PARAMETER = "_jsfBridgeViewId";
342    
343      /** Name of a request parameter (generally) encoded in a link from a nonFaces
344       *  view response.  It acts as a marker to the portlet that the nonFaces view
345       *  intends to navigate to the Faces view expressed in the value of this parameter.
346       *  It differs from the <code>FACES_VIEW_ID_PARAMETER</code> in that its value
347       *  is a <code>ContextPath</code> relative path containing the viewId while the former
348       *  is the viewId itself.<p>
349       *  Portlets receiving such a parameter should set the the corresponding request
350       *  attribute <code>javax.portlet.faces.viewPath</code> before calling the bridge
351       *  to handle the request.
352       */
353      public static final String FACES_VIEW_PATH_PARAMETER = "_jsfBridgeViewPath";
354    
355    
356      
357      /** Special value recognized during <code>encodeActionURL</code> of a portlet: url containing either
358       * the <code>_jsfBridgeViewId</code> or <code>_jsfBridgeViewPath</code> parameter. 
359       * <code>encodeActionURL</code> recognizes this value as indicating it needs to generate and
360       * encode an URL to the current JSF including its current state.  I.e. It not only
361       * encodes the link reference but also the existing render parameters so they can be carried forward
362       * to reestablish the state.
363       */
364      public static final String FACES_USE_CURRENT_VIEW_PARAMETER = "_jsfBridgeCurrentView";
365      
366      /** Enumeration whose values describe the current portlet phase the bridge
367       * is executing Faces within.
368       */
369      public static enum PortletPhase
370      {
371        ACTION_PHASE,
372        RENDER_PHASE,
373        EVENT_PHASE,
374        RESOURCE_PHASE,
375        ;
376      }
377    
378      /** Enumeration whose values describe the render policy used by the bridge
379       * to render portlets in this application.  A policy of DEFAULT indicates
380       * the bridge will first delegate rendering and if this results in an
381       * exception being thrown will render the itself.  A policy of ALWAYS_DELEGATE
382       * indicates the bridge will always delegate rendering, never rendering itself.
383       * A policy of NEVER_DELEGATE indicates the bridge will always render itself without
384       * delegating.
385       */
386      public static enum BridgeRenderPolicy
387      {
388        DEFAULT,
389        ALWAYS_DELEGATE,
390        NEVER_DELEGATE,
391        ;
392      }
393    
394      /**
395       * Called by the portlet. It indicates that the bridge is being placed into service.
396       * <p>
397       * The portlet calls the <code>init</code> method exactly once before invoking other lifecycle
398       * methods. Usually, done immediately after instantiating the bridge. The <code>init</code>
399       * method must complete successfully before the bridge can receive any requests.
400       * <p>
401       * The portlet cannot place the bridge into service if the <code>init</code> method Throws a
402       * <code>BridgeException</code>.
403       * <p>
404       * Initialization context is passed to bridge via <code>PortletContext</code> attributes. The
405       * following attributes are defined:
406       * <ul>
407       * <li><code>javax.portlet.faces.encodeRedirectURL</code>: instructs the bridge to call
408       * <code>ExternalContext.encodeActionURL()</code> before processing the redirect request. This
409       * exists because some (newer) versions of JSF 1.2 call <code>encodeActionURL</code> before
410       * calling <code>redirect</code> while others do not. This flag adjusts the behavior of the
411       * bridge in accordance with the JSF 1.2 implementation it runs with.
412       * <li><code>javax.portlet.faces.numManagedActionScopes</code>: defines the maximum number of
413       * actionScopes this bridge preserves at any given time. Value is an integer. ActionScopes are
414       * managed on a per Bridge class portlet context wide basis. As a typical portlet application uses
415       * the same bridge implementation for all its Faces based portlets, this means that all
416       * actionScopes are managed in a single bucket.<br>
417       * For convenience this interface defines the <code>NUM_MANAGED_ACTIONSCOPES</code> constant.
418       * <li><code>javax.faces.lifecycleID</code>: defines the Faces <code>Lifecycle</code> id
419       * that bridge uses when acquiring the <code>Faces.Lifecycle</code> via which it executes the
420       * request. As a context wide attribute, all bridge instances in this portlet application will use
421       * this lifecyle.
422       * <li><code>javax.portlet.faces.[portlet name].preserveActionParams</code>: instructs the
423       * bridge to preserve action parameters in the action scope and represent them in subsequent
424       * renders. Should be used only when binding to a Faces implementation that relies on accessing
425       * such parameters during its render phase. As this is a portlet/bridge instance specific
426       * attribute, the <code>PortletContext</code>attribute name is qualified by the portlet
427       * instance name. This allows different portlets within the same portlet application to have
428       * different settings.<br>
429       * For convenience this interfaces defines a number of constants that simplifies constructing
430       * and/or recognizing this name.
431       * </ul>
432       * 
433       * @param config
434       *          a <code>PortletConfig</code> object containing the portlet's configuration and
435       *          initialization parameters
436       * @exception BridgeException
437       *              if an exception has occurred that interferes with the bridge's normal operation.
438       *              For example, if the bridge is already initialized.
439       * @exception UnavailableException
440       *              if the portlet cannot perform the initialization at this time.
441       */
442      public void init(PortletConfig config) throws BridgeException;
443    
444      /**
445       * Called by the portlet when it wants the bridge to process an action request.
446       * 
447       * @param request
448       *          the request object.
449       * @param response
450       *          the response object.
451       * @throws BridgeDefaultViewNotSpecifiedException
452       *           thrown if the request indicates to the Bridge that is should use the default ViewId
453       *           and the portlet hasn't supplied one.
454       * @throws BridgeUninitializedException
455       *           thrown if the bridge is not initialized.          
456       * @throws BridgeException
457       *           all other internal exceptions are converted to a BridgeException.
458       */
459      public void doFacesRequest(ActionRequest request, 
460                                 ActionResponse response) throws BridgeDefaultViewNotSpecifiedException, 
461                                                                 BridgeUninitializedException, 
462                                                                 BridgeException;
463      
464      /**
465       * Called by the portlet when it wants the bridge to process an event request.
466       * 
467       * @param request
468       *          the request object.
469       * @param response
470       *          the response object.
471       * @throws BridgeUninitializedException
472       *           thrown if the bridge is not initialized.      
473       * @throws BridgeException
474       *           all other internal exceptions are converted to a BridgeException.
475       */
476      public void doFacesRequest(EventRequest request, 
477                                 EventResponse response) throws BridgeUninitializedException, 
478                                                                   BridgeException;
479    
480    
481      /**
482       * Called by the portlet when it wants the bridge to process a render request.
483       * 
484       * @param request
485       *          the request object.
486       * @param response
487       *          the response object.
488       * @throws BridgeDefaultViewNotSpecifiedException
489       *           thrown if the request indicates to the Bridge that is should use the default ViewId
490       *           and the portlet hasn't supplied one.
491       * @throws BridgeUninitializedException
492       *           thrown if the bridge is not initialized.      
493       * @throws BridgeException
494       *           all other internal exceptions are converted to a BridgeException.
495       */
496      public void doFacesRequest(RenderRequest request, 
497                                 RenderResponse response) throws BridgeDefaultViewNotSpecifiedException, 
498                                                                 BridgeUninitializedException, 
499                                                                 BridgeException;
500    
501      /**
502       * Called by the portlet when it wants the bridge to process an in-protocol
503       * resource request.
504       * 
505       * @param request
506       *          the request object.
507       * @param response
508       *          the response object.
509       * @throws BridgeUninitializedException
510       *           thrown if the bridge is not initialized.      
511       * @throws BridgeException
512       *           all other internal exceptions are converted to a BridgeException.
513       */
514      public void doFacesRequest(ResourceRequest request, 
515                                 ResourceResponse response) throws BridgeUninitializedException, 
516                                                                   BridgeException;
517    
518      /**
519       * Called by the portlet to take the bridge out of service. Once out of service, the bridge must
520       * be reinitialized before processing any further requests.
521       */
522      public void destroy();
523    
524    }