Example #1
0
  private void renderState(FacesContext context) throws IOException {

    if (!context.getViewRoot().isTransient()) {
      // Get the view state and write it to the response..
      PartialViewContext pvc = context.getPartialViewContext();
      PartialResponseWriter writer = pvc.getPartialResponseWriter();
      String viewStateId = Util.getViewStateId(context);

      writer.startUpdate(viewStateId);
      String state = context.getApplication().getStateManager().getViewState(context);
      writer.write(state);
      writer.endUpdate();

      ClientWindow window = context.getExternalContext().getClientWindow();
      if (null != window) {
        String windowIdId = Util.getWindowIdId(context);
        writer.startUpdate(windowIdId);
        writer.write(window.getId());
        writer.endUpdate();
      }
    }
  }
Example #2
0
 @Override
 public void decode(FacesContext context) {
   Map<String, String> requestParamMap = context.getExternalContext().getRequestParameterMap();
   if (ClientWindow.isClientWindowRenderModeEnabled(context)) {
     id = requestParamMap.get(ResponseStateManager.CLIENT_WINDOW_URL_PARAM);
   }
   // The hidden field always takes precedence, if present.
   if (requestParamMap.containsKey(ResponseStateManager.CLIENT_WINDOW_PARAM)) {
     id = requestParamMap.get(ResponseStateManager.CLIENT_WINDOW_PARAM);
   }
   if (null == id) {
     id = calculateClientWindow(context);
   }
 }