Merge branch 'devel' into dbeaver/pro#9733-Remove-X-prefix-HTTP-headers

This commit is contained in:
kseniaguzeeva
2026-08-05 09:26:26 +03:00
committed by GitHub
6 changed files with 61 additions and 53 deletions
@@ -42,63 +42,58 @@ import java.util.*;
* Web connection info
*/
public class WebPropertyInfo {
private WebSession session;
private DBPPropertyDescriptor property;
private DBPPropertySource propertySource;
private boolean showProtected;
@NotNull
private final WebSession session;
@NotNull
private final DBPPropertyDescriptor property;
@Nullable
private final DBPPropertySource propertySource;
private Object[] validValues;
private String[] supportedConfigurationTypes = new String[0];
private Object defaultValue;
public WebPropertyInfo(WebSession session, DBPPropertyDescriptor property, DBPPropertySource propertySource) {
public WebPropertyInfo(
@NotNull WebSession session,
@NotNull DBPPropertyDescriptor property,
@Nullable DBPPropertySource propertySource
) {
this.session = session;
this.property = property;
this.propertySource = propertySource;
}
public WebPropertyInfo(WebSession session, DBPPropertyDescriptor property) {
this.session = session;
this.property = property;
}
public boolean isShowProtected() {
return showProtected;
}
public void setShowProtected(boolean showProtected) {
this.showProtected = showProtected;
public WebPropertyInfo(@NotNull WebSession session, @NotNull DBPPropertyDescriptor property) {
this(session, property, null);
}
///////////////////////////////////
// General properties
///////////////////////////////////
@NotNull
@Property
public String getId() {
return CommonUtils.toString(property.getId());
}
@NotNull
@Property
public String getDisplayName() {
if (property instanceof DBPNamedObjectLocalized) {
return ((DBPNamedObjectLocalized) property).getLocalizedName(session.getLocale());
if (property instanceof DBPNamedObjectLocalized localized) {
return localized.getLocalizedName(session.getLocale());
} else {
return property.getDisplayName();
}
}
@Nullable
@Property
public String getDescription() {
if (property instanceof DBPObjectWithDescriptionLocalized) {
return ((DBPObjectWithDescriptionLocalized) property).getLocalizedDescription(session.getLocale());
if (property instanceof DBPObjectWithDescriptionLocalized localized) {
return localized.getLocalizedDescription(session.getLocale());
} else {
return property.getDescription();
}
}
@Nullable
@Property
public String getHint() {
return property.getHint();
@@ -109,38 +104,47 @@ public class WebPropertyInfo {
return property instanceof ObjectPropertyDescriptor ? ((ObjectPropertyDescriptor) property).getOrderNumber() : -1;
}
@Nullable
@Property
public String getCategory() {
return property.getCategory();
}
@Nullable
@Property
public String getType() {
return getDataType();
}
@Nullable
@Property
public String getDataType() {
Class<?> dataType = property.getDataType();
return dataType == null ? null : dataType.getSimpleName();
}
@NotNull
@Property
public PropertyLength getLength() {
return property.getLength();
}
@Nullable
@Property
public Object getDefaultValue() throws DBException {
var defaultValue = property.getDefaultValue() == null ? this.defaultValue : property.getDefaultValue();
return defaultValue == null ? getValue() : defaultValue;
Object defaultValue = property.getDefaultValue();
if (property instanceof ObjectPropertyDescriptor && defaultValue == null) {
return getValue();
}
return defaultValue;
}
@Nullable
@Property
public Object getValue() throws DBException {
Object value = propertySource == null ? null : propertySource.getPropertyValue(session.getProgressMonitor(), property.getId());
if (property instanceof ObjectPropertyDescriptor opd &&
(!showProtected && opd.isPassword() || opd.isHidden())
(opd.isPassword() || opd.isHidden())
) {
return maskValue(value);
} else if (property instanceof PropertyDescriptor pd) {
@@ -152,6 +156,7 @@ public class WebPropertyInfo {
return value == null ? null : makePropertyValue(value);
}
@Nullable
@Property
public Object[] getValidValues() {
if (property instanceof IPropertyValueListProvider) {
@@ -164,17 +169,18 @@ public class WebPropertyInfo {
}
return validValues;
}
return validValues;
}
return validValues;
return null;
}
@NotNull
@Property
public String[] getFeatures() {
String[] features = property.getFeatures();
return features == null ? new String[0] : features;
}
@NotNull
@Property
public String[] getSupportedConfigurationTypes() {
if (property instanceof ProviderPropertyDescriptor) {
@@ -182,7 +188,7 @@ public class WebPropertyInfo {
.map(DBPDriverConfigurationType::toString)
.toArray(String[]::new);
}
return supportedConfigurationTypes;
return new String[0];
}
@Property
@@ -203,12 +209,14 @@ public class WebPropertyInfo {
return false;
}
@NotNull
@Override
public String toString() {
return CommonUtils.toString(property.getId());
}
private Object makePropertyValue(Object value) {
@Nullable
private Object makePropertyValue(@Nullable Object value) {
if (value == null) {
return null;
// } else if (value instanceof DBSObject) {
@@ -290,21 +298,6 @@ public class WebPropertyInfo {
return conditions;
}
//TODO: delete after refactoring on front-end
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
//TODO: delete after refactoring on front-end
public void setValidValues(Object[] validValues) {
this.validValues = validValues;
}
//TODO: delete after refactoring on front-end
public void setSupportedConfigurationTypes(String[] supportedConfigurationTypes) {
this.supportedConfigurationTypes = supportedConfigurationTypes;
}
public record Condition(@NotNull String expression, @NotNull Type conditionType) {
public enum Type {
HIDE,
@@ -168,7 +168,7 @@ public class CBEventsLongPollingServlet extends HttpServlet {
log.debug("LP request rejected: access token expired");
sendError(resp, HttpConstants.CODE_TOKEN_EXPIRED, e.getMessage());
} catch (SecurityException e) {
log.warn("LP session resolve failed", e);
log.debug("LP request rejected: " + e.getMessage());
sendError(resp, HttpConstants.CODE_UNAUTHORIZED, e.getMessage());
}
return null;
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2026 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,6 +47,11 @@ public class CBEventsWebSocket extends CBAbstractWebSocket implements CBWebSessi
} else {
this.webSession = (BaseWebSession) session.getUserProperties()
.get(CBWebSocketServerConfigurator.PROP_WEB_SESSION);
if (this.webSession == null) {
log.debug("No web session for websocket connection, closing");
close();
return;
}
this.webSession.addEventHandler(this);
handleEvent(new WSSocketConnectedEvent(webSession.getApplication().getApplicationRunId()));
log.debug("EventWebSocket connected to the " + webSession.getSessionId() + " session");
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2025 DBeaver Corp and others
* Copyright (C) 2010-2026 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -88,7 +88,8 @@ public class CBWebSocketServerConfigurator extends ServerEndpointConfig.Configur
throw new RuntimeException(e.getMessage(), e);
}
if (sec.getUserProperties().get(PROP_WEB_SESSION) == null) {
throw new RuntimeException("No web session found for websocket request");
// no throwing exception here. will be handled in onOpen
log.debug("No web session found for websocket request, connection will be closed on open");
}
}
@@ -11,4 +11,7 @@ fragment UserConnectionNetworkHandlerProperties on ObjectPropertyInfo {
length
features
required
}
conditions {
...Condition
}
}
@@ -210,15 +210,21 @@ export const DataGridTable = observer<IDataPresentationProps>(function DataGridT
},
unpinColumns(keys) {
tableData.view.unpinColumns(keys.map(key => key.column));
// re-select the focused cell so the highlight follows the column to its new position after reordering
handlers.focusCell(selectionAction.getFocusedElement(), false, true);
},
pinColumns(keys) {
tableData.view.pinColumns(keys.map(key => key.column));
// re-select the focused cell so the highlight follows the column to its new position after reordering
handlers.focusCell(selectionAction.getFocusedElement(), false, true);
},
isColumnPinned(key) {
return tableData.view.isColumnPinned(key.column);
},
unpinAllColumns() {
tableData.view.unpinAllColumns();
// re-select the focused cell so the highlight follows the column to its new position after reordering
handlers.focusCell(selectionAction.getFocusedElement(), false, true);
},
hasPinnedColumns() {
return tableData.view.hasPinnedColumns();