刷新树
@param request HttpServletRequest
@param control TreeControl
@throws Exception
486298
private void refreshTree(HttpServletRequest request, TreeControl control) throws Exception {
    String key = request.getParameter("key");
    if (key != null) {
      ViewNode node = control.findNode(key);
      if (node != null) {
        Debug.logVerbose("[JdonFramework]Found Node: " + key, module);
        if (!node.isExpanded()) {
          //原来是叠合的，现在需要展开
          //需要查询数据库，将该节点下的子节点查询获取
          node.clearChildren();
          fetchChildern(request, node);
        }
        node.setExpanded(!node.isExpanded());
      } else {
        Debug.logVerbose("[JdonFramework]Node is null : " + key);
      }
    }
    // Handle a select item event
    String select = request.getParameter("select");
    if (select != null) {
        control.selectNode(select);
    }

  }
1041078
protected static void setSelected(TreeElement node, String selected, ServletRequest request)
    {
        assert(node != null) : "parameter 'node' must not be null";
        assert(selected != null) : "parameter 'selected' must not be null";
        assert(request != null) : "parameter 'requested' must not be null";

        if (node.getName().equals(selected)) {
            node.onSelect(request);
            node.setSelected(true);
        }
        else {
            if (node.isSelected()) {
                node.onSelect(request);
                node.setSelected(false);
            }
        }

        TreeElement children[] = node.getChildren();
        assert(children != null);
        for (int i = 0; i < children.length; i++) {
            setSelected(children[i], selected, request);
        }
    }
158921
private void handleExpansionRequest(final Request request) {
		String[] paramValue = request.getParameterValues(getId() + ".expanded");

		if (paramValue == null) {
			paramValue = new String[0];
		}

		Map<List<Integer>, Object> pageRowKeys = getCurrentRowIndexAndKeys();

		String[] expandedRows = removeEmptyStrings(paramValue);
		Set<?> oldExpansions = getExpandedRows();
		Set<Object> newExpansions;

		TableModel model = getTableModel();

		if (model.getRowCount() == 0) {
			newExpansions = new HashSet<>();
			expandedRows = new String[0];
		} else if (getPaginationMode() == PaginationMode.NONE || getPaginationMode() == PaginationMode.CLIENT
				|| oldExpansions == null || !isPaginated()) {
			newExpansions = new HashSet<>(expandedRows.length);
		} else {
			// row expansions only apply to the current page
			newExpansions = (Set<Object>) new HashSet<>(oldExpansions);
			newExpansions.removeAll(pageRowKeys.values());
		}

		for (String expandedRow : expandedRows) {
			List<Integer> rowIndex = TableUtil.rowIndexStringToList(expandedRow);
			Object key = pageRowKeys.get(rowIndex);
			if (key != null) {
				newExpansions.add(key);
			}
		}

		setExpandedRows(newExpansions);
	}
560976
public static void applyRegisteredControls(final Request request, final boolean useRequestValues) {

		Set<String> controls = getRegisteredSubordinateControls();
		if (controls == null) {
			return;
		}

		// Process Controls
		for (String controlId : controls) {
			// Find the Component for this ID
			ComponentWithContext controlWithContext = WebUtilities.getComponentById(controlId,
					true);
			if (controlWithContext == null) {
				LOG.warn(
						"Subordinate control for id " + controlId + " is no longer in the tree.");
				continue;
			}

			if (!(controlWithContext.getComponent() instanceof WSubordinateControl)) {
				LOG.warn("Component for id " + controlId + " is not a subordinate control.");
				continue;
			}

			WSubordinateControl control = (WSubordinateControl) controlWithContext.getComponent();
			UIContext uic = controlWithContext.getContext();

			UIContextHolder.pushContext(uic);

			try {
				if (useRequestValues) {
					control.applyTheControls(request);
				} else {
					control.applyTheControls();
				}
			} finally {
				UIContextHolder.popContext();
			}
		}
	}
351890
private static void setErrorAttributes(CmsObject cms, Throwable throwable, HttpServletRequest request) {

        String errorUri = CmsFlexController.getThrowableResourceUri(request);
        if (errorUri == null) {
            errorUri = cms.getRequestContext().getUri();
        }

        // try to get the exception root cause
        Throwable cause = CmsFlexController.getThrowable(request);
        if (cause == null) {
            cause = throwable;
        }

        request.getSession().setAttribute(THROWABLE, cause);
        request.getSession().setAttribute(PATH, errorUri);
    }
841290
protected void receiveServerRequest(HttpMessage request) {
        BuilderSupport<HttpActionBuilder> action = builder -> {
            HttpServerActionBuilder.HttpServerReceiveActionBuilder receiveBuilder = builder.server(httpServer).receive();
            HttpServerRequestActionBuilder requestBuilder;

            if (request.getRequestMethod() == null || request.getRequestMethod().equals(HttpMethod.POST)) {
                requestBuilder = receiveBuilder.post().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.GET)) {
                requestBuilder = receiveBuilder.get().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.PUT)) {
                requestBuilder = receiveBuilder.put().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.DELETE)) {
                requestBuilder = receiveBuilder.delete().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.HEAD)) {
                requestBuilder = receiveBuilder.head().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.TRACE)) {
                requestBuilder = receiveBuilder.trace().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.PATCH)) {
                requestBuilder = receiveBuilder.patch().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.OPTIONS)) {
                requestBuilder = receiveBuilder.options().message(request);
            } else {
                requestBuilder = receiveBuilder.post().message(request);
            }

            for (Map.Entry<String, String> headerEntry : pathValidations.entrySet()) {
                requestBuilder.validate(headerEntry.getKey(), headerEntry.getValue());
            }
            pathValidations.clear();
        };

        runner.http(action);
    }
194979
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);
		if (!isInitialised()) {
			table.setTableModel(createTableModel());
			setInitialised(true);
		}
	}
898682
@Override
	public void handleRequest(final Request request) {
		// Check if this link was the AJAX Trigger
		AjaxOperation operation = AjaxHelper.getCurrentOperation();
		boolean pressed = (operation != null && getId().equals(operation.getTriggerId()));

		// Protect against client-side tampering of disabled/read-only fields.
		if (isDisabled() && pressed) {
			LOG.warn("A disabled link has been triggered. " + getText() + ". " + getId());
			return;
		}

		// If an action has been supplied then execute it, but only after
		// handle request has been performed on the entire component tree.
		final Action action = getAction();

		if (pressed && action != null) {
			final ActionEvent event = new ActionEvent(this, getActionCommand(), getActionObject());

			Runnable later = new Runnable() {
				@Override
				public void run() {
					action.execute(event);
				}
			};

			invokeLater(later);
		}
	}
215195
protected void sendClientRequest(HttpMessage request) {
        BuilderSupport<HttpActionBuilder> action = builder -> {
            HttpClientActionBuilder.HttpClientSendActionBuilder sendBuilder = builder.client(httpClient).send();
            HttpClientRequestActionBuilder requestBuilder;

            if (request.getRequestMethod() == null || request.getRequestMethod().equals(HttpMethod.POST)) {
                requestBuilder = sendBuilder.post().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.GET)) {
                requestBuilder = sendBuilder.get().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.PUT)) {
                requestBuilder = sendBuilder.put().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.DELETE)) {
                requestBuilder = sendBuilder.delete().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.HEAD)) {
                requestBuilder = sendBuilder.head().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.TRACE)) {
                requestBuilder = sendBuilder.trace().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.PATCH)) {
                requestBuilder = sendBuilder.patch().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.OPTIONS)) {
                requestBuilder = sendBuilder.options().message(request);
            } else {
                requestBuilder = sendBuilder.post().message(request);
            }

            if (StringUtils.hasText(url)) {
                requestBuilder.uri(url);
            }
        };

        runner.http(action);
    }
862951
private void handleShuffleState(final Request request) {

		String json = request.getParameter(SHUFFLE_REQUEST_KEY);
		if (Util.empty(json)) {
			return;
		}

		// New
		TreeItemIdNode newTree;
		try {
			newTree = TreeItemUtil.convertJsonToTree(json);
		} catch (Exception e) {
			LOG.warn("Could not parse JSON for shuffle tree items. " + e.getMessage());
			return;
		}

		// Current
		TreeItemIdNode currentTree = getCustomTree();

		boolean changed = !TreeItemUtil.isTreeSame(newTree, currentTree);

		if (changed) {
			setCustomTree(newTree);
			// Run the shuffle action (if set)
			final Action action = getShuffleAction();
			if (action != null) {
				final ActionEvent event = new ActionEvent(this, "shuffle");
				Runnable later = new Runnable() {
					@Override
					public void run() {
						action.execute(event);
					}
				};
				invokeLater(later);
			}
		}
	}
253191
public synchronized void create( HttpServletRequest request, HttpServletResponse response, ServletContext servletContext )
        throws Exception
    {
        reinitialize( request, response, servletContext );
        JavaControlUtils.initJavaControls( request, response, servletContext, this );
        onCreate();
    }
554080
public void handleRequest(String request) {
        if (messageListener != null) {
            log.debug("Received Http request");
            messageListener.onInboundMessage(new RawMessage(request), null);
        } else {
            if (log.isDebugEnabled()) {
                log.debug("Received Http request:" + NEWLINE + request);
            }
        }
    }
170978
protected void doHandleFileAjaxActionRequest(final Request request) {
		// Protect against client-side tampering of disabled components
		if (isDisabled()) {
			throw new SystemException("File widget is disabled.");
		}

		// Check for file id
		String fileId = request.getParameter(FILE_UPLOAD_ID_KEY);
		if (fileId == null) {
			throw new SystemException("No file id provided for ajax action.");
		}

		// Check valid file id
		FileWidgetUpload file = getFile(fileId);
		if (file == null) {
			throw new SystemException("Invalid file id [" + fileId + "].");
		}

		// Run the action
		final Action action = getFileAjaxAction();
		if (action == null) {
			throw new SystemException("No action set for file ajax action request.");
		}

		// Set the selected file id as the action object
		final ActionEvent event = new ActionEvent(this, "fileajax", fileId);
		Runnable later = new Runnable() {
			@Override
			public void run() {
				action.execute(event);
			}
		};

		invokeLater(later);
	}
786941
public void setImageRequest(ImageRequest request) {
    AbstractDraweeControllerBuilder controllerBuilder = mControllerBuilder;
    DraweeController controller =
        controllerBuilder.setImageRequest(request).setOldController(getController()).build();
    setController(controller);
  }
526495
private void handleExpansionRequest(final Request request) {
		String[] paramValue = request.getParameterValues(getId() + ".expanded");

		if (paramValue == null) {
			paramValue = new String[0];
		}

		String[] expandedRows = removeEmptyStrings(paramValue);

		List<Integer> oldExpansions = getExpandedRows();
		List<Integer> expansions;

		TableDataModel model = getDataModel();

		if (model.getRowCount() == 0) {
			setExpandedRows(new ArrayList<Integer>());
			return;
		} else if (getPaginationMode() == PaginationMode.NONE
				|| getPaginationMode() == PaginationMode.CLIENT
				|| oldExpansions == null) {
			expansions = new ArrayList<>(expandedRows.length);
		} else {
			// row expansions only apply to the current page
			expansions = new ArrayList<>(oldExpansions);

			int startRow = getCurrentPageStartRow();
			int endRow = getCurrentPageEndRow();
			expansions.removeAll(getRowIds(startRow, endRow));
		}

		for (String expandedRow : expandedRows) {
			try {
				expansions.add(Integer.parseInt(expandedRow));
			} catch (NumberFormatException e) {
				LOG.warn("Invalid row id for expansion: " + expandedRow);
			}
		}

		// For tree tables, we also have to tell the nodes to expand themselves
		if (model instanceof TreeTableDataModel) {
			TreeTableDataModel treeModel = (TreeTableDataModel) model;

			// We need the expanded indices sorted, as expanding/collapsing sections alters row indices
			Collections.sort(expansions);

			for (int row = 0; row < treeModel.getRowCount(); row++) {
				for (Iterator<TreeNode> i = treeModel.getNodeAtLine(row).depthFirst(); i.hasNext();) {
					TableTreeNode node = (TableTreeNode) i.next();
					node.setExpanded(false);
				}
			}

			for (int i = expansions.size() - 1; i >= 0; i--) {
				treeModel.getNodeAtLine(expansions.get(i)).setExpanded(true);
			}
		}

		setExpandedRows(expansions);
	}
922334
public void updateJspFromRequest(String servletPath, CmsFlexRequest request) {

        // assemble the RFS name of the requested jsp
        String jspUri = servletPath;
        String pathInfo = request.getPathInfo();
        if (pathInfo != null) {
            jspUri += pathInfo;
        }

        // check the file name
        if ((jspUri == null) || !jspUri.startsWith(m_jspWebAppRepository)) {
            // nothing to do, this kind of request are handled by the CmsJspLoader#service method
            return;
        }

        // remove prefixes
        jspUri = jspUri.substring(m_jspWebAppRepository.length());
        if (jspUri.startsWith(CmsFlexCache.REPOSITORY_ONLINE)) {
            jspUri = jspUri.substring(CmsFlexCache.REPOSITORY_ONLINE.length());
        } else if (jspUri.startsWith(CmsFlexCache.REPOSITORY_OFFLINE)) {
            jspUri = jspUri.substring(CmsFlexCache.REPOSITORY_OFFLINE.length());
        } else {
            // this is not an OpenCms jsp file
            return;
        }

        // read the resource from OpenCms
        CmsFlexController controller = CmsFlexController.getController(request);
        try {
            CmsResource includeResource;
            try {
                // first try to read the resource assuming no additional jsp extension was needed
                includeResource = readJspResource(controller, jspUri);
            } catch (CmsVfsResourceNotFoundException e) {
                // try removing the additional jsp extension
                if (jspUri.endsWith(JSP_EXTENSION)) {
                    jspUri = jspUri.substring(0, jspUri.length() - JSP_EXTENSION.length());
                }
                includeResource = readJspResource(controller, jspUri);
            }
            // make sure the jsp referenced file is generated
            updateJsp(includeResource, controller, new HashSet<String>(8));
        } catch (Exception e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug(e.getLocalizedMessage(), e);
            }
        }
    }
946345
@Override
	public void preparePaint(final Request request) {
		Headers headers = this.getUI().getHeaders();
		headers.reset();

		headers.setContentType(WebUtilities.CONTENT_TYPE_XML);

		super.preparePaint(request);
	}