diff options
90 files changed, 1112 insertions, 417 deletions
diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml index 820eb2cbce..cd1f0a75cc 100644 --- a/WebContent/WEB-INF/web.xml +++ b/WebContent/WEB-INF/web.xml @@ -61,7 +61,7 @@ <param-value>3601</param-value> </init-param> <init-param> - <param-name>closeIdleUIs</param-name> + <param-name>closeIdleSessions</param-name> <param-value>true</param-value> </init-param> <init-param> diff --git a/client/src/com/vaadin/client/ApplicationConfiguration.java b/client/src/com/vaadin/client/ApplicationConfiguration.java index 4159b38211..1f35c408ae 100644 --- a/client/src/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/com/vaadin/client/ApplicationConfiguration.java @@ -199,6 +199,7 @@ public class ApplicationConfiguration implements EntryPoint { private boolean standalone; private ErrorMessage communicationError; private ErrorMessage authorizationError; + private ErrorMessage sessionExpiredError; private int heartbeatInterval; private HashMap<Integer, String> unknownComponents; @@ -314,6 +315,10 @@ public class ApplicationConfiguration implements EntryPoint { return authorizationError; } + public ErrorMessage getSessionExpiredError() { + return sessionExpiredError; + } + /** * Reads the configuration values defined by the bootstrap javascript. */ @@ -353,6 +358,7 @@ public class ApplicationConfiguration implements EntryPoint { communicationError = jsoConfiguration.getConfigError("comErrMsg"); authorizationError = jsoConfiguration.getConfigError("authErrMsg"); + sessionExpiredError = jsoConfiguration.getConfigError("sessExpMsg"); // boostrap sets initPending to false if it has sent the browser details if (jsoConfiguration.getConfigBoolean("initPending") == Boolean.FALSE) { diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index 23906f0e02..48815a3d8d 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -84,7 +84,7 @@ import com.vaadin.client.ui.dd.VDragAndDropManager; import com.vaadin.client.ui.ui.UIConnector; import com.vaadin.client.ui.window.WindowConnector; import com.vaadin.shared.ApplicationConstants; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.Version; import com.vaadin.shared.communication.LegacyChangeVariablesInvocation; import com.vaadin.shared.communication.MethodInvocation; @@ -960,9 +960,7 @@ public class ApplicationConnection { */ protected void showCommunicationError(String details, int statusCode) { VConsole.error("Communication error: " + details); - ErrorMessage communicationError = configuration.getCommunicationError(); - showError(details, communicationError.getCaption(), - communicationError.getMessage(), communicationError.getUrl()); + showError(details, configuration.getCommunicationError()); } /** @@ -973,9 +971,31 @@ public class ApplicationConnection { */ protected void showAuthenticationError(String details) { VConsole.error("Authentication error: " + details); - ErrorMessage authorizationError = configuration.getAuthorizationError(); - showError(details, authorizationError.getCaption(), - authorizationError.getMessage(), authorizationError.getUrl()); + showError(details, configuration.getAuthorizationError()); + } + + /** + * Shows the session expiration notification. + * + * @param details + * Optional details for debugging. + */ + protected void showSessionExpiredError(String details) { + VConsole.error("Session expired: " + details); + showError(details, configuration.getSessionExpiredError()); + } + + /** + * Shows an error notification. + * + * @param details + * Optional details for debugging. + * @param message + * An ErrorMessage describing the error. + */ + protected void showError(String details, ErrorMessage message) { + showError(details, message.getCaption(), message.getMessage(), + message.getUrl()); } /** @@ -1002,9 +1022,11 @@ public class ApplicationConnection { if (html.length() > 0) { // Add error description - html.append("<br/><p><I style=\"font-size:0.7em\">"); - html.append(details); - html.append("</I></p>"); + if (details != null) { + html.append("<p><i style=\"font-size:0.7em\">"); + html.append(details); + html.append("</i></p>"); + } VNotification n = VNotification.createNotification(1000 * 60 * 45, uIConnector.getWidget()); @@ -1442,32 +1464,11 @@ public class ApplicationConnection { if (meta != null) { if (meta.containsKey("appError")) { ValueMap error = meta.getValueMap("appError"); - String html = ""; - if (error.containsKey("caption") - && error.getString("caption") != null) { - html += "<h1>" + error.getAsString("caption") - + "</h1>"; - } - if (error.containsKey("message") - && error.getString("message") != null) { - html += "<p>" + error.getAsString("message") - + "</p>"; - } - String url = null; - if (error.containsKey("url")) { - url = error.getString("url"); - } - if (html.length() != 0) { - /* 45 min */ - VNotification n = VNotification.createNotification( - 1000 * 60 * 45, uIConnector.getWidget()); - n.addEventListener(new NotificationRedirect(url)); - n.show(html, VNotification.CENTERED_TOP, - VNotification.STYLE_SYSTEM); - } else { - redirect(url); - } + showError(null, error.getString("caption"), + error.getString("message"), + error.getString("url")); + applicationRunning = false; } if (validatingLayouts) { @@ -2889,7 +2890,7 @@ public class ApplicationConnection { * @return true if at least one listener has been registered on server side * for the event identified by eventIdentifier. * @deprecated as of Vaadin 7. Use - * {@link ComponentState#hasEventListener(String)} instead + * {@link AbstractComponentState#hasEventListener(String)} instead */ @Deprecated public boolean hasEventListeners(ComponentConnector paintable, @@ -2989,7 +2990,7 @@ public class ApplicationConnection { /** * @deprecated as of Vaadin 7. Use - * {@link ComponentState#hasEventListener(String)} instead + * {@link AbstractComponentState#hasEventListener(String)} instead */ @Deprecated public boolean hasEventListeners(Widget widget, String eventIdentifier) { @@ -3027,7 +3028,7 @@ public class ApplicationConnection { * <p> * Heartbeat requests are used to inform the server that the client-side is * still alive. If the client page is closed or the connection lost, the - * server will eventually close the inactive Root. + * server will eventually close the inactive UI. * <p> * <b>TODO</b>: Improved error handling, like in doUidlRequest(). * @@ -3051,16 +3052,17 @@ public class ApplicationConnection { // TODO Permit retry in some error situations VConsole.log("Heartbeat response OK"); scheduleHeartbeat(); + } else if (status == Response.SC_GONE) { + showSessionExpiredError(null); } else { - VConsole.error("Heartbeat request failed with status code " + VConsole.error("Failed sending heartbeat to server. Error code: " + status); } } @Override public void onError(Request request, Throwable exception) { - VConsole.error("Heartbeat request resulted in exception"); - VConsole.error(exception); + VConsole.error("Exception sending heartbeat: " + exception); } }; diff --git a/client/src/com/vaadin/client/ComponentConnector.java b/client/src/com/vaadin/client/ComponentConnector.java index 9858ff6abd..ae889c1dbd 100644 --- a/client/src/com/vaadin/client/ComponentConnector.java +++ b/client/src/com/vaadin/client/ComponentConnector.java @@ -18,7 +18,7 @@ package com.vaadin.client; import com.google.gwt.dom.client.Element; import com.google.gwt.user.client.ui.Widget; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; /** * An interface used by client-side widgets or paintable parts to receive @@ -36,7 +36,7 @@ public interface ComponentConnector extends ServerConnector { * @see com.vaadin.client.VPaintable#getState() */ @Override - public ComponentState getState(); + public AbstractComponentState getState(); /** * Returns the widget for this {@link ComponentConnector} diff --git a/client/src/com/vaadin/client/ComponentLocator.java b/client/src/com/vaadin/client/ComponentLocator.java index 99f973c467..854c8535c4 100644 --- a/client/src/com/vaadin/client/ComponentLocator.java +++ b/client/src/com/vaadin/client/ComponentLocator.java @@ -34,7 +34,7 @@ import com.vaadin.client.ui.VTabsheetPanel; import com.vaadin.client.ui.VUI; import com.vaadin.client.ui.VWindow; import com.vaadin.client.ui.window.WindowConnector; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.Connector; import com.vaadin.shared.communication.SharedState; @@ -694,8 +694,8 @@ public class ComponentLocator { private ServerConnector findConnectorById(ServerConnector root, String id) { SharedState state = root.getState(); - if (state instanceof ComponentState - && id.equals(((ComponentState) state).id)) { + if (state instanceof AbstractComponentState + && id.equals(((AbstractComponentState) state).id)) { return root; } for (ServerConnector child : root.getChildren()) { diff --git a/client/src/com/vaadin/client/MeasuredSize.java b/client/src/com/vaadin/client/MeasuredSize.java index 48585ae7c5..ccc8a5058c 100644 --- a/client/src/com/vaadin/client/MeasuredSize.java +++ b/client/src/com/vaadin/client/MeasuredSize.java @@ -19,6 +19,8 @@ import com.google.gwt.core.client.JsArrayString; import com.google.gwt.dom.client.Element; public class MeasuredSize { + private final static boolean debugSizeChanges = false; + public static class MeasureResult { private final boolean widthChanged; private final boolean heightChanged; @@ -189,46 +191,79 @@ public class MeasuredSize { ComputedStyle computedStyle = new ComputedStyle(element); int[] paddings = computedStyle.getPadding(); if (!heightChanged && hasHeightChanged(this.paddings, paddings)) { + debugSizeChange(element, "Height (padding)", this.paddings, + paddings); heightChanged = true; } if (!widthChanged && hasWidthChanged(this.paddings, paddings)) { + debugSizeChange(element, "Width (padding)", this.paddings, paddings); widthChanged = true; } this.paddings = paddings; int[] margins = computedStyle.getMargin(); if (!heightChanged && hasHeightChanged(this.margins, margins)) { + debugSizeChange(element, "Height (margins)", this.margins, margins); heightChanged = true; } if (!widthChanged && hasWidthChanged(this.margins, margins)) { + debugSizeChange(element, "Width (margins)", this.margins, margins); widthChanged = true; } this.margins = margins; int[] borders = computedStyle.getBorder(); if (!heightChanged && hasHeightChanged(this.borders, borders)) { + debugSizeChange(element, "Height (borders)", this.borders, borders); heightChanged = true; } if (!widthChanged && hasWidthChanged(this.borders, borders)) { + debugSizeChange(element, "Width (borders)", this.borders, borders); widthChanged = true; } this.borders = borders; int requiredHeight = Util.getRequiredHeight(element); int marginHeight = sumHeights(margins); + int oldHeight = height; + int oldWidth = width; if (setOuterHeight(requiredHeight + marginHeight)) { + debugSizeChange(element, "Height (outer)", oldHeight, height); heightChanged = true; } int requiredWidth = Util.getRequiredWidth(element); int marginWidth = sumWidths(margins); if (setOuterWidth(requiredWidth + marginWidth)) { + debugSizeChange(element, "Width (outer)", oldWidth, width); widthChanged = true; } return new MeasureResult(widthChanged, heightChanged); } + private void debugSizeChange(Element element, String sizeChangeType, + int[] changedFrom, int[] changedTo) { + debugSizeChange(element, sizeChangeType, + java.util.Arrays.asList(changedFrom).toString(), + java.util.Arrays.asList(changedTo).toString()); + } + + private void debugSizeChange(Element element, String sizeChangeType, + int changedFrom, int changedTo) { + debugSizeChange(element, sizeChangeType, String.valueOf(changedFrom), + String.valueOf(changedTo)); + } + + private void debugSizeChange(Element element, String sizeChangeType, + String changedFrom, String changedTo) { + if (debugSizeChanges) { + VConsole.log(sizeChangeType + " has changed for " + + element.toString() + " from " + changedFrom + " to " + + changedTo); + } + } + private static boolean hasWidthChanged(int[] sizes1, int[] sizes2) { return sizes1[1] != sizes2[1] || sizes1[3] != sizes2[3]; } diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java index d111bd3093..7548cfe42a 100644 --- a/client/src/com/vaadin/client/Util.java +++ b/client/src/com/vaadin/client/Util.java @@ -45,7 +45,7 @@ import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.RenderInformation.FloatSize; import com.vaadin.client.ui.VOverlay; import com.vaadin.shared.ApplicationConstants; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.communication.MethodInvocation; import com.vaadin.shared.ui.ComponentStateUtil; @@ -523,7 +523,7 @@ public class Util { * @param state * @return */ - public static FloatSize parseRelativeSize(ComponentState state) { + public static FloatSize parseRelativeSize(AbstractComponentState state) { if (ComponentStateUtil.isUndefinedHeight(state) && ComponentStateUtil.isUndefinedWidth(state)) { return null; diff --git a/client/src/com/vaadin/client/VCaption.java b/client/src/com/vaadin/client/VCaption.java index aadc7b88ad..a662ef4a7b 100644 --- a/client/src/com/vaadin/client/VCaption.java +++ b/client/src/com/vaadin/client/VCaption.java @@ -24,7 +24,7 @@ import com.vaadin.client.ui.AbstractFieldConnector; import com.vaadin.client.ui.Icon; import com.vaadin.shared.AbstractFieldState; import com.vaadin.shared.ComponentConstants; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.ui.ComponentStateUtil; public class VCaption extends HTML { @@ -393,7 +393,7 @@ public class VCaption extends HTML { } } - public static boolean isNeeded(ComponentState state) { + public static boolean isNeeded(AbstractComponentState state) { if (state.caption != null) { return true; } diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java index 8b6c4fb8aa..49e879a681 100644 --- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java @@ -41,7 +41,7 @@ import com.vaadin.client.metadata.TypeData; import com.vaadin.client.ui.datefield.PopupDateFieldConnector; import com.vaadin.client.ui.ui.UIConnector; import com.vaadin.shared.ComponentConstants; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.Connector; import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.shared.ui.TabIndexState; @@ -116,8 +116,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector } @Override - public ComponentState getState() { - return (ComponentState) super.getState(); + public AbstractComponentState getState() { + return (AbstractComponentState) super.getState(); } @Override @@ -267,7 +267,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector * </p> */ protected void updateWidgetStyleNames() { - ComponentState state = getState(); + AbstractComponentState state = getState(); String primaryStyleName = getWidget().getStylePrimaryName(); if (state.primaryStyleName != null) { diff --git a/client/src/com/vaadin/client/ui/VFilterSelect.java b/client/src/com/vaadin/client/ui/VFilterSelect.java index 54498c432f..bca68a86f3 100644 --- a/client/src/com/vaadin/client/ui/VFilterSelect.java +++ b/client/src/com/vaadin/client/ui/VFilterSelect.java @@ -68,7 +68,7 @@ import com.vaadin.client.Util; import com.vaadin.client.VConsole; import com.vaadin.client.ui.menubar.MenuBar; import com.vaadin.client.ui.menubar.MenuItem; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.EventId; import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.shared.ui.combobox.FilteringMode; @@ -598,7 +598,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, * @param componentState * shared state of the combo box */ - public void updateStyleNames(UIDL uidl, ComponentState componentState) { + public void updateStyleNames(UIDL uidl, AbstractComponentState componentState) { setStyleName(VFilterSelect.this.getStylePrimaryName() + "-suggestpopup"); menu.setStyleName(VFilterSelect.this.getStylePrimaryName() diff --git a/client/src/com/vaadin/client/ui/VFormLayout.java b/client/src/com/vaadin/client/ui/VFormLayout.java index a46a0a41c8..49c991b39c 100644 --- a/client/src/com/vaadin/client/ui/VFormLayout.java +++ b/client/src/com/vaadin/client/ui/VFormLayout.java @@ -35,7 +35,7 @@ import com.vaadin.client.Focusable; import com.vaadin.client.StyleConstants; import com.vaadin.client.VTooltip; import com.vaadin.shared.ComponentConstants; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.shared.ui.MarginInfo; @@ -65,7 +65,7 @@ public class VFormLayout extends SimplePanel { * @param enabled * @return An array of stylenames */ - private String[] getStylesFromState(ComponentState state, boolean enabled) { + private String[] getStylesFromState(AbstractComponentState state, boolean enabled) { List<String> styles = new ArrayList<String>(); if (ComponentStateUtil.hasStyles(state)) { for (String name : state.styles) { @@ -188,7 +188,7 @@ public class VFormLayout extends SimplePanel { } - public void updateCaption(Widget widget, ComponentState state, + public void updateCaption(Widget widget, AbstractComponentState state, boolean enabled) { final Caption c = widgetToCaption.get(widget); if (c != null) { @@ -249,7 +249,7 @@ public class VFormLayout extends SimplePanel { setStyleName(styleName); } - public void updateCaption(ComponentState state, boolean enabled) { + public void updateCaption(AbstractComponentState state, boolean enabled) { // Update styles as they might have changed when the caption changed setStyles(getStylesFromState(state, enabled)); diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index 601c93428c..9b06b711cb 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -92,7 +92,7 @@ import com.vaadin.client.ui.dd.VDragAndDropManager; import com.vaadin.client.ui.dd.VDragEvent; import com.vaadin.client.ui.dd.VHasDropHandler; import com.vaadin.client.ui.dd.VTransferable; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.dd.VerticalDropLocation; import com.vaadin.shared.ui.table.TableConstants; @@ -1113,7 +1113,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } /** For internal use only. May be removed or replaced in the future. */ - public void updateSelectionProperties(UIDL uidl, ComponentState state, + public void updateSelectionProperties(UIDL uidl, AbstractComponentState state, boolean readOnly) { setMultiSelectMode(uidl.hasAttribute("multiselectmode") ? uidl .getIntAttribute("multiselectmode") : MULTISELECT_MODE_DEFAULT); diff --git a/client/src/com/vaadin/client/ui/VTabsheet.java b/client/src/com/vaadin/client/ui/VTabsheet.java index d74665bb6d..63aeaa2fc7 100644 --- a/client/src/com/vaadin/client/ui/VTabsheet.java +++ b/client/src/com/vaadin/client/ui/VTabsheet.java @@ -55,7 +55,7 @@ import com.vaadin.client.TooltipInfo; import com.vaadin.client.UIDL; import com.vaadin.client.Util; import com.vaadin.client.VCaption; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.EventId; import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.shared.ui.tabsheet.TabsheetBaseConstants; @@ -743,7 +743,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable, } /** For internal use only. May be removed or replaced in the future. */ - public void handleStyleNames(UIDL uidl, ComponentState state) { + public void handleStyleNames(UIDL uidl, AbstractComponentState state) { // Add proper stylenames for all elements (easier to prevent unwanted // style inheritance) if (ComponentStateUtil.hasStyles(state)) { diff --git a/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java b/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java index b94488896e..67555e8331 100644 --- a/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java +++ b/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java @@ -28,7 +28,7 @@ import com.vaadin.client.ServerConnector; import com.vaadin.client.Util; import com.vaadin.client.VConsole; import com.vaadin.client.ui.ManagedLayout; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; public class LayoutDependencyTree { private class LayoutDependency { @@ -309,7 +309,7 @@ public class LayoutDependencyTree { } else { s += "Horizontal"; } - ComponentState state = connector.getState(); + AbstractComponentState state = connector.getState(); s += " sizing: " + getSizeDefinition(direction == VERTICAL ? state.height : state.width) + "\n"; diff --git a/server/src/com/vaadin/event/EventRouter.java b/server/src/com/vaadin/event/EventRouter.java index 18f13b0ea2..80c6e5294d 100644 --- a/server/src/com/vaadin/event/EventRouter.java +++ b/server/src/com/vaadin/event/EventRouter.java @@ -31,11 +31,8 @@ import java.util.List; * * @author Vaadin Ltd. * @since 3.0 - * @deprecated The EventRouter will be replaced by an EventRouter which does not - * use reflection in Vaadin 7.0.0. See #8640. */ @SuppressWarnings("serial") -@Deprecated public class EventRouter implements MethodEventSource { /** diff --git a/server/src/com/vaadin/event/ListenerMethod.java b/server/src/com/vaadin/event/ListenerMethod.java index 199c02e091..2c43b31390 100644 --- a/server/src/com/vaadin/event/ListenerMethod.java +++ b/server/src/com/vaadin/event/ListenerMethod.java @@ -49,10 +49,7 @@ import java.util.logging.Logger; * * @author Vaadin Ltd. * @since 3.0 - * @deprecated The EventRouter will be replaced by an EventRouter which does not - * use reflection in Vaadin 7.0.0. See #8640. */ -@Deprecated @SuppressWarnings("serial") public class ListenerMethod implements EventListener, Serializable { diff --git a/server/src/com/vaadin/server/AbstractClientConnector.java b/server/src/com/vaadin/server/AbstractClientConnector.java index a9007916f0..3762e90d05 100644 --- a/server/src/com/vaadin/server/AbstractClientConnector.java +++ b/server/src/com/vaadin/server/AbstractClientConnector.java @@ -55,10 +55,10 @@ import com.vaadin.ui.UI; public abstract class AbstractClientConnector implements ClientConnector, MethodEventSource { /** - * A map from client to server RPC interface class to the RPC call manager - * that handles incoming RPC calls for that interface. + * A map from client to server RPC interface class name to the RPC call + * manager that handles incoming RPC calls for that interface. */ - private Map<Class<?>, RpcManager> rpcManagerMap = new HashMap<Class<?>, RpcManager>(); + private Map<String, RpcManager> rpcManagerMap = new HashMap<String, RpcManager>(); /** * A map from server to client RPC interface class to the RPC proxy that @@ -87,11 +87,7 @@ public abstract class AbstractClientConnector implements ClientConnector, /** * The EventRouter used for the event model. - * - * @deprecated The EventRouter will be replaced by an EventRouter which does - * not use reflection in Vaadin 7.0.0. See #8640. */ - @Deprecated private EventRouter eventRouter = null; /** @@ -126,8 +122,9 @@ public abstract class AbstractClientConnector implements ClientConnector, * RPC interface class for which the implementation should be * registered */ - protected <T> void registerRpc(T implementation, Class<T> rpcInterfaceType) { - rpcManagerMap.put(rpcInterfaceType, new ServerRpcManager<T>( + protected <T extends ServerRpc> void registerRpc(T implementation, + Class<T> rpcInterfaceType) { + rpcManagerMap.put(rpcInterfaceType.getName(), new ServerRpcManager<T>( implementation, rpcInterfaceType)); } @@ -337,18 +334,9 @@ public abstract class AbstractClientConnector implements ClientConnector, requestRepaint(); } - /** - * @see RpcTarget#getRpcManager(Class) - * - * @param rpcInterface - * RPC interface for which a call was made - * @return RPC Manager handling calls for the interface - * - * @since 7.0 - */ @Override - public RpcManager getRpcManager(Class<?> rpcInterface) { - return rpcManagerMap.get(rpcInterface); + public RpcManager getRpcManager(String rpcInterfaceName) { + return rpcManagerMap.get(rpcInterfaceName); } @Override @@ -675,10 +663,7 @@ public abstract class AbstractClientConnector implements ClientConnector, * the activation method. * * @since 6.2 - * @deprecated The EventRouter will be replaced by an EventRouter which does - * not use reflection in Vaadin 7.0.0. See #8640. */ - @Deprecated protected void addListener(String eventIdentifier, Class<?> eventType, Object target, Method method) { if (eventRouter == null) { @@ -764,11 +749,8 @@ public abstract class AbstractClientConnector implements ClientConnector, * @param method * the activation method. * - * @deprecated The EventRouter will be replaced by an EventRouter which does - * not use reflection in Vaadin 7.0.0. See #8640. */ @Override - @Deprecated public void addListener(Class<?> eventType, Object target, Method method) { if (eventRouter == null) { eventRouter = new EventRouter(); @@ -809,8 +791,9 @@ public abstract class AbstractClientConnector implements ClientConnector, * the object instance who owns the activation method. * @param methodName * the name of the activation method. - * @deprecated The EventRouter will be replaced by an EventRouter which does - * not use reflection in Vaadin 7.0.0. See #8640. + * @deprecated This method should be avoided. Use + * {@link #addListener(Class, Object, Method)} or + * {@link #addListener(String, Class, Object, Method)} instead. */ @Override @Deprecated @@ -864,11 +847,8 @@ public abstract class AbstractClientConnector implements ClientConnector, * @param method * the method owned by <code>target</code> that's registered to * listen to events of type <code>eventType</code>. - * @deprecated The EventRouter will be replaced by an EventRouter which does - * not use reflection in Vaadin 7.0.0. See #8640. */ @Override - @Deprecated public void removeListener(Class<?> eventType, Object target, Method method) { if (eventRouter != null) { eventRouter.removeListener(eventType, target, method); @@ -902,7 +882,10 @@ public abstract class AbstractClientConnector implements ClientConnector, * @param methodName * the name of the method owned by <code>target</code> that's * registered to listen to events of type <code>eventType</code>. + * @deprecated This method should be avoided. Use + * {@link #removeListener(Class, Object, Method)} instead. */ + @Deprecated @Override public void removeListener(Class<?> eventType, Object target, String methodName) { diff --git a/server/src/com/vaadin/server/AbstractCommunicationManager.java b/server/src/com/vaadin/server/AbstractCommunicationManager.java index 1481085247..74e5d5fd20 100644 --- a/server/src/com/vaadin/server/AbstractCommunicationManager.java +++ b/server/src/com/vaadin/server/AbstractCommunicationManager.java @@ -75,6 +75,7 @@ import com.vaadin.shared.JavaScriptConnectorState; import com.vaadin.shared.Version; import com.vaadin.shared.communication.LegacyChangeVariablesInvocation; import com.vaadin.shared.communication.MethodInvocation; +import com.vaadin.shared.communication.ServerRpc; import com.vaadin.shared.communication.SharedState; import com.vaadin.shared.communication.UidlValue; import com.vaadin.shared.ui.ui.UIConstants; @@ -582,15 +583,14 @@ public abstract class AbstractCommunicationManager implements Serializable { return; } - // Keep the UI alive - uI.setLastUidlRequestTime(System.currentTimeMillis()); + session.setLastRequestTimestamp(System.currentTimeMillis()); // Change all variables based on request parameters if (!handleVariables(request, response, callback, session, uI)) { // var inconsistency; the client is probably out-of-sync SystemMessages ci = response.getService().getSystemMessages( - uI.getLocale()); + uI.getLocale(), request); String msg = ci.getOutOfSyncMessage(); String cap = ci.getOutOfSyncCaption(); if (msg != null || cap != null) { @@ -1042,7 +1042,7 @@ public abstract class AbstractCommunicationManager implements Serializable { } SystemMessages ci = request.getService().getSystemMessages( - ui.getLocale()); + ui.getLocale(), request); // meta instruction for client to enable auto-forward to // sessionExpiredURL after timer expires. @@ -1332,7 +1332,7 @@ public abstract class AbstractCommunicationManager implements Serializable { */ private void writePerformanceData(final PrintWriter outWriter) { outWriter.write(String.format(", \"timings\":[%d, %d]", - session.getTotalSessionTime(), session.getLastRequestTime())); + session.getCumulativeRequestDuration(), session.getLastRequestDuration())); } private void legacyPaint(PaintTarget paintTarget, @@ -1662,17 +1662,6 @@ public abstract class AbstractCommunicationManager implements Serializable { final ClientConnector connector = getConnector(uI, invocation.getConnectorId()); - if (connector == null) { - getLogger().log( - Level.WARNING, - "RPC call to " + invocation.getInterfaceName() - + "." + invocation.getMethodName() - + " received for connector " - + invocation.getConnectorId() - + " but no such connector could be found"); - continue; - } - if (!enabledConnectors.contains(connector)) { if (invocation instanceof LegacyChangeVariablesInvocation) { @@ -1790,8 +1779,9 @@ public abstract class AbstractCommunicationManager implements Serializable { MethodInvocation invocation = parseInvocation(invocationJson, previousInvocation, connectorTracker); if (invocation != null) { - // Can be null iff the invocation was a legacy invocation and it - // was merged with the previous one + // Can be null if the invocation was a legacy invocation and it + // was merged with the previous one or if the invocation was + // rejected because of an error. invocations.add(invocation); previousInvocation = invocation; } @@ -1806,6 +1796,15 @@ public abstract class AbstractCommunicationManager implements Serializable { String interfaceName = invocationJson.getString(1); String methodName = invocationJson.getString(2); + if (connectorTracker.getConnector(connectorId) == null) { + getLogger().log( + Level.WARNING, + "RPC call to " + interfaceName + "." + methodName + + " received for connector " + connectorId + + " but no such connector could be found"); + return null; + } + JSONArray parametersJson = invocationJson.getJSONArray(3); if (LegacyChangeVariablesInvocation.isLegacyVariableChange( @@ -1855,8 +1854,30 @@ public abstract class AbstractCommunicationManager implements Serializable { String connectorId, String interfaceName, String methodName, JSONArray parametersJson, ConnectorTracker connectorTracker) throws JSONException { + ClientConnector connector = connectorTracker.getConnector(connectorId); + + RpcManager rpcManager = connector.getRpcManager(interfaceName); + if (!(rpcManager instanceof ServerRpcManager)) { + /* + * Security: Don't even decode the json parameters if no RpcManager + * corresponding to the received method invocation has been + * registered. + */ + getLogger().warning( + "Ignoring RPC call to " + interfaceName + "." + methodName + + " in connector " + connector.getClass().getName() + + "(" + connectorId + + ") as no RPC implementation is regsitered"); + return null; + } + + // Use interface from RpcManager instead of loading the class based on + // the string name to avoid problems with OSGi + Class<? extends ServerRpc> rpcInterface = ((ServerRpcManager<?>) rpcManager) + .getRpcInterface(); + ServerRpcMethodInvocation invocation = new ServerRpcMethodInvocation( - connectorId, interfaceName, methodName, parametersJson.length()); + connectorId, rpcInterface, methodName, parametersJson.length()); Object[] parameters = new Object[parametersJson.length()]; Type[] declaredRpcMethodParameterTypes = invocation.getMethod() @@ -2611,7 +2632,7 @@ public abstract class AbstractCommunicationManager implements Serializable { public void serveDependencyResource(VaadinRequest request, VaadinResponse response) throws IOException { - String pathInfo = request.getRequestPathInfo(); + String pathInfo = request.getPathInfo(); // + 2 to also remove beginning and ending slashes String resourceName = pathInfo .substring(ApplicationConstants.DEPENDENCY_RESOURCE_PREFIX @@ -2713,7 +2734,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * #createReceiverUrl */ - String pathInfo = request.getRequestPathInfo(); + String pathInfo = request.getPathInfo(); // strip away part until the data we are interested starts int startOfData = pathInfo .indexOf(ServletPortletHelper.UPLOAD_URL_PREFIX) @@ -2776,7 +2797,7 @@ public abstract class AbstractCommunicationManager implements Serializable { // null-check below handles this as well } if (ui != null) { - ui.setLastHeartbeatTime(System.currentTimeMillis()); + ui.setLastHeartbeatTimestamp(System.currentTimeMillis()); } else { response.sendError(HttpServletResponse.SC_NOT_FOUND, "UI not found"); } diff --git a/server/src/com/vaadin/server/AbstractJavaScriptExtension.java b/server/src/com/vaadin/server/AbstractJavaScriptExtension.java index 1f67631203..af814e6c19 100644 --- a/server/src/com/vaadin/server/AbstractJavaScriptExtension.java +++ b/server/src/com/vaadin/server/AbstractJavaScriptExtension.java @@ -17,6 +17,7 @@ package com.vaadin.server; import com.vaadin.shared.JavaScriptExtensionState; +import com.vaadin.shared.communication.ServerRpc; import com.vaadin.ui.JavaScriptFunction; /** @@ -125,7 +126,8 @@ public abstract class AbstractJavaScriptExtension extends AbstractExtension { this); @Override - protected <T> void registerRpc(T implementation, Class<T> rpcInterfaceType) { + protected <T extends ServerRpc> void registerRpc(T implementation, + Class<T> rpcInterfaceType) { super.registerRpc(implementation, rpcInterfaceType); callbackHelper.registerRpc(rpcInterfaceType); } diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java index d0e87d5e08..1ab4390351 100644 --- a/server/src/com/vaadin/server/BootstrapHandler.java +++ b/server/src/com/vaadin/server/BootstrapHandler.java @@ -413,7 +413,8 @@ public abstract class BootstrapHandler implements RequestHandler { Locale locale = ServletPortletHelper.findLocale(null, context.getSession(), context.getRequest()); // Get system messages - SystemMessages systemMessages = vaadinService.getSystemMessages(locale); + SystemMessages systemMessages = vaadinService.getSystemMessages(locale, + request); if (systemMessages != null) { // Write the CommunicationError -message to client JSONObject comErrMsg = new JSONObject(); @@ -433,6 +434,15 @@ public abstract class BootstrapHandler implements RequestHandler { authErrMsg.put("url", systemMessages.getAuthenticationErrorURL()); appConfig.put("authErrMsg", authErrMsg); + + JSONObject sessExpMsg = new JSONObject(); + sessExpMsg + .put("caption", systemMessages.getSessionExpiredCaption()); + sessExpMsg + .put("message", systemMessages.getSessionExpiredMessage()); + sessExpMsg.put("url", systemMessages.getSessionExpiredURL()); + + appConfig.put("sessExpMsg", sessExpMsg); } // getStaticFileLocation documented to never end with a slash diff --git a/server/src/com/vaadin/server/BrowserPopupUIProvider.java b/server/src/com/vaadin/server/BrowserPopupUIProvider.java index 23036dabed..6259fb605d 100644 --- a/server/src/com/vaadin/server/BrowserPopupUIProvider.java +++ b/server/src/com/vaadin/server/BrowserPopupUIProvider.java @@ -40,7 +40,7 @@ public class BrowserPopupUIProvider extends UIProvider { @Override public Class<? extends UI> getUIClass(UIClassSelectionEvent event) { - String requestPathInfo = event.getRequest().getRequestPathInfo(); + String requestPathInfo = event.getRequest().getPathInfo(); if (path.equals(requestPathInfo)) { return uiClass; } else { diff --git a/server/src/com/vaadin/server/ClientConnector.java b/server/src/com/vaadin/server/ClientConnector.java index b38f2a9037..b46ef58fcd 100644 --- a/server/src/com/vaadin/server/ClientConnector.java +++ b/server/src/com/vaadin/server/ClientConnector.java @@ -36,7 +36,7 @@ import com.vaadin.ui.UI; * @since 7.0.0 * */ -public interface ClientConnector extends Connector, RpcTarget { +public interface ClientConnector extends Connector { /** * Returns the list of pending server to client RPC calls and clears the * list. @@ -239,4 +239,14 @@ public interface ClientConnector extends Connector, RpcTarget { */ public boolean handleConnectorRequest(VaadinRequest request, VaadinResponse response, String path) throws IOException; + + /** + * Returns the RPC manager instance to use when receiving calls for an RPC + * interface. + * + * @param rpcInterfaceName + * name of the interface for which the call was made + * @return RpcManager or null if none found for the interface + */ + public RpcManager getRpcManager(String rpcInterfaceName); } diff --git a/server/src/com/vaadin/server/CommunicationManager.java b/server/src/com/vaadin/server/CommunicationManager.java index 19a431c882..6d60789be7 100644 --- a/server/src/com/vaadin/server/CommunicationManager.java +++ b/server/src/com/vaadin/server/CommunicationManager.java @@ -53,7 +53,7 @@ public class CommunicationManager extends AbstractCommunicationManager { return new BootstrapHandler() { @Override protected String getServiceUrl(BootstrapContext context) { - String pathInfo = context.getRequest().getRequestPathInfo(); + String pathInfo = context.getRequest().getPathInfo(); if (pathInfo == null) { return null; } else { diff --git a/server/src/com/vaadin/server/ConnectorResourceHandler.java b/server/src/com/vaadin/server/ConnectorResourceHandler.java index dd785e97b8..5cd218471c 100644 --- a/server/src/com/vaadin/server/ConnectorResourceHandler.java +++ b/server/src/com/vaadin/server/ConnectorResourceHandler.java @@ -26,7 +26,7 @@ public class ConnectorResourceHandler implements RequestHandler { @Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { - String requestPath = request.getRequestPathInfo(); + String requestPath = request.getPathInfo(); if (requestPath == null) { return false; } @@ -80,7 +80,7 @@ public class ConnectorResourceHandler implements RequestHandler { VaadinResponse response, String logMessage) throws IOException { getLogger().log(Level.WARNING, logMessage); response.sendError(HttpServletResponse.SC_NOT_FOUND, - request.getRequestPathInfo() + " can not be found"); + request.getPathInfo() + " can not be found"); // Request handled (though not in a nice way) return true; diff --git a/server/src/com/vaadin/server/Constants.java b/server/src/com/vaadin/server/Constants.java index b6bfcc0495..faf24b4bce 100644 --- a/server/src/com/vaadin/server/Constants.java +++ b/server/src/com/vaadin/server/Constants.java @@ -62,7 +62,7 @@ public interface Constants { static final String SERVLET_PARAMETER_DISABLE_XSRF_PROTECTION = "disable-xsrf-protection"; static final String SERVLET_PARAMETER_RESOURCE_CACHE_TIME = "resourceCacheTime"; static final String SERVLET_PARAMETER_HEARTBEAT_INTERVAL = "heartbeatInterval"; - static final String SERVLET_PARAMETER_CLOSE_IDLE_UIS = "closeIdleUIs"; + static final String SERVLET_PARAMETER_CLOSE_IDLE_SESSIONS = "closeIdleSessions"; static final String SERVLET_PARAMETER_UI_PROVIDER = "UIProvider"; // Configurable parameter names diff --git a/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java b/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java index 23392e59a8..13218f6e45 100644 --- a/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java +++ b/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java @@ -32,7 +32,7 @@ public class DefaultDeploymentConfiguration implements DeploymentConfiguration { private boolean xsrfProtectionEnabled; private int resourceCacheTime; private int heartbeatInterval; - private boolean idleUICleanupEnabled; + private boolean closeIdleSessions; private final Class<?> systemPropertyBaseClass; /** @@ -54,7 +54,7 @@ public class DefaultDeploymentConfiguration implements DeploymentConfiguration { checkXsrfProtection(); checkResourceCacheTime(); checkHeartbeatInterval(); - checkIdleUICleanup(); + checkCloseIdleSessions(); } @Override @@ -168,8 +168,8 @@ public class DefaultDeploymentConfiguration implements DeploymentConfiguration { } @Override - public boolean isIdleUICleanupEnabled() { - return idleUICleanupEnabled; + public boolean isCloseIdleSessions() { + return closeIdleSessions; } /** @@ -225,10 +225,10 @@ public class DefaultDeploymentConfiguration implements DeploymentConfiguration { } } - private void checkIdleUICleanup() { - idleUICleanupEnabled = getApplicationOrSystemProperty( - Constants.SERVLET_PARAMETER_CLOSE_IDLE_UIS, "false").equals( - "true"); + private void checkCloseIdleSessions() { + closeIdleSessions = getApplicationOrSystemProperty( + Constants.SERVLET_PARAMETER_CLOSE_IDLE_SESSIONS, "false") + .equals("true"); } private Logger getLogger() { diff --git a/server/src/com/vaadin/server/DefaultSystemMessagesProvider.java b/server/src/com/vaadin/server/DefaultSystemMessagesProvider.java index 08042d3848..7111a8bbbb 100644 --- a/server/src/com/vaadin/server/DefaultSystemMessagesProvider.java +++ b/server/src/com/vaadin/server/DefaultSystemMessagesProvider.java @@ -16,7 +16,6 @@ package com.vaadin.server; -import java.util.Locale; /** * System messages provider using the built-in default system messages. This @@ -34,7 +33,8 @@ public class DefaultSystemMessagesProvider implements SystemMessagesProvider { } @Override - public SystemMessages getSystemMessages(Locale locale) { + public SystemMessages getSystemMessages( + SystemMessagesInfo systemMessagesInfo) { return ServletPortletHelper.DEFAULT_SYSTEM_MESSAGES; } diff --git a/server/src/com/vaadin/server/DeploymentConfiguration.java b/server/src/com/vaadin/server/DeploymentConfiguration.java index 09405d6004..65f0393883 100644 --- a/server/src/com/vaadin/server/DeploymentConfiguration.java +++ b/server/src/com/vaadin/server/DeploymentConfiguration.java @@ -58,19 +58,24 @@ public interface DeploymentConfiguration extends Serializable { public int getHeartbeatInterval(); /** - * Returns whether UIs that have no other activity than heartbeat requests - * should be removed from the session after they have been idle the maximum - * inactivity time enforced by the session. + * Returns whether a session should be closed when all its open UIs have + * been idle for longer than its configured maximum inactivity time. + * <p> + * A UI is idle if it is open on the client side but has no activity other + * than heartbeat requests. If {@code isCloseIdleSessions() == false}, + * heartbeat requests cause the session to stay open for as long as there + * are open UIs on the client side. If it is {@code true}, the session is + * eventually closed if the open UIs do not have any user interaction. * * @see WrappedSession#getMaxInactiveInterval() * * @since 7.0.0 * - * @return True if UIs receiving only heartbeat requests are eventually - * removed; false if heartbeat requests extend UI lifetime - * indefinitely. + * @return True if UIs and sessions receiving only heartbeat requests are + * eventually closed; false if heartbeat requests extend UI and + * session lifetime indefinitely. */ - public boolean isIdleUICleanupEnabled(); + public boolean isCloseIdleSessions(); /** * Gets the properties configured for the deployment, e.g. as init diff --git a/server/src/com/vaadin/server/DragAndDropService.java b/server/src/com/vaadin/server/DragAndDropService.java index 69ab997b18..a864f8fb16 100644 --- a/server/src/com/vaadin/server/DragAndDropService.java +++ b/server/src/com/vaadin/server/DragAndDropService.java @@ -252,7 +252,7 @@ public class DragAndDropService implements VariableOwner, ClientConnector { } @Override - public RpcManager getRpcManager(Class<?> rpcInterface) { + public RpcManager getRpcManager(String interfaceName) { // TODO Use rpc for drag'n'drop return null; } diff --git a/server/src/com/vaadin/server/GlobalResourceHandler.java b/server/src/com/vaadin/server/GlobalResourceHandler.java index 23c294650e..119f9cdae0 100644 --- a/server/src/com/vaadin/server/GlobalResourceHandler.java +++ b/server/src/com/vaadin/server/GlobalResourceHandler.java @@ -68,7 +68,7 @@ public class GlobalResourceHandler implements RequestHandler { @Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { - String pathInfo = request.getRequestPathInfo(); + String pathInfo = request.getPathInfo(); if (pathInfo == null) { return false; } @@ -229,7 +229,7 @@ public class GlobalResourceHandler implements RequestHandler { VaadinResponse response, String logMessage) throws IOException { getLogger().log(Level.WARNING, logMessage); response.sendError(HttpServletResponse.SC_NOT_FOUND, - request.getRequestPathInfo() + " can not be found"); + request.getPathInfo() + " can not be found"); // Request handled (though not in a nice way) return true; diff --git a/server/src/com/vaadin/server/LegacyApplicationUIProvider.java b/server/src/com/vaadin/server/LegacyApplicationUIProvider.java index b3e8af8184..d139ee19f6 100644 --- a/server/src/com/vaadin/server/LegacyApplicationUIProvider.java +++ b/server/src/com/vaadin/server/LegacyApplicationUIProvider.java @@ -76,7 +76,7 @@ public abstract class LegacyApplicationUIProvider extends UIProvider { private UI getUIInstance(UIProviderEvent event) { VaadinRequest request = event.getRequest(); - String pathInfo = request.getRequestPathInfo(); + String pathInfo = request.getPathInfo(); String name = null; if (pathInfo != null && pathInfo.length() > 0) { Matcher matcher = WINDOW_NAME_PATTERN.matcher(pathInfo); diff --git a/server/src/com/vaadin/server/RequestTimer.java b/server/src/com/vaadin/server/RequestTimer.java index 26a5689665..bfe5362afe 100644 --- a/server/src/com/vaadin/server/RequestTimer.java +++ b/server/src/com/vaadin/server/RequestTimer.java @@ -50,6 +50,6 @@ public class RequestTimer implements Serializable { // The timings must be stored in the context, since a new // RequestTimer is created for every request. - context.setLastRequestTime(time); + context.setLastRequestDuration(time); } } diff --git a/server/src/com/vaadin/server/RpcTarget.java b/server/src/com/vaadin/server/RpcTarget.java deleted file mode 100644 index c491707995..0000000000 --- a/server/src/com/vaadin/server/RpcTarget.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2011 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.server; - -import java.io.Serializable; - -/** - * Marker interface for server side classes that can receive RPC calls. - * - * This plays a role similar to that of {@link VariableOwner}. - * - * @since 7.0 - */ -public interface RpcTarget extends Serializable { - /** - * Returns the RPC manager instance to use when receiving calls for an RPC - * interface. - * - * @param rpcInterface - * interface for which the call was made - * @return RpcManager or null if none found for the interface - */ - public RpcManager getRpcManager(Class<?> rpcInterface); -} diff --git a/server/src/com/vaadin/server/ServerRpcManager.java b/server/src/com/vaadin/server/ServerRpcManager.java index 8ef165e084..c063761c7f 100644 --- a/server/src/com/vaadin/server/ServerRpcManager.java +++ b/server/src/com/vaadin/server/ServerRpcManager.java @@ -24,6 +24,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import com.vaadin.shared.Connector; +import com.vaadin.shared.communication.ServerRpc; /** * Server side RPC manager that handles RPC calls coming from the client. @@ -34,7 +35,7 @@ import com.vaadin.shared.Connector; * * @since 7.0 */ -public class ServerRpcManager<T> implements RpcManager { +public class ServerRpcManager<T extends ServerRpc> implements RpcManager { private final T implementation; private final Class<T> rpcInterface; @@ -80,10 +81,10 @@ public class ServerRpcManager<T> implements RpcManager { * method invocation to perform * @throws RpcInvocationException */ - public static void applyInvocation(RpcTarget target, + public static void applyInvocation(ClientConnector target, ServerRpcMethodInvocation invocation) throws RpcInvocationException { - RpcManager manager = target.getRpcManager(invocation - .getInterfaceClass()); + RpcManager manager = target + .getRpcManager(invocation.getInterfaceName()); if (manager != null) { manager.applyInvocation(invocation); } else { diff --git a/server/src/com/vaadin/server/ServerRpcMethodInvocation.java b/server/src/com/vaadin/server/ServerRpcMethodInvocation.java index 761db687bb..3af58fa351 100644 --- a/server/src/com/vaadin/server/ServerRpcMethodInvocation.java +++ b/server/src/com/vaadin/server/ServerRpcMethodInvocation.java @@ -29,33 +29,20 @@ public class ServerRpcMethodInvocation extends MethodInvocation { private final Method method; - private Class<? extends ServerRpc> interfaceClass; + private final Class<? extends ServerRpc> interfaceClass; - public ServerRpcMethodInvocation(String connectorId, String interfaceName, - String methodName, int parameterCount) { - super(connectorId, interfaceName, methodName); + public ServerRpcMethodInvocation(String connectorId, + Class<? extends ServerRpc> interfaceClass, String methodName, + int parameterCount) { + super(connectorId, interfaceClass.getName(), methodName); + + assert ServerRpc.class.isAssignableFrom(interfaceClass); + this.interfaceClass = interfaceClass; - interfaceClass = findClass(); method = findInvocationMethod(interfaceClass, methodName, parameterCount); } - private Class<? extends ServerRpc> findClass() { - try { - Class<?> rpcInterface = Class.forName(getInterfaceName()); - if (!ServerRpc.class.isAssignableFrom(rpcInterface)) { - throw new IllegalArgumentException("The interface " - + getInterfaceName() + "is not a server RPC interface."); - } - return (Class<? extends ServerRpc>) rpcInterface; - } catch (ClassNotFoundException e) { - throw new IllegalArgumentException("The server RPC interface " - + getInterfaceName() + " could not be found", e); - } finally { - - } - } - public Class<? extends ServerRpc> getInterfaceClass() { return interfaceClass; } diff --git a/server/src/com/vaadin/server/ServletPortletHelper.java b/server/src/com/vaadin/server/ServletPortletHelper.java index 6fb03ab265..07218f9abd 100644 --- a/server/src/com/vaadin/server/ServletPortletHelper.java +++ b/server/src/com/vaadin/server/ServletPortletHelper.java @@ -79,7 +79,7 @@ class ServletPortletHelper implements Serializable { } private static boolean hasPathPrefix(VaadinRequest request, String prefix) { - String pathInfo = request.getRequestPathInfo(); + String pathInfo = request.getPathInfo(); if (pathInfo == null) { return false; diff --git a/server/src/com/vaadin/server/SystemMessages.java b/server/src/com/vaadin/server/SystemMessages.java index 647266d8e3..f36a8e8570 100644 --- a/server/src/com/vaadin/server/SystemMessages.java +++ b/server/src/com/vaadin/server/SystemMessages.java @@ -22,8 +22,8 @@ import java.io.Serializable; * Contains the system messages used to notify the user about various critical * situations that can occur. * <p> - * Customize by overriding the static {@link VaadinSession#getSystemMessages()} - * and returning {@link CustomizedSystemMessages}. + * Use {@link VaadinService#setSystemMessagesProvider(SystemMessagesProvider)} + * to customize. * </p> * <p> * The defaults defined in this class are: diff --git a/server/src/com/vaadin/server/SystemMessagesInfo.java b/server/src/com/vaadin/server/SystemMessagesInfo.java new file mode 100644 index 0000000000..30a6e82a90 --- /dev/null +++ b/server/src/com/vaadin/server/SystemMessagesInfo.java @@ -0,0 +1,53 @@ +package com.vaadin.server;
+
+import java.io.Serializable;
+import java.util.Locale;
+
+public class SystemMessagesInfo implements Serializable {
+
+ private Locale locale;
+ private VaadinRequest request;
+ private VaadinService service;
+
+ /**
+ * The locale of the UI related to the {@link SystemMessages} request.
+ *
+ * @return The Locale or null if the locale is not known
+ */
+ public Locale getLocale() {
+ return locale;
+ }
+
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
+ /**
+ * Gets the request currently in progress.
+ *
+ * @return The request currently in progress or null if no request is in
+ * progress.
+ */
+ public VaadinRequest getRequest() {
+ return request;
+ }
+
+ public void setRequest(VaadinRequest request) {
+ this.request = request;
+ }
+
+ /**
+ * Returns the service this SystemMessages request comes from.
+ *
+ * @return The service which triggered this request or null of not triggered
+ * from a service.
+ */
+ public VaadinService getService() {
+ return service;
+ }
+
+ public void setService(VaadinService service) {
+ this.service = service;
+ }
+
+}
diff --git a/server/src/com/vaadin/server/SystemMessagesProvider.java b/server/src/com/vaadin/server/SystemMessagesProvider.java index 21263a2950..caef8de420 100644 --- a/server/src/com/vaadin/server/SystemMessagesProvider.java +++ b/server/src/com/vaadin/server/SystemMessagesProvider.java @@ -17,7 +17,6 @@ package com.vaadin.server; import java.io.Serializable; -import java.util.Locale; import com.vaadin.ui.UI; @@ -30,16 +29,16 @@ import com.vaadin.ui.UI; */ public interface SystemMessagesProvider extends Serializable { /** - * Gets the system messages to use in the given context. Locale is the only - * piece of information guaranteed to be available, but in most cases some - * or all of {@link VaadinService#getCurrent()}, - * {@link VaadinService#getCurrentRequest()}, - * {@link VaadinSession#getCurrent()} and {@link UI#getCurrent()} can also - * be used to find more information to help the decision. + * Gets the system messages to use in the given context. The + * {@link SystemMessagesInfo} object contains available information but in + * most cases some or both of {@link VaadinSession#getCurrent()} and + * {@link UI#getCurrent()} can also be used to find more information to help + * the decision. * - * @param locale - * the desired locale of the system messages + * @param systemMessagesInfo + * Locale, current request and other information available. * @return a system messages object */ - public SystemMessages getSystemMessages(Locale locale); + public SystemMessages getSystemMessages( + SystemMessagesInfo systemMessagesInfo); } diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index 51a71f1cd6..b3ec6ba312 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -97,6 +97,16 @@ public class VaadinPortlet extends GenericPortlet implements Constants { } @Override + public String getRemoteHost() { + return originalRequest.getRemoteHost(); + } + + @Override + public int getRemotePort() { + return originalRequest.getRemotePort(); + } + + @Override public String getHeader(String name) { String header = super.getHeader(name); if (header == null) { @@ -106,6 +116,24 @@ public class VaadinPortlet extends GenericPortlet implements Constants { } @Override + public Enumeration<String> getHeaderNames() { + Enumeration<String> headerNames = super.getHeaderNames(); + if (headerNames == null) { + headerNames = originalRequest.getHeaderNames(); + } + return headerNames; + } + + @Override + public Enumeration<String> getHeaders(String name) { + Enumeration<String> headers = super.getHeaders(name); + if (headers == null) { + headers = originalRequest.getHeaders(name); + } + return headers; + } + + @Override public Map<String, String[]> getParameterMap() { Map<String, String[]> parameterMap = super.getParameterMap(); if (parameterMap == null) { @@ -628,7 +656,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { if (getRequestType(request) == RequestType.UIDL) { SystemMessages ci = getService().getSystemMessages( ServletPortletHelper.findLocale(null, vaadinSession, - request)); + request), request); criticalNotification(request, response, ci.getInternalErrorCaption(), ci.getInternalErrorMessage(), null, ci.getInternalErrorURL()); diff --git a/server/src/com/vaadin/server/VaadinPortletRequest.java b/server/src/com/vaadin/server/VaadinPortletRequest.java index f4ad040321..7243a610c9 100644 --- a/server/src/com/vaadin/server/VaadinPortletRequest.java +++ b/server/src/com/vaadin/server/VaadinPortletRequest.java @@ -16,15 +16,17 @@ package com.vaadin.server; +import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; -import java.util.Locale; -import java.util.Map; +import java.text.ParseException; +import java.util.Enumeration; import javax.portlet.ClientDataRequest; import javax.portlet.PortletRequest; import javax.portlet.PortletSession; import javax.portlet.ResourceRequest; +import javax.portlet.filter.PortletRequestWrapper; import com.vaadin.shared.ApplicationConstants; @@ -37,9 +39,9 @@ import com.vaadin.shared.ApplicationConstants; * @see VaadinRequest * @see VaadinPortletResponse */ -public class VaadinPortletRequest implements VaadinRequest { +public class VaadinPortletRequest extends PortletRequestWrapper implements + VaadinRequest { - private final PortletRequest request; private final VaadinPortletService vaadinService; /** @@ -52,19 +54,14 @@ public class VaadinPortletRequest implements VaadinRequest { */ public VaadinPortletRequest(PortletRequest request, VaadinPortletService vaadinService) { - this.request = request; + super(request); this.vaadinService = vaadinService; } @Override - public Object getAttribute(String name) { - return request.getAttribute(name); - } - - @Override public int getContentLength() { try { - return ((ClientDataRequest) request).getContentLength(); + return ((ClientDataRequest) getRequest()).getContentLength(); } catch (ClassCastException e) { throw new IllegalStateException( "Content lenght only available for ClientDataRequests"); @@ -74,7 +71,7 @@ public class VaadinPortletRequest implements VaadinRequest { @Override public InputStream getInputStream() throws IOException { try { - return ((ClientDataRequest) request).getPortletInputStream(); + return ((ClientDataRequest) getRequest()).getPortletInputStream(); } catch (ClassCastException e) { throw new IllegalStateException( "Input data only available for ClientDataRequests"); @@ -82,22 +79,18 @@ public class VaadinPortletRequest implements VaadinRequest { } @Override - public String getParameter(String name) { - return request.getParameter(name); - } - - @Override - public Map<String, String[]> getParameterMap() { - return request.getParameterMap(); - } - - @Override - public void setAttribute(String name, Object o) { - request.setAttribute(name, o); + public BufferedReader getReader() throws IOException { + try { + return ((ClientDataRequest) getRequest()).getReader(); + } catch (ClassCastException e) { + throw new IllegalStateException( + "Reader only available for ClientDataRequests"); + } } @Override - public String getRequestPathInfo() { + public String getPathInfo() { + PortletRequest request = getRequest(); if (request instanceof ResourceRequest) { ResourceRequest resourceRequest = (ResourceRequest) request; String resourceID = resourceRequest.getResourceID(); @@ -119,8 +112,7 @@ public class VaadinPortletRequest implements VaadinRequest { @Override public WrappedSession getWrappedSession(boolean allowSessionCreation) { - PortletSession session = request - .getPortletSession(allowSessionCreation); + PortletSession session = getPortletSession(allowSessionCreation); if (session != null) { return new WrappedPortletSession(session); } else { @@ -134,13 +126,13 @@ public class VaadinPortletRequest implements VaadinRequest { * @return the unwrapped portlet request */ public PortletRequest getPortletRequest() { - return request; + return getRequest(); } @Override public String getContentType() { try { - return ((ResourceRequest) request).getContentType(); + return ((ResourceRequest) getRequest()).getContentType(); } catch (ClassCastException e) { throw new IllegalStateException( "Content type only available for ResourceRequests"); @@ -148,8 +140,23 @@ public class VaadinPortletRequest implements VaadinRequest { } @Override - public Locale getLocale() { - return request.getLocale(); + public String getCharacterEncoding() { + try { + return ((ClientDataRequest) getRequest()).getCharacterEncoding(); + } catch (ClassCastException e) { + throw new IllegalStateException( + "Character encoding only available for ClientDataRequest"); + } + } + + @Override + public String getMethod() { + try { + return ((ClientDataRequest) getRequest()).getMethod(); + } catch (ClassCastException e) { + throw new IllegalStateException( + "Method only available for ClientDataRequest"); + } } @Override @@ -158,8 +165,13 @@ public class VaadinPortletRequest implements VaadinRequest { } @Override - public boolean isSecure() { - return request.isSecure(); + public String getRemoteHost() { + return null; + } + + @Override + public int getRemotePort() { + return -1; } @Override @@ -176,7 +188,7 @@ public class VaadinPortletRequest implements VaadinRequest { * the property is not defined */ public String getPortalProperty(String name) { - return request.getPortalContext().getProperty(name); + return getRequest().getPortalContext().getProperty(name); } @Override @@ -185,7 +197,28 @@ public class VaadinPortletRequest implements VaadinRequest { } @Override - public String getContextPath() { - return request.getContextPath(); + public long getDateHeader(String name) { + String header = getHeader(name); + if (header == null) { + return -1; + } else { + try { + return VaadinPortletResponse.HTTP_DATE_FORMAT.parse(header) + .getTime(); + } catch (ParseException e) { + throw new IllegalArgumentException(e); + } + } + } + + @Override + public Enumeration<String> getHeaderNames() { + return null; + } + + @Override + public Enumeration<String> getHeaders(String name) { + return null; } + } diff --git a/server/src/com/vaadin/server/VaadinPortletResponse.java b/server/src/com/vaadin/server/VaadinPortletResponse.java index d9fe828bff..ab0fff486b 100644 --- a/server/src/com/vaadin/server/VaadinPortletResponse.java +++ b/server/src/com/vaadin/server/VaadinPortletResponse.java @@ -28,6 +28,7 @@ import java.util.TimeZone; import javax.portlet.MimeResponse; import javax.portlet.PortletResponse; import javax.portlet.ResourceResponse; +import javax.servlet.http.Cookie; /** * Wrapper for {@link PortletResponse} and its subclasses. @@ -39,7 +40,7 @@ import javax.portlet.ResourceResponse; * @see VaadinPortletRequest */ public class VaadinPortletResponse implements VaadinResponse { - private static final DateFormat HTTP_DATE_FORMAT = new SimpleDateFormat( + static final DateFormat HTTP_DATE_FORMAT = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); static { HTTP_DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT")); @@ -117,4 +118,9 @@ public class VaadinPortletResponse implements VaadinResponse { public VaadinPortletService getService() { return vaadinService; } + + @Override + public void addCookie(Cookie cookie) { + response.addProperty(cookie); + } }
\ No newline at end of file diff --git a/server/src/com/vaadin/server/VaadinRequest.java b/server/src/com/vaadin/server/VaadinRequest.java index f5786c9b80..ebf405d4f3 100644 --- a/server/src/com/vaadin/server/VaadinRequest.java +++ b/server/src/com/vaadin/server/VaadinRequest.java @@ -16,14 +16,20 @@ package com.vaadin.server; +import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.security.Principal; +import java.util.Enumeration; import java.util.Locale; import java.util.Map; +import javax.portlet.ClientDataRequest; import javax.portlet.PortletRequest; import javax.servlet.ServletRequest; +import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; /** @@ -122,7 +128,7 @@ public interface VaadinRequest extends Serializable { * * @see javax.servlet.http.HttpServletRequest#getPathInfo() */ - public String getRequestPathInfo(); + public String getPathInfo(); /** * Returns the portion of the request URI that indicates the context of the @@ -233,4 +239,250 @@ public interface VaadinRequest extends Serializable { */ public VaadinService getService(); + /** + * Returns an array containing all of the <code>Cookie</code> objects the + * client sent with this request. This method returns <code>null</code> if + * no cookies were sent. + * + * @return an array of all the <code>Cookies</code> included with this + * request, or <code>null</code> if the request has no cookies + * + * @see HttpServletRequest#getCookies() + * @see PortletRequest#getCookies() + */ + public Cookie[] getCookies(); + + /** + * Returns the name of the authentication scheme used for the connection + * between client and server, for example, <code>BASIC_AUTH</code>, + * <code>CLIENT_CERT_AUTH</code>, a custom one or <code>null</code> if there + * was no authentication. + * + * @return a string indicating the authentication scheme, or + * <code>null</code> if the request was not authenticated. + * + * @see HttpServletRequest#getAuthType() + * @see PortletRequest#getAuthType() + */ + public String getAuthType(); + + /** + * Returns the login of the user making this request, if the user has been + * authenticated, or null if the user has not been authenticated. Whether + * the user name is sent with each subsequent request depends on the browser + * and type of authentication. + * + * @return a String specifying the login of the user making this request, or + * <code>null</code> if the user login is not known. + * + * @see HttpServletRequest#getRemoteUser() + * @see PortletRequest#getRemoteUser() + */ + public String getRemoteUser(); + + /** + * Returns a <code>java.security.Principal</code> object containing the name + * of the current authenticated user. If the user has not been + * authenticated, the method returns <code>null</code>. + * + * @return a <code>java.security.Principal</code> containing the name of the + * user making this request; <code>null</code> if the user has not + * been authenticated + * + * @see HttpServletRequest#getUserPrincipal() + * @see PortletRequest#getUserPrincipal() + */ + public Principal getUserPrincipal(); + + /** + * Returns a boolean indicating whether the authenticated user is included + * in the specified logical "role". Roles and role membership can be defined + * using deployment descriptors. If the user has not been authenticated, the + * method returns <code>false</code>. + * + * @param role + * a String specifying the name of the role + * @return a boolean indicating whether the user making this request belongs + * to a given role; <code>false</code> if the user has not been + * authenticated + * + * @see HttpServletRequest#isUserInRole(String) + * @see PortletRequest#isUserInRole(String) + */ + public boolean isUserInRole(String role); + + /** + * Removes an attribute from this request. This method is not generally + * needed as attributes only persist as long as the request is being + * handled. + * + * @param name + * a String specifying the name of the attribute to remove + * + * @see ServletRequest#removeAttribute(String) + * @see PortletRequest#removeAttribute(String) + */ + public void removeAttribute(String name); + + /** + * Returns an Enumeration containing the names of the attributes available + * to this request. This method returns an empty Enumeration if the request + * has no attributes available to it. + * + * @return an Enumeration of strings containing the names of the request's + * attributes + * + * @see ServletRequest#getAttributeNames() + * @see PortletRequest#getAttributeNames() + */ + public Enumeration<String> getAttributeNames(); + + /** + * Returns an Enumeration of Locale objects indicating, in decreasing order + * starting with the preferred locale, the locales that are acceptable to + * the client based on the Accept-Language header. If the client request + * doesn't provide an Accept-Language header, this method returns an + * Enumeration containing one Locale, the default locale for the server. + * + * @return an Enumeration of preferred Locale objects for the client + * + * @see HttpServletRequest#getLocales() + * @see PortletRequest#getLocales() + */ + public Enumeration<Locale> getLocales(); + + /** + * Returns the fully qualified name of the client or the last proxy that + * sent the request. If the engine cannot or chooses not to resolve the + * hostname (to improve performance), this method returns the dotted-string + * form of the IP address. + * + * @return a String containing the fully qualified name of the client, or + * <code>null</code> if the information is not available. + * + * @see HttpServletRequest#getRemoteHost() + */ + public String getRemoteHost(); + + /** + * Returns the Internet Protocol (IP) source port of the client or last + * proxy that sent the request. + * + * @return an integer specifying the port number, or -1 if the information + * is not available. + * + * @see ServletRequest#getRemotePort() + */ + public int getRemotePort(); + + /** + * Returns the name of the character encoding used in the body of this + * request. This method returns <code>null</code> if the request does not + * specify a character encoding. + * + * @return a String containing the name of the character encoding, or null + * if the request does not specify a character encoding + * + * @see ServletRequest#getCharacterEncoding() + * @see ClientDataRequest#getCharacterEncoding() + */ + public String getCharacterEncoding(); + + /** + * Retrieves the body of the request as character data using a + * <code>BufferedReader</code>. The reader translates the character data + * according to the character encoding used on the body. Either this method + * or {@link #getInputStream()} may be called to read the body, not both. + * + * @return a BufferedReader containing the body of the request + * + * @throws UnsupportedEncodingException + * - if the character set encoding used is not supported and the + * text cannot be decoded + * @throws IllegalStateException + * - if {@link #getInputStream()} method has been called on this + * request + * @throws IOException + * if an input or output exception occurred + * + * @see ServletRequest#getReader() + * @see ClientDataRequest#getReader() + */ + public BufferedReader getReader() throws IOException; + + /** + * Returns the name of the HTTP method with which this request was made, for + * example, GET, POST, or PUT. + * + * @return a String specifying the name of the method with which this + * request was made + * + * @see HttpServletRequest#getMethod() + * @see ClientDataRequest#getMethod() + */ + public String getMethod(); + + /** + * Returns the value of the specified request header as a long value that + * represents a Date object. Use this method with headers that contain + * dates, such as If-Modified-Since. + * <p> + * The date is returned as the number of milliseconds since January 1, 1970 + * GMT. The header name is case insensitive. + * <p> + * If the request did not have a header of the specified name, this method + * returns -1. If the header can't be converted to a date, the method throws + * an IllegalArgumentException. + * + * @param name + * a String specifying the name of the header + * @return a long value representing the date specified in the header + * expressed as the number of milliseconds since January 1, 1970 + * GMT, or -1 if the named header was not included with the request + * @throws IllegalArgumentException + * If the header value can't be converted to a date + * @see HttpServletRequest#getDateHeader(String) + */ + public long getDateHeader(String name); + + /** + * Returns an enumeration of all the header names this request contains. If + * the request has no headers, this method returns an empty enumeration. + * <p> + * Some implementations do not allow access headers using this method, in + * which case this method returns <code>null</code> + * + * @return an enumeration of all the header names sent with this request; if + * the request has no headers, an empty enumeration; if the + * implementation does not allow this method, <code>null</code> + * @see HttpServletRequest#getHeaderNames() + */ + public Enumeration<String> getHeaderNames(); + + /** + * Returns all the values of the specified request header as an Enumeration + * of String objects. + * <p> + * Some headers, such as <code>Accept-Language</code> can be sent by clients + * as several headers each with a different value rather than sending the + * header as a comma separated list. + * <p> + * If the request did not include any headers of the specified name, this + * method returns an empty Enumeration. If the request does not support + * accessing headers, this method returns <code>null</code>. + * <p> + * The header name is case insensitive. You can use this method with any + * request header. + * + * + * @param name + * a String specifying the header name + * @return an Enumeration containing the values of the requested header. If + * the request does not have any headers of that name return an + * empty enumeration. If the header information is not available, + * return <code>null</code> + * @see HttpServletRequest#getHeaders(String) + */ + public Enumeration<String> getHeaders(String name); + } diff --git a/server/src/com/vaadin/server/VaadinResponse.java b/server/src/com/vaadin/server/VaadinResponse.java index d1b2ac1254..5b1df09ab8 100644 --- a/server/src/com/vaadin/server/VaadinResponse.java +++ b/server/src/com/vaadin/server/VaadinResponse.java @@ -25,6 +25,7 @@ import javax.portlet.MimeResponse; import javax.portlet.PortletResponse; import javax.portlet.ResourceResponse; import javax.servlet.ServletResponse; +import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; /** @@ -156,4 +157,16 @@ public interface VaadinResponse extends Serializable { * @see VaadinService */ public VaadinService getService(); + + /** + * Adds the specified cookie to the response. This method can be called + * multiple times to set more than one cookie. + * + * @param cookie + * the Cookie to return to the client + * + * @see HttpServletResponse#addCookie(Cookie) + * @see PortletResponse#addProperty(Cookie) + */ + public void addCookie(Cookie cookie); } diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java index 2a3c04c49e..a4caf6cdd6 100644 --- a/server/src/com/vaadin/server/VaadinService.java +++ b/server/src/com/vaadin/server/VaadinService.java @@ -250,10 +250,16 @@ public abstract class VaadinService implements Serializable { * * @param locale * the desired locale for the system messages + * @param request * @return the system messages to use */ - public SystemMessages getSystemMessages(Locale locale) { - return getSystemMessagesProvider().getSystemMessages(locale); + public SystemMessages getSystemMessages(Locale locale, VaadinRequest request) { + SystemMessagesInfo systemMessagesInfo = new SystemMessagesInfo(); + systemMessagesInfo.setLocale(locale); + systemMessagesInfo.setService(this); + systemMessagesInfo.setRequest(request); + return getSystemMessagesProvider() + .getSystemMessages(systemMessagesInfo); } /** diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index 48e5304cc7..23378e4c20 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -418,7 +418,8 @@ public class VaadinServlet extends HttpServlet implements Constants { if (request.getRequestedSessionId() == null) { // User has cookies disabled SystemMessages systemMessages = getService().getSystemMessages( - ServletPortletHelper.findLocale(null, null, request)); + ServletPortletHelper.findLocale(null, null, request), + request); criticalNotification(request, response, systemMessages.getCookiesDisabledCaption(), systemMessages.getCookiesDisabledMessage(), null, @@ -576,7 +577,7 @@ public class VaadinServlet extends HttpServlet implements Constants { if (getRequestType(request) == RequestType.UIDL) { SystemMessages ci = getService().getSystemMessages( ServletPortletHelper.findLocale(null, vaadinSession, - request)); + request), request); criticalNotification(request, response, ci.getInternalErrorCaption(), ci.getInternalErrorMessage(), null, ci.getInternalErrorURL()); @@ -652,7 +653,8 @@ public class VaadinServlet extends HttpServlet implements Constants { try { SystemMessages ci = getService().getSystemMessages( - ServletPortletHelper.findLocale(null, null, request)); + ServletPortletHelper.findLocale(null, null, request), + request); RequestType requestType = getRequestType(request); if (requestType == RequestType.UIDL) { /* @@ -702,7 +704,7 @@ public class VaadinServlet extends HttpServlet implements Constants { * this case so just use the info provided in the request. */ SystemMessages ci = getService().getSystemMessages( - request.getLocale()); + request.getLocale(), request); RequestType requestType = getRequestType(request); if (requestType == RequestType.UIDL) { // send uidl redirect @@ -935,6 +937,17 @@ public class VaadinServlet extends HttpServlet implements Constants { String realFilename = sc.getRealPath(scssFilename); ScssStylesheet scss = ScssStylesheet.get(realFilename); if (scss == null) { + // Not a file in the file system (WebContent directory). Use the + // identifier directly (VAADIN/themes/.../styles.css) so + // ScssStylesheet will try using the class loader. + if (scssFilename.startsWith("/")) { + scssFilename = scssFilename.substring(1); + } + + scss = ScssStylesheet.get(scssFilename); + } + + if (scss == null) { getLogger() .warning( "Scss file " diff --git a/server/src/com/vaadin/server/VaadinServletRequest.java b/server/src/com/vaadin/server/VaadinServletRequest.java index 5b4b876244..e0ad94c18c 100644 --- a/server/src/com/vaadin/server/VaadinServletRequest.java +++ b/server/src/com/vaadin/server/VaadinServletRequest.java @@ -49,11 +49,6 @@ public class VaadinServletRequest extends HttpServletRequestWrapper implements } @Override - public String getRequestPathInfo() { - return getPathInfo(); - } - - @Override public WrappedSession getWrappedSession() { return getWrappedSession(true); } diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java index d2eb1a436a..08b408fa28 100644 --- a/server/src/com/vaadin/server/VaadinSession.java +++ b/server/src/com/vaadin/server/VaadinSession.java @@ -113,9 +113,11 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { private AbstractCommunicationManager communicationManager; - private long totalSessionTime = 0; + private long cumulativeRequestDuration = 0; - private long lastRequestTime = -1; + private long lastRequestDuration = -1; + + private long lastRequestTimestamp = System.currentTimeMillis(); private transient WrappedSession session; @@ -167,10 +169,11 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { } /** - * @return The total time spent servicing requests in this session. + * @return The total time spent servicing requests in this session, in + * milliseconds. */ - public long getTotalSessionTime() { - return totalSessionTime; + public long getCumulativeRequestDuration() { + return cumulativeRequestDuration; } /** @@ -178,18 +181,31 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * the total time spent servicing requests in this session. * * @param time - * the time spent in the last request. + * The time spent in the last request, in milliseconds. + */ + public void setLastRequestDuration(long time) { + lastRequestDuration = time; + cumulativeRequestDuration += time; + } + + /** + * @return The time spent servicing the last request in this session, in + * milliseconds. */ - public void setLastRequestTime(long time) { - lastRequestTime = time; - totalSessionTime += time; + public long getLastRequestDuration() { + return lastRequestDuration; } /** - * @return the time spent servicing the last request in this session. + * Sets the time when the last UIDL request was serviced in this session. + * + * @param timestamp + * The time when the last request was handled, in milliseconds + * since the epoch. + * */ - public long getLastRequestTime() { - return lastRequestTime; + public void setLastRequestTimestamp(long timestamp) { + lastRequestTimestamp = timestamp; } /** @@ -596,11 +612,17 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { */ @Deprecated public void cleanupInactiveUIs() { - for (UI ui : new ArrayList<UI>(uIs.values())) { - if (!isUIAlive(ui)) { - cleanupUI(ui); - getLogger().fine( - "Closed UI #" + ui.getUIId() + " due to inactivity"); + if (getUidlRequestTimeout() >= 0 + && System.currentTimeMillis() - lastRequestTimestamp > 1000 * getUidlRequestTimeout()) { + close(); + } else { + for (UI ui : new ArrayList<UI>(uIs.values())) { + if (!isUIAlive(ui)) { + cleanupUI(ui); + getLogger() + .fine("Closed UI #" + ui.getUIId() + + " due to inactivity"); + } } } } @@ -655,7 +677,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * otherwise heartbeat requests are enough to extend UI lifetime * indefinitely. * - * @see DeploymentConfiguration#isIdleUICleanupEnabled() + * @see DeploymentConfiguration#isCloseIdleSessions() * @see #getHeartbeatTimeout() * @see #cleanupInactiveUIs() * @@ -665,7 +687,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * timeout never occurs. */ protected int getUidlRequestTimeout() { - return configuration.isIdleUICleanupEnabled() ? getSession() + return configuration.isCloseIdleSessions() ? getSession() .getMaxInactiveInterval() : -1; } @@ -688,11 +710,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { protected boolean isUIAlive(UI ui) { long now = System.currentTimeMillis(); if (getHeartbeatTimeout() >= 0 - && now - ui.getLastHeartbeatTime() > 1000 * getHeartbeatTimeout()) { - return false; - } - if (getUidlRequestTimeout() >= 0 - && now - ui.getLastUidlRequestTime() > 1000 * getUidlRequestTimeout()) { + && now - ui.getLastHeartbeatTimestamp() > 1000 * getHeartbeatTimeout()) { return false; } return true; diff --git a/server/src/com/vaadin/server/WebBrowser.java b/server/src/com/vaadin/server/WebBrowser.java index 4df535a39a..468b36921c 100644 --- a/server/src/com/vaadin/server/WebBrowser.java +++ b/server/src/com/vaadin/server/WebBrowser.java @@ -267,7 +267,7 @@ public class WebBrowser implements Serializable { * @see WebBrowser#getRawTimezoneOffset() * @return timezone offset in milliseconds, 0 if not available */ - public Integer getTimezoneOffset() { + public int getTimezoneOffset() { return timezoneOffset; } @@ -288,7 +288,7 @@ public class WebBrowser implements Serializable { * * @return timezone offset in milliseconds excluding DST, 0 if not available */ - public Integer getRawTimezoneOffset() { + public int getRawTimezoneOffset() { return rawTimezoneOffset; } diff --git a/server/src/com/vaadin/server/WrappedHttpSession.java b/server/src/com/vaadin/server/WrappedHttpSession.java index 65db010ba9..dbf3761987 100644 --- a/server/src/com/vaadin/server/WrappedHttpSession.java +++ b/server/src/com/vaadin/server/WrappedHttpSession.java @@ -93,4 +93,29 @@ public class WrappedHttpSession implements WrappedSession { return session.getId(); } + @Override + public long getCreationTime() { + return session.getCreationTime(); + } + + @Override + public long getLastAccessedTime() { + return session.getLastAccessedTime(); + } + + @Override + public boolean isNew() { + return session.isNew(); + } + + @Override + public void removeAttribute(String name) { + session.removeAttribute(name); + } + + @Override + public void setMaxInactiveInterval(int interval) { + session.setMaxInactiveInterval(interval); + } + } diff --git a/server/src/com/vaadin/server/WrappedPortletSession.java b/server/src/com/vaadin/server/WrappedPortletSession.java index f4a6003ed5..dd9a1558f8 100644 --- a/server/src/com/vaadin/server/WrappedPortletSession.java +++ b/server/src/com/vaadin/server/WrappedPortletSession.java @@ -79,4 +79,29 @@ public class WrappedPortletSession implements WrappedSession { public String getId() { return session.getId(); } + + @Override + public long getCreationTime() { + return session.getCreationTime(); + } + + @Override + public long getLastAccessedTime() { + return session.getLastAccessedTime(); + } + + @Override + public boolean isNew() { + return session.isNew(); + } + + @Override + public void removeAttribute(String name) { + session.removeAttribute(name); + } + + @Override + public void setMaxInactiveInterval(int interval) { + session.setMaxInactiveInterval(interval); + } } diff --git a/server/src/com/vaadin/server/WrappedSession.java b/server/src/com/vaadin/server/WrappedSession.java index cf0b1a2fbd..49c9d1643c 100644 --- a/server/src/com/vaadin/server/WrappedSession.java +++ b/server/src/com/vaadin/server/WrappedSession.java @@ -91,6 +91,85 @@ public interface WrappedSession { * Gets a string with a unique identifier for the session. * * @return a unique session id string + * + * @see HttpSession#getId() + * @see PortletSession#getId() */ public String getId(); + + /** + * Returns the time when this session was created, measured in milliseconds + * since midnight January 1, 1970 GMT. + * + * @return a long specifying when this session was created, expressed in + * milliseconds since 1/1/1970 GMT + * + * @throws IllegalStateException + * if this method is called on an invalidated session + * @see HttpSession#getCreationTime() + * @see PortletSession#getCreationTime() + */ + public long getCreationTime(); + + /** + * Returns the last time the client sent a request associated with this + * session, as the number of milliseconds since midnight January 1, 1970 + * GMT, and marked by the time the container received the request. + * <p> + * Actions that your application takes, such as getting or setting a value + * associated with the session, do not affect the access time. + * + * @return a long representing the last time the client sent a request + * associated with this session, expressed in milliseconds since + * 1/1/1970 GMT + * + * @throws IllegalStateException + * if this method is called on an invalidated session + * + * @see HttpSession#getLastAccessedTime() + * @see PortletSession#getLastAccessedTime() + */ + public long getLastAccessedTime(); + + /** + * Returns true if the client does not yet know about the session or if the + * client chooses not to join the session. For example, if the server used + * only cookie-based sessions, and the client had disabled the use of + * cookies, then a session would be new on each request. + * + * @return true if the server has created a session, but the client has not + * yet joined + * @throws IllegalStateException + * if this method is called on an invalidated session + * @see HttpSession#isNew() + * @see PortletSession#isNew() + */ + public boolean isNew(); + + /** + * Removes the object bound with the specified name from this session. If + * the session does not have an object bound with the specified name, this + * method does nothing. + * + * @param name + * the name of the object to remove from this session + * @throws IllegalStateException + * if this method is called on an invalidated session + * @see HttpSession#removeAttribute(String) + * @see PortletSession#removeAttribute(String) + */ + public void removeAttribute(String name); + + /** + * Specifies the time, in seconds, between client requests before the + * servlet container will invalidate this session. A negative time indicates + * the session should never timeout. + * + * @param interval + * An integer specifying the number of seconds + * @see HttpSession#setMaxInactiveInterval(int) + * @see PortletSession#setMaxInactiveInterval(int) + */ + public void setMaxInactiveInterval(int interval); + } diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index 57032f58a8..fc6f176e2a 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -35,7 +35,7 @@ import com.vaadin.server.Resource; import com.vaadin.server.Terminal; import com.vaadin.server.VaadinSession; import com.vaadin.shared.ComponentConstants; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.util.ReflectTools; @@ -617,8 +617,8 @@ public abstract class AbstractComponent extends AbstractClientConnector * @return updated component shared state */ @Override - protected ComponentState getState() { - return (ComponentState) super.getState(); + protected AbstractComponentState getState() { + return (AbstractComponentState) super.getState(); } @Override diff --git a/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java b/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java index 47420334d7..91547dc79f 100644 --- a/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java +++ b/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java @@ -16,6 +16,7 @@ package com.vaadin.ui; import com.vaadin.server.JavaScriptCallbackHelper; +import com.vaadin.shared.communication.ServerRpc; import com.vaadin.shared.ui.JavaScriptComponentState; /** @@ -128,7 +129,8 @@ public abstract class AbstractJavaScriptComponent extends AbstractComponent { this); @Override - protected <T> void registerRpc(T implementation, Class<T> rpcInterfaceType) { + protected <T extends ServerRpc> void registerRpc(T implementation, + Class<T> rpcInterfaceType) { super.registerRpc(implementation, rpcInterfaceType); callbackHelper.registerRpc(rpcInterfaceType); } diff --git a/server/src/com/vaadin/ui/Panel.java b/server/src/com/vaadin/ui/Panel.java index b5cfe04407..472aefd5e0 100644 --- a/server/src/com/vaadin/ui/Panel.java +++ b/server/src/com/vaadin/ui/Panel.java @@ -56,20 +56,19 @@ public class Panel extends AbstractSingleComponentContainer implements }; /** - * Creates a new empty panel. A VerticalLayout is used as content. + * Creates a new empty panel. */ public Panel() { this((ComponentContainer) null); } /** - * Creates a new empty panel which contains the given content. The content - * cannot be null. + * Creates a new empty panel which contains the given content. * * @param content * the content for the panel. */ - public Panel(ComponentContainer content) { + public Panel(Component content) { registerRpc(rpc); setContent(content); setWidth(100, Unit.PERCENTAGE); @@ -77,7 +76,7 @@ public class Panel extends AbstractSingleComponentContainer implements } /** - * Creates a new empty panel with caption. Default layout is used. + * Creates a new empty panel with caption. * * @param caption * the caption used in the panel (HTML). @@ -94,7 +93,7 @@ public class Panel extends AbstractSingleComponentContainer implements * @param content * the content used in the panel. */ - public Panel(String caption, ComponentContainer content) { + public Panel(String caption, Component content) { this(content); setCaption(caption); } diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index 342983e8b8..83936a7478 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -172,9 +172,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements * current time whenever the application receives a heartbeat or UIDL * request from the client for this UI. */ - private long lastHeartbeat = System.currentTimeMillis(); - - private long lastUidlRequest = System.currentTimeMillis(); + private long lastHeartbeatTimestamp = System.currentTimeMillis(); /** * Creates a new empty UI without a caption. The content of the UI must be @@ -942,43 +940,29 @@ public abstract class UI extends AbstractSingleComponentContainer implements } /** - * Returns the timestamp (milliseconds since the epoch) of the last received - * heartbeat for this UI. + * Returns the timestamp of the last received heartbeat for this UI. * * @see #heartbeat() * @see VaadinSession#cleanupInactiveUIs() * - * @return The time the last heartbeat request occurred. - */ - public long getLastHeartbeatTime() { - return lastHeartbeat; - } - - /** - * Returns the timestamp (milliseconds since the epoch) of the last received - * UIDL request for this UI. - * - * @return + * @return The time the last heartbeat request occurred, in milliseconds + * since the epoch. */ - public long getLastUidlRequestTime() { - return lastUidlRequest; + public long getLastHeartbeatTimestamp() { + return lastHeartbeatTimestamp; } /** * Sets the last heartbeat request timestamp for this UI. Called by the * framework whenever the application receives a valid heartbeat request for * this UI. + * + * @param lastHeartbeat + * The time the last heartbeat request occurred, in milliseconds + * since the epoch. */ - public void setLastHeartbeatTime(long lastHeartbeat) { - this.lastHeartbeat = lastHeartbeat; - } - - /** - * Sets the last UIDL request timestamp for this UI. Called by the framework - * whenever the application receives a valid UIDL request for this UI. - */ - public void setLastUidlRequestTime(long lastUidlRequest) { - this.lastUidlRequest = lastUidlRequest; + public void setLastHeartbeatTimestamp(long lastHeartbeat) { + lastHeartbeatTimestamp = lastHeartbeat; } /** diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java index 3f6091aa90..338c77239a 100644 --- a/server/src/com/vaadin/ui/Window.java +++ b/server/src/com/vaadin/ui/Window.java @@ -42,10 +42,8 @@ import com.vaadin.shared.ui.window.WindowState; * {@link UI}. A window is added to a {@code UI} using * {@link UI#addWindow(Window)}. </p> * <p> - * The contents of a window is set using {@link #setContent(ComponentContainer)} - * or by using the {@link #Window(String, ComponentContainer)} constructor. The - * contents can in turn contain other components. By default, a - * {@link VerticalLayout} is used as content. + * The contents of a window is set using {@link #setContent(Component)} or by + * using the {@link #Window(String, Component)} constructor. * </p> * <p> * A window can be positioned on the screen using absolute coordinates (pixels) @@ -75,14 +73,14 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, }; /** - * Creates a new unnamed window with a default layout. + * Creates a new, empty sub window */ public Window() { this("", null); } /** - * Creates a new unnamed window with a default layout and given title. + * Creates a new, empty sub window with a given title. * * @param caption * the title of the window. @@ -92,14 +90,14 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, } /** - * Creates a new unnamed window with the given content and title. + * Creates a new, empty sub window with the given content and title. * * @param caption * the title of the window. * @param content * the contents of the window */ - public Window(String caption, ComponentContainer content) { + public Window(String caption, Component content) { super(caption, content); registerRpc(rpc); setSizeUndefined(); diff --git a/shared/src/com/vaadin/shared/ComponentState.java b/shared/src/com/vaadin/shared/AbstractComponentState.java index d8b5fec587..e1f7916874 100644 --- a/shared/src/com/vaadin/shared/ComponentState.java +++ b/shared/src/com/vaadin/shared/AbstractComponentState.java @@ -19,15 +19,16 @@ package com.vaadin.shared; import java.util.List; import com.vaadin.shared.communication.SharedState; +import com.vaadin.ui.AbstractComponent; /** - * Default shared state implementation for UI components. + * Default shared state implementation for {@link AbstractComponent}. * - * State classes of concrete components should extend this class. + * State classes of components should typically extend this class. * * @since 7.0 */ -public class ComponentState extends SharedState { +public class AbstractComponentState extends SharedState { public String height = ""; public String width = ""; public boolean readOnly = false; diff --git a/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java b/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java index 608152cc54..b7e689f8bc 100644 --- a/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java +++ b/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java @@ -1,8 +1,8 @@ package com.vaadin.shared.ui; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class AbstractEmbeddedState extends ComponentState { +public class AbstractEmbeddedState extends AbstractComponentState { public static final String SOURCE_RESOURCE = "source"; diff --git a/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java b/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java index 4fc865626c..cbb02ceaa4 100644 --- a/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java +++ b/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java @@ -15,8 +15,8 @@ */ package com.vaadin.shared.ui; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class AbstractLayoutState extends ComponentState { +public class AbstractLayoutState extends AbstractComponentState { }
\ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/AbstractMediaState.java b/shared/src/com/vaadin/shared/ui/AbstractMediaState.java index 76d4e1b000..56c1989d5b 100644 --- a/shared/src/com/vaadin/shared/ui/AbstractMediaState.java +++ b/shared/src/com/vaadin/shared/ui/AbstractMediaState.java @@ -18,10 +18,10 @@ package com.vaadin.shared.ui; import java.util.ArrayList; import java.util.List; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.communication.URLReference; -public class AbstractMediaState extends ComponentState { +public class AbstractMediaState extends AbstractComponentState { public boolean showControls; public String altText; diff --git a/shared/src/com/vaadin/shared/ui/BrowserPopupExtensionState.java b/shared/src/com/vaadin/shared/ui/BrowserPopupExtensionState.java index a9ca6841d8..199de54f8f 100644 --- a/shared/src/com/vaadin/shared/ui/BrowserPopupExtensionState.java +++ b/shared/src/com/vaadin/shared/ui/BrowserPopupExtensionState.java @@ -16,9 +16,9 @@ package com.vaadin.shared.ui; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class BrowserPopupExtensionState extends ComponentState { +public class BrowserPopupExtensionState extends AbstractComponentState { public String target = "_blank"; diff --git a/shared/src/com/vaadin/shared/ui/ComponentStateUtil.java b/shared/src/com/vaadin/shared/ui/ComponentStateUtil.java index 33f841fa09..8106e8af98 100644 --- a/shared/src/com/vaadin/shared/ui/ComponentStateUtil.java +++ b/shared/src/com/vaadin/shared/ui/ComponentStateUtil.java @@ -2,7 +2,7 @@ package com.vaadin.shared.ui; import java.util.HashSet; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.communication.SharedState; public final class ComponentStateUtil { @@ -11,27 +11,27 @@ public final class ComponentStateUtil { // Util class is not instantiable } - public static final boolean isUndefinedWidth(ComponentState state) { + public static final boolean isUndefinedWidth(AbstractComponentState state) { return state.width == null || "".equals(state.width); } - public static final boolean isUndefinedHeight(ComponentState state) { + public static final boolean isUndefinedHeight(AbstractComponentState state) { return state.height == null || "".equals(state.height); } - public static final boolean hasDescription(ComponentState state) { + public static final boolean hasDescription(AbstractComponentState state) { return state.description != null && !"".equals(state.description); } - public static final boolean hasStyles(ComponentState state) { + public static final boolean hasStyles(AbstractComponentState state) { return state.styles != null && !state.styles.isEmpty(); } - public static final boolean isRelativeWidth(ComponentState state) { + public static final boolean isRelativeWidth(AbstractComponentState state) { return state.width != null && state.width.endsWith("%"); } - public static final boolean isRelativeHeight(ComponentState state) { + public static final boolean isRelativeHeight(AbstractComponentState state) { return state.height != null && state.height.endsWith("%"); } diff --git a/shared/src/com/vaadin/shared/ui/JavaScriptComponentState.java b/shared/src/com/vaadin/shared/ui/JavaScriptComponentState.java index 7a2eedd95d..1252b7f235 100644 --- a/shared/src/com/vaadin/shared/ui/JavaScriptComponentState.java +++ b/shared/src/com/vaadin/shared/ui/JavaScriptComponentState.java @@ -21,10 +21,10 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.JavaScriptConnectorState; -public class JavaScriptComponentState extends ComponentState implements +public class JavaScriptComponentState extends AbstractComponentState implements JavaScriptConnectorState { private Set<String> callbackNames = new HashSet<String>(); diff --git a/shared/src/com/vaadin/shared/ui/TabIndexState.java b/shared/src/com/vaadin/shared/ui/TabIndexState.java index a9cb56e5ed..bb446829be 100644 --- a/shared/src/com/vaadin/shared/ui/TabIndexState.java +++ b/shared/src/com/vaadin/shared/ui/TabIndexState.java @@ -15,7 +15,7 @@ */ package com.vaadin.shared.ui; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; /** * Interface implemented by state classes that support tab indexes. @@ -24,7 +24,7 @@ import com.vaadin.shared.ComponentState; * @since 7.0.0 * */ -public class TabIndexState extends ComponentState { +public class TabIndexState extends AbstractComponentState { /** * The <i>tabulator index</i> of the field. diff --git a/shared/src/com/vaadin/shared/ui/button/ButtonState.java b/shared/src/com/vaadin/shared/ui/button/ButtonState.java index e7272379bb..48feb596dc 100644 --- a/shared/src/com/vaadin/shared/ui/button/ButtonState.java +++ b/shared/src/com/vaadin/shared/ui/button/ButtonState.java @@ -16,14 +16,14 @@ package com.vaadin.shared.ui.button; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.ui.TabIndexState; /** * Shared state for {@link com.vaadin.ui.Button} and * {@link com.vaadin.ui.NativeButton}. * - * @see ComponentState + * @see AbstractComponentState * * @since 7.0 */ diff --git a/shared/src/com/vaadin/shared/ui/label/LabelState.java b/shared/src/com/vaadin/shared/ui/label/LabelState.java index 2cccc310aa..72cdcaad62 100644 --- a/shared/src/com/vaadin/shared/ui/label/LabelState.java +++ b/shared/src/com/vaadin/shared/ui/label/LabelState.java @@ -15,9 +15,9 @@ */ package com.vaadin.shared.ui.label; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class LabelState extends ComponentState { +public class LabelState extends AbstractComponentState { { primaryStyleName = "v-label"; } diff --git a/shared/src/com/vaadin/shared/ui/link/LinkState.java b/shared/src/com/vaadin/shared/ui/link/LinkState.java index 96b4600000..3e4436f5e3 100644 --- a/shared/src/com/vaadin/shared/ui/link/LinkState.java +++ b/shared/src/com/vaadin/shared/ui/link/LinkState.java @@ -1,8 +1,8 @@ package com.vaadin.shared.ui.link; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class LinkState extends ComponentState { +public class LinkState extends AbstractComponentState { { primaryStyleName = "v-link"; } diff --git a/shared/src/com/vaadin/shared/ui/menubar/MenuBarState.java b/shared/src/com/vaadin/shared/ui/menubar/MenuBarState.java index cf1ef99c06..192dfa2e0f 100644 --- a/shared/src/com/vaadin/shared/ui/menubar/MenuBarState.java +++ b/shared/src/com/vaadin/shared/ui/menubar/MenuBarState.java @@ -1,8 +1,8 @@ package com.vaadin.shared.ui.menubar; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class MenuBarState extends ComponentState { +public class MenuBarState extends AbstractComponentState { { primaryStyleName = "v-menubar"; } diff --git a/shared/src/com/vaadin/shared/ui/panel/PanelState.java b/shared/src/com/vaadin/shared/ui/panel/PanelState.java index 9d502df8fe..433bef72a5 100644 --- a/shared/src/com/vaadin/shared/ui/panel/PanelState.java +++ b/shared/src/com/vaadin/shared/ui/panel/PanelState.java @@ -15,9 +15,9 @@ */ package com.vaadin.shared.ui.panel; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class PanelState extends ComponentState { +public class PanelState extends AbstractComponentState { { primaryStyleName = "v-panel"; } diff --git a/shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java b/shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java index 0f83d0fcd4..2af516daac 100644 --- a/shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java +++ b/shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java @@ -1,8 +1,8 @@ package com.vaadin.shared.ui.popupview; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class PopupViewState extends ComponentState { +public class PopupViewState extends AbstractComponentState { public String html; public boolean hideOnMouseOut; diff --git a/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java b/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java index 8bddffdfd6..fb1b4c1262 100644 --- a/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java +++ b/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java @@ -17,10 +17,10 @@ package com.vaadin.shared.ui.splitpanel; import java.io.Serializable; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.Connector; -public class AbstractSplitPanelState extends ComponentState { +public class AbstractSplitPanelState extends AbstractComponentState { public Connector firstChild = null; public Connector secondChild = null; public SplitterState splitterState = new SplitterState(); diff --git a/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java index a36acca9dc..c89a20bb22 100644 --- a/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java +++ b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java @@ -1,8 +1,8 @@ package com.vaadin.shared.ui.tabsheet; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class TabsheetState extends ComponentState { +public class TabsheetState extends AbstractComponentState { { primaryStyleName = "v-tabsheet"; } diff --git a/shared/src/com/vaadin/shared/ui/ui/UIState.java b/shared/src/com/vaadin/shared/ui/ui/UIState.java index 028218409f..59eff36435 100644 --- a/shared/src/com/vaadin/shared/ui/ui/UIState.java +++ b/shared/src/com/vaadin/shared/ui/ui/UIState.java @@ -15,9 +15,9 @@ */ package com.vaadin.shared.ui.ui; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class UIState extends ComponentState { +public class UIState extends AbstractComponentState { { primaryStyleName = "v-ui"; } diff --git a/theme-compiler/src/com/vaadin/sass/SassCompiler.java b/theme-compiler/src/com/vaadin/sass/SassCompiler.java index e6ac31b865..07d6eb01f1 100644 --- a/theme-compiler/src/com/vaadin/sass/SassCompiler.java +++ b/theme-compiler/src/com/vaadin/sass/SassCompiler.java @@ -25,14 +25,20 @@ public class SassCompiler { public static void main(String[] args) throws Exception { String input = null; String output = null; - if (args.length == 0) { + if (args.length < 1 || args.length > 2) { System.out .println("usage: SassCompile <scss file to compile> <css file to write>"); return; - } else if (args.length == 1) { - input = args[0]; - } else { - input = args[0]; + } + + File in = new File(args[0]); + if (!in.canRead()) { + System.err.println(in.getCanonicalPath() + " could not be read!"); + return; + } + input = in.getCanonicalPath(); + + if (args.length == 2) { output = args[1]; } diff --git a/uitest/src/com/vaadin/tests/Parameters.java b/uitest/src/com/vaadin/tests/Parameters.java index feb9a8cf6b..934a98e910 100644 --- a/uitest/src/com/vaadin/tests/Parameters.java +++ b/uitest/src/com/vaadin/tests/Parameters.java @@ -110,7 +110,7 @@ public class Parameters extends com.vaadin.server.LegacyApplication implements public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { context.setValue("Context not available"); - relative.setValue(request.getRequestPathInfo()); + relative.setValue(request.getPathInfo()); params.removeAllItems(); Map<String, String[]> parameters = request.getParameterMap(); diff --git a/uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.html b/uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.html index f5ad0987aa..2bdb7c79a5 100644 --- a/uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.html +++ b/uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.html @@ -18,7 +18,7 @@ </tr> <tr> <td>assertTextPresent</td> - <td>exact:closeIdleUIs: true</td> + <td>exact:closeIdleSessions: true</td> <td></td> </tr> <tr> diff --git a/uitest/src/com/vaadin/tests/application/NavigateWithOngoingXHR.java b/uitest/src/com/vaadin/tests/application/NavigateWithOngoingXHR.java index 5e3094b66c..d32ecb583d 100644 --- a/uitest/src/com/vaadin/tests/application/NavigateWithOngoingXHR.java +++ b/uitest/src/com/vaadin/tests/application/NavigateWithOngoingXHR.java @@ -35,7 +35,7 @@ public class NavigateWithOngoingXHR extends AbstractTestUI { public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { - if ("/slowRequestHandler".equals(request.getRequestPathInfo())) { + if ("/slowRequestHandler".equals(request.getPathInfo())) { // Make the navigation request last longer to keep the // communication error visible // System.out.println("Got slow content request"); diff --git a/uitest/src/com/vaadin/tests/applicationservlet/InitParamUIProvider.java b/uitest/src/com/vaadin/tests/applicationservlet/InitParamUIProvider.java index b4f29dda06..e62cd9a4f9 100644 --- a/uitest/src/com/vaadin/tests/applicationservlet/InitParamUIProvider.java +++ b/uitest/src/com/vaadin/tests/applicationservlet/InitParamUIProvider.java @@ -27,7 +27,7 @@ public class InitParamUIProvider extends UIProvider { @Override public Class<? extends UI> getUIClass(UIClassSelectionEvent event) { VaadinRequest request = event.getRequest(); - String pathInfo = request.getRequestPathInfo(); + String pathInfo = request.getPathInfo(); if ("/test".equals(pathInfo)) { return BasicJavaScriptComponent.class; } else { diff --git a/uitest/src/com/vaadin/tests/applicationservlet/SystemMessagesTest.html b/uitest/src/com/vaadin/tests/applicationservlet/SystemMessagesTest.html new file mode 100644 index 0000000000..a764255b5b --- /dev/null +++ b/uitest/src/com/vaadin/tests/applicationservlet/SystemMessagesTest.html @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8888/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.applicationservlet.SystemMessagesTest?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestsapplicationservletSystemMessagesTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestsapplicationservletSystemMessagesTest::Root/VNotification[0]/domChild[0]</td>
+ <td>Internal error*MessagesInfo locale: fi_FI</td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.applicationservlet.SystemMessagesTest?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>vaadin=runcomvaadintestsapplicationservletSystemMessagesTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VNativeSelect[0]/domChild[0]</td>
+ <td>label=de_DE</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestsapplicationservletSystemMessagesTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestsapplicationservletSystemMessagesTest::Root/VNotification[0]/domChild[0]</td>
+ <td>Internal error*MessagesInfo locale: de_DE</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/applicationservlet/SystemMessagesTest.java b/uitest/src/com/vaadin/tests/applicationservlet/SystemMessagesTest.java new file mode 100644 index 0000000000..516c0ca8e0 --- /dev/null +++ b/uitest/src/com/vaadin/tests/applicationservlet/SystemMessagesTest.java @@ -0,0 +1,90 @@ +package com.vaadin.tests.applicationservlet;
+
+import java.util.Locale;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.CustomizedSystemMessages;
+import com.vaadin.server.SystemMessages;
+import com.vaadin.server.SystemMessagesInfo;
+import com.vaadin.server.SystemMessagesProvider;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.NativeSelect;
+
+public class SystemMessagesTest extends AbstractTestUI {
+
+ public class MyButton extends Button {
+ private boolean fail = false;
+
+ @Override
+ public void beforeClientResponse(boolean initial) {
+ super.beforeClientResponse(initial);
+ if (fail) {
+ throw new RuntimeException("Failed on purpose");
+ }
+ }
+
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final NativeSelect localeSelect = new NativeSelect("UI locale");
+ localeSelect.setImmediate(true);
+ localeSelect.addItem(new Locale("en", "US"));
+ localeSelect.addItem(new Locale("fi", "FI"));
+ localeSelect.addItem(Locale.GERMANY);
+ localeSelect.addValueChangeListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ setLocale((Locale) localeSelect.getValue());
+ getSession().getService().setSystemMessagesProvider(
+ new SystemMessagesProvider() {
+
+ @Override
+ public SystemMessages getSystemMessages(
+ SystemMessagesInfo systemMessagesInfo) {
+ CustomizedSystemMessages csm = new CustomizedSystemMessages();
+ // csm.setInternalErrorCaption("Request query string: "
+ // + ((VaadinServletRequest) systemMessagesInfo
+ // .getRequest()).getQueryString());
+ csm.setInternalErrorMessage("MessagesInfo locale: "
+ + systemMessagesInfo.getLocale());
+ return csm;
+
+ }
+ });
+ }
+ });
+ localeSelect.setValue(new Locale("fi", "FI"));
+ addComponent(localeSelect);
+ final MyButton failButton = new MyButton();
+ failButton.setCaption("Generate server side error");
+ failButton.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ failButton.fail = true;
+ }
+ });
+ addComponent(failButton);
+
+ }
+
+ @Override
+ protected String getTestDescription() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java index 57fc9f3e62..984ac69d6e 100644 --- a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java +++ b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java @@ -87,7 +87,7 @@ public class LazyInitUIs extends AbstractTestUIProvider { public static Label getRequestInfo(String name, VaadinRequest request) { String info = name; - info += "<br />pathInfo: " + request.getRequestPathInfo(); + info += "<br />pathInfo: " + request.getPathInfo(); info += "<br />parameters: " + request.getParameterMap().keySet(); info += "<br />uri fragment: " + Page.getCurrent().getLocation().getFragment(); diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a1/UsingXyzWhenInitializing.java b/uitest/src/com/vaadin/tests/minitutorials/v7a1/UsingXyzWhenInitializing.java index c4d496641d..6cf0514df4 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7a1/UsingXyzWhenInitializing.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7a1/UsingXyzWhenInitializing.java @@ -44,7 +44,7 @@ public class UsingXyzWhenInitializing extends UI { layout.addComponent(new Label("Hello " + name)); - String pathInfo = request.getRequestPathInfo(); + String pathInfo = request.getPathInfo(); if ("/viewSource".equals(pathInfo)) { layout.addComponent(new Label("This is the source")); } else { diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b1/Addition.java b/uitest/src/com/vaadin/tests/minitutorials/v7b1/Addition.java index a91df49508..f22e56733c 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7b1/Addition.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7b1/Addition.java @@ -16,7 +16,7 @@ package com.vaadin.tests.minitutorials.v7b1; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.ui.AbstractComponent; public class Addition extends AbstractComponent { @@ -63,6 +63,6 @@ public class Addition extends AbstractComponent { } } -class AddResultState extends ComponentState { +class AddResultState extends AbstractComponentState { public int sum; } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1589.java b/uitest/src/com/vaadin/tests/tickets/Ticket1589.java index 9b5be40aa3..db6fa682fc 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1589.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1589.java @@ -54,7 +54,7 @@ class MyDynamicResource implements RequestHandler { @Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { - String relativeUri = request.getRequestPathInfo(); + String relativeUri = request.getPathInfo(); // Catch the given URI that identifies the resource, otherwise let other // URI handlers or the Application to handle the response. if (!relativeUri.startsWith("myresource")) { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2292.java b/uitest/src/com/vaadin/tests/tickets/Ticket2292.java index 2fd843ede6..e81ad3185a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2292.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2292.java @@ -50,7 +50,7 @@ public class Ticket2292 extends com.vaadin.server.LegacyApplication implements @Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { - String relativeUri = request.getRequestPathInfo(); + String relativeUri = request.getPathInfo(); if (!relativeUri.contains("icon.png")) { return false; diff --git a/uitest/src/com/vaadin/tests/widgetset/client/DelegateState.java b/uitest/src/com/vaadin/tests/widgetset/client/DelegateState.java index e9ac8a1e61..1af0d04bf6 100644 --- a/uitest/src/com/vaadin/tests/widgetset/client/DelegateState.java +++ b/uitest/src/com/vaadin/tests/widgetset/client/DelegateState.java @@ -16,10 +16,10 @@ package com.vaadin.tests.widgetset.client; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.annotations.DelegateToWidget; -public class DelegateState extends ComponentState { +public class DelegateState extends AbstractComponentState { @DelegateToWidget public String value1; diff --git a/uitest/src/com/vaadin/tests/widgetset/client/LabelState.java b/uitest/src/com/vaadin/tests/widgetset/client/LabelState.java index 91a269e33f..9bc1397339 100644 --- a/uitest/src/com/vaadin/tests/widgetset/client/LabelState.java +++ b/uitest/src/com/vaadin/tests/widgetset/client/LabelState.java @@ -16,7 +16,7 @@ package com.vaadin.tests.widgetset.client; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; /** * State class with the same simple name as @@ -26,7 +26,7 @@ import com.vaadin.shared.ComponentState; * @version @VERSION@ * @since 7.0.0 */ -public class LabelState extends ComponentState { +public class LabelState extends AbstractComponentState { private String text; diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ComponentInStateState.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ComponentInStateState.java index b64d0f0ad5..58ec6fc892 100644 --- a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ComponentInStateState.java +++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ComponentInStateState.java @@ -16,9 +16,9 @@ package com.vaadin.tests.widgetset.client.minitutorials.v7a2; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.Connector; -public class ComponentInStateState extends ComponentState { +public class ComponentInStateState extends AbstractComponentState { public Connector otherComponent; } diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentState.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentState.java index 948f98e756..a7a6b987fb 100644 --- a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentState.java +++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentState.java @@ -1,8 +1,8 @@ package com.vaadin.tests.widgetset.client.minitutorials.v7a2; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class MyComponentState extends ComponentState { +public class MyComponentState extends AbstractComponentState { public String text; |