/** * Gets a global URI for a resource if it's registered with this handler. * * @param connector * the connector for which the uri should be generated. * @param resource * the resource for which the uri should be generated. * @return an URI string, or <code>null</code> if the resource is not * registered. */ public String getUri(ClientConnector connector, ConnectorResource resource) { // app://APP/global/[ui]/[type]/[id] String uri = legacyResourceKeys.get(resource); if (uri != null && !uri.isEmpty()) { return ApplicationConstants.APP_PROTOCOL_PREFIX + ApplicationConstants.APP_PATH + '/' + RESOURCE_REQUEST_PATH + connector.getUI().getUIId() + '/' + uri; } else { return null; } }
private static String getConnectorResourceBase(String filename, ClientConnector connector) { String uri = ApplicationConstants.APP_PROTOCOL_PREFIX + ApplicationConstants.APP_PATH + '/' + ConnectorResource.CONNECTOR_PATH + '/' + connector.getUI().getUIId() + '/' + connector.getConnectorId() + '/' + encodeFileName(filename); return uri; }
@Override public void addAttribute(String name, Resource value) throws PaintException { if (value == null) { throw new NullPointerException(); } ClientConnector ownerConnector = openPaintables.peek(); ownerConnector.getUI().getSession().getGlobalResourceHandler(true) .register(value, ownerConnector); ResourceReference reference = ResourceReference.create(value, ownerConnector, name); addAttribute(name, reference.getURL()); }
ConnectorResource connectorResource = (ConnectorResource) resource; GlobalResourceHandler globalResourceHandler = connector.getUI() .getSession().getGlobalResourceHandler(false); if (globalResourceHandler != null) {
ClientConnector connector = iterator.next(); assert connector != null; if (connector.getUI() != uI) {
/** * @deprecated As of 7.1. See #11411. */ @Deprecated public String getStreamVariableTargetUrl(ClientConnector owner, String name, StreamVariable value) { /* * We will use the same APP/* URI space as ApplicationResources but * prefix url with UPLOAD * * e.g. APP/UPLOAD/[UIID]/[PID]/[NAME]/[SECKEY] * * SECKEY is created on each paint to make URL's unpredictable (to * prevent CSRF attacks). * * NAME and PID from URI forms a key to fetch StreamVariable when * handling post */ String paintableId = owner.getConnectorId(); UI ui = owner.getUI(); int uiId = ui.getUIId(); String key = uiId + "/" + paintableId + "/" + name; ConnectorTracker connectorTracker = ui.getConnectorTracker(); connectorTracker.addStreamVariable(paintableId, name, value); String seckey = connectorTracker.getSeckey(value); return ApplicationConstants.APP_PROTOCOL_PREFIX + ServletPortletHelper.UPLOAD_URL_PREFIX + key + "/" + seckey; }
/** * @deprecated As of 7.1. See #11411. */ @Deprecated public static JsonObject encodeState(ClientConnector connector, SharedState state) { UI uI = connector.getUI(); ConnectorTracker connectorTracker = uI.getConnectorTracker(); Class<? extends SharedState> stateType = connector.getStateType(); JsonValue diffState = connectorTracker.getDiffState(connector); if (diffState == null) { // Use an empty state object as reference for full // repaints diffState = REFERENCE_DIFF_STATES.get(stateType); if (diffState == null) { diffState = createReferenceDiffStateState(stateType); REFERENCE_DIFF_STATES.put(stateType, diffState); } } EncodeResult encodeResult = JsonCodec.encode(state, diffState, stateType, uI.getConnectorTracker()); connectorTracker.setDiffState(connector, (JsonObject) encodeResult.getEncodedValue()); return (JsonObject) encodeResult.getDiff(); }
UI ui = connector.getUI(); if (ui != null) { errorHandler = findErrorHandler(ui.getSession());
UI ui = connector.getUI(); boolean forgetVariable = streamToReceiver(session, inputStream, streamVariable, filename, mimeType, contentLength);