}
};
getStateHolder().addWindowState(stateId, windowState);
}
PortletBridgeContext bridgeContext = createBridgeContext(request,
windowState);
bridgeContext.setStateId(stateId);
FacesContext facesContext = getFacesContext(request, wrappedResponse);
try {
windowState.restoreRequest(facesContext, true);
// If we're using RichFaces, setup proper parameters for this render
// request
if (RICHFACES_ENABLED) {
setupAjaxParams(facesContext, stateId.toString(), namespace);
}
// set portletbridge title if its set.
ResourceBundle bundle = portletConfig.getResourceBundle(request
.getLocale());
if (bundle != null) {
String title = null;
try {
title = bundle.getString("javax.portlet.title");
wrappedResponse.setTitle(title);
} catch (Exception e) {
// Ignore MissingResourceException
}
}
try {
renderResponse(facesContext, windowState);
// TODO - detect redirect case. Reset response, clear request
// variables as far as Seam state.
// Perform new render phase with a new ViewId.
String redirectViewId = bridgeContext.getRedirectViewId();
if (null != redirectViewId) {
windowState.reset();
windowState.setViewId(redirectViewId);
Map<String, String[]> redirectParams = bridgeContext
.getRedirectRequestParameters();
// release old FacesContext.
facesContext.release();
// Reset attributes to initial state
Set<String> initialAttributes = bridgeContext
.getInitialRequestAttributeNames();
List<String> currentAttributes = Collections.list(request
.getAttributeNames());
currentAttributes.removeAll(initialAttributes);
for (Object newAttribute : currentAttributes) {