diff options
Diffstat (limited to 'uitest')
3 files changed, 16 insertions, 7 deletions
diff --git a/uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java b/uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java index eb8559f746..45552df39c 100644 --- a/uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java +++ b/uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java @@ -3,9 +3,11 @@ package com.vaadin.tests.resources; import java.io.File; import com.vaadin.server.FileResource; +import com.vaadin.server.WrappedRequest; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.util.CurrentInstance; public class NonExistingFileResource extends TestBase { @@ -24,8 +26,10 @@ public class NonExistingFileResource extends TestBase { @Override public void buttonClick(ClickEvent event) { - FileResource res = new FileResource(new File(getContext() - .getBaseDirectory() + "/" + filename)); + FileResource res = new FileResource(new File(CurrentInstance + .get(WrappedRequest.class).getDeploymentConfiguration() + .getBaseDirectory() + + "/" + filename)); getMainWindow().open(res); } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1975.java b/uitest/src/com/vaadin/tests/tickets/Ticket1975.java index e85fe294f2..4fa3470f0b 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1975.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1975.java @@ -5,13 +5,14 @@ import java.io.File; import java.io.FileInputStream; import com.vaadin.Application; -import com.vaadin.server.ServletApplicationContext; +import com.vaadin.server.WrappedRequest; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.CustomLayout; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; +import com.vaadin.util.CurrentInstance; public class Ticket1975 extends Application.LegacyApplication { @@ -33,7 +34,6 @@ public class Ticket1975 extends Application.LegacyApplication { try { cl1 = new CustomLayout(new ByteArrayInputStream(s.getBytes())); layout.addComponent(cl1); - ServletApplicationContext wc = ((ServletApplicationContext) getContext()); layout.addComponent(new Button("Disable/Enable", new ClickListener() { @@ -47,8 +47,10 @@ public class Ticket1975 extends Application.LegacyApplication { } })); - File f = new File(wc.getBaseDirectory().getAbsoluteFile() - + "/VAADIN/themes/" + getTheme() + File baseDir = CurrentInstance.get(WrappedRequest.class) + .getDeploymentConfiguration().getBaseDirectory() + .getAbsoluteFile(); + File f = new File(baseDir + "/VAADIN/themes/" + getTheme() + "/layouts/Ticket1975.html"); cl2 = new CustomLayout(new FileInputStream(f)); diff --git a/uitest/src/com/vaadin/tests/util/SampleDirectory.java b/uitest/src/com/vaadin/tests/util/SampleDirectory.java index e15f0ccfe3..7304f1cab8 100644 --- a/uitest/src/com/vaadin/tests/util/SampleDirectory.java +++ b/uitest/src/com/vaadin/tests/util/SampleDirectory.java @@ -20,10 +20,12 @@ import java.io.File; import com.vaadin.Application; import com.vaadin.server.SystemError; +import com.vaadin.server.WrappedRequest; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.UI; +import com.vaadin.util.CurrentInstance; /** * Provides sample directory based on application directory. If this fails then @@ -46,7 +48,8 @@ public class SampleDirectory { + "context base directory failed, " + "possible security constraint with Application " + "Server or Servlet Container.<br />"; - File file = application.getContext().getBaseDirectory(); + File file = CurrentInstance.get(WrappedRequest.class) + .getDeploymentConfiguration().getBaseDirectory(); if ((file == null) || (!file.canRead()) || (file.getAbsolutePath() == null)) { // cannot access example directory, possible security issue with |