summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-08-31 19:40:01 +0300
committerLeif Åstrand <leif@vaadin.com>2012-09-03 14:05:29 +0300
commit7c3febaf37b8bdfad31c7d407e9150d04e598bb2 (patch)
tree3a120065ddb2bb34313e6e64669ed4f38684a105
parent094fabccf991fae1efd507a8a993fce1bc547b89 (diff)
downloadvaadin-framework-7c3febaf37b8bdfad31c7d407e9150d04e598bb2.tar.gz
vaadin-framework-7c3febaf37b8bdfad31c7d407e9150d04e598bb2.zip
Rename WebApplicationContext -> ServletApplicationContext (#9402)
-rw-r--r--server/src/com/vaadin/Application.java4
-rw-r--r--server/src/com/vaadin/server/AbstractApplicationServlet.java20
-rw-r--r--server/src/com/vaadin/server/CombinedRequest.java4
-rw-r--r--server/src/com/vaadin/server/CommunicationManager.java2
-rw-r--r--server/src/com/vaadin/server/GAEApplicationServlet.java4
-rw-r--r--server/src/com/vaadin/server/Page.java3
-rw-r--r--server/src/com/vaadin/server/ServletApplicationContext.java (renamed from server/src/com/vaadin/server/WebApplicationContext.java)14
-rw-r--r--server/src/com/vaadin/server/WrappedHttpServletRequest.java4
-rw-r--r--server/tests/src/com/vaadin/tests/server/TransactionListenersConcurrency.java8
-rw-r--r--uitest/src/com/vaadin/tests/VerifyBrowserVersion.java4
-rw-r--r--uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java4
-rw-r--r--uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java6
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket1975.java4
13 files changed, 39 insertions, 42 deletions
diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java
index 2ea7f01eea..90f354e180 100644
--- a/server/src/com/vaadin/Application.java
+++ b/server/src/com/vaadin/Application.java
@@ -64,7 +64,7 @@ import com.vaadin.server.RequestHandler;
import com.vaadin.server.Terminal;
import com.vaadin.server.UIProvider;
import com.vaadin.server.VariableOwner;
-import com.vaadin.server.WebApplicationContext;
+import com.vaadin.server.ServletApplicationContext;
import com.vaadin.server.WrappedRequest;
import com.vaadin.server.WrappedRequest.BrowserDetails;
import com.vaadin.server.WrappedResponse;
@@ -867,7 +867,7 @@ public class Application implements Terminal.ErrorListener, Serializable {
* </p>
* <p>
* By default, when you are deploying your application to a servlet
- * container, the implementation class is {@link WebApplicationContext} -
+ * container, the implementation class is {@link ServletApplicationContext} -
* you can safely cast to this class and use the methods from there. When
* you are deploying your application as a portlet, context implementation
* is {@link PortletApplicationContext}.
diff --git a/server/src/com/vaadin/server/AbstractApplicationServlet.java b/server/src/com/vaadin/server/AbstractApplicationServlet.java
index 2f0dad7079..87d36da255 100644
--- a/server/src/com/vaadin/server/AbstractApplicationServlet.java
+++ b/server/src/com/vaadin/server/AbstractApplicationServlet.java
@@ -275,7 +275,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
* Get or create a WebApplicationContext and an ApplicationManager
* for the session
*/
- WebApplicationContext webApplicationContext = getApplicationContext(request
+ ServletApplicationContext webApplicationContext = getApplicationContext(request
.getSession());
CommunicationManager applicationManager = webApplicationContext
.getApplicationManager(application, this);
@@ -363,7 +363,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
// Notifies transaction end
try {
if (transactionStarted) {
- ((WebApplicationContext) application.getContext())
+ ((ServletApplicationContext) application.getContext())
.endTransaction(application, request);
}
@@ -694,7 +694,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
throws ServletException, MalformedURLException {
Application newApplication = getNewApplication(request);
- final WebApplicationContext context = getApplicationContext(request
+ final ServletApplicationContext context = getApplicationContext(request
.getSession());
context.addApplication(newApplication);
@@ -856,7 +856,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
* @throws MalformedURLException
*/
private void startApplication(HttpServletRequest request,
- Application application, WebApplicationContext webApplicationContext)
+ Application application, ServletApplicationContext webApplicationContext)
throws ServletException, MalformedURLException {
if (!application.isRunning()) {
@@ -1385,7 +1385,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
throw new SessionExpiredException();
}
- WebApplicationContext context = getApplicationContext(session);
+ ServletApplicationContext context = getApplicationContext(session);
// Gets application list for the session.
final Collection<Application> applications = context.getApplications();
@@ -1491,7 +1491,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
application.close();
if (session != null) {
- WebApplicationContext context = getApplicationContext(session);
+ ServletApplicationContext context = getApplicationContext(session);
context.removeApplication(application);
}
}
@@ -1506,13 +1506,13 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
* the HTTP session.
* @return the application context for HttpSession.
*/
- protected WebApplicationContext getApplicationContext(HttpSession session) {
+ protected ServletApplicationContext getApplicationContext(HttpSession session) {
/*
* TODO the ApplicationContext.getApplicationContext() should be removed
* and logic moved here. Now overriding context type is possible, but
* the whole creation logic should be here. MT 1101
*/
- return WebApplicationContext.getApplicationContext(session);
+ return ServletApplicationContext.getApplicationContext(session);
}
public class RequestError implements Terminal.ErrorEvent, Serializable {
@@ -1535,11 +1535,11 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
* mananger implementation.
*
* @deprecated Instead of overriding this method, override
- * {@link WebApplicationContext} implementation via
+ * {@link ServletApplicationContext} implementation via
* {@link AbstractApplicationServlet#getApplicationContext(HttpSession)}
* method and in that customized implementation return your
* CommunicationManager in
- * {@link WebApplicationContext#getApplicationManager(Application, AbstractApplicationServlet)}
+ * {@link ServletApplicationContext#getApplicationManager(Application, AbstractApplicationServlet)}
* method.
*
* @param application
diff --git a/server/src/com/vaadin/server/CombinedRequest.java b/server/src/com/vaadin/server/CombinedRequest.java
index c186fcc87c..0577c0098a 100644
--- a/server/src/com/vaadin/server/CombinedRequest.java
+++ b/server/src/com/vaadin/server/CombinedRequest.java
@@ -153,8 +153,8 @@ public class CombinedRequest implements WrappedRequest {
@Override
public WebBrowser getWebBrowser() {
- WebApplicationContext context = (WebApplicationContext) Application
- .getCurrent().getContext();
+ ApplicationContext context = Application.getCurrent()
+ .getContext();
return context.getBrowser();
}
};
diff --git a/server/src/com/vaadin/server/CommunicationManager.java b/server/src/com/vaadin/server/CommunicationManager.java
index 3c594eaf02..af28438f57 100644
--- a/server/src/com/vaadin/server/CommunicationManager.java
+++ b/server/src/com/vaadin/server/CommunicationManager.java
@@ -112,7 +112,7 @@ public class CommunicationManager extends AbstractCommunicationManager {
@Override
protected InputStream getThemeResourceAsStream(UI uI, String themeName,
String resource) {
- WebApplicationContext context = (WebApplicationContext) uI
+ ServletApplicationContext context = (ServletApplicationContext) uI
.getApplication().getContext();
ServletContext servletContext = context.getHttpSession()
.getServletContext();
diff --git a/server/src/com/vaadin/server/GAEApplicationServlet.java b/server/src/com/vaadin/server/GAEApplicationServlet.java
index 7e0b52c382..240984c760 100644
--- a/server/src/com/vaadin/server/GAEApplicationServlet.java
+++ b/server/src/com/vaadin/server/GAEApplicationServlet.java
@@ -322,7 +322,7 @@ public class GAEApplicationServlet extends ApplicationServlet {
ois = new ObjectInputStream(bais);
ApplicationContext applicationContext = (ApplicationContext) ois
.readObject();
- session.setAttribute(WebApplicationContext.class.getName(),
+ session.setAttribute(ServletApplicationContext.class.getName(),
applicationContext);
} catch (IOException e) {
getLogger().log(
@@ -360,7 +360,7 @@ public class GAEApplicationServlet extends ApplicationServlet {
private void cleanSession(HttpServletRequest request) {
HttpSession session = request.getSession(false);
if (session != null) {
- session.removeAttribute(WebApplicationContext.class.getName());
+ session.removeAttribute(ServletApplicationContext.class.getName());
}
}
diff --git a/server/src/com/vaadin/server/Page.java b/server/src/com/vaadin/server/Page.java
index b8fdae6cfb..da172ed837 100644
--- a/server/src/com/vaadin/server/Page.java
+++ b/server/src/com/vaadin/server/Page.java
@@ -391,8 +391,7 @@ public class Page implements Serializable {
}
public WebBrowser getWebBrowser() {
- return ((WebApplicationContext) uI.getApplication().getContext())
- .getBrowser();
+ return uI.getApplication().getContext().getBrowser();
}
public void setBrowserWindowSize(int width, int height) {
diff --git a/server/src/com/vaadin/server/WebApplicationContext.java b/server/src/com/vaadin/server/ServletApplicationContext.java
index 02e902f79e..639ff117d1 100644
--- a/server/src/com/vaadin/server/WebApplicationContext.java
+++ b/server/src/com/vaadin/server/ServletApplicationContext.java
@@ -37,7 +37,7 @@ import com.vaadin.Application;
* @since 3.1
*/
@SuppressWarnings("serial")
-public class WebApplicationContext extends ApplicationContext {
+public class ServletApplicationContext extends ApplicationContext {
protected transient HttpSession session;
private transient boolean reinitializingSession = false;
@@ -51,7 +51,7 @@ public class WebApplicationContext extends ApplicationContext {
* Creates a new Web Application Context.
*
*/
- protected WebApplicationContext() {
+ protected ServletApplicationContext() {
}
@@ -147,13 +147,13 @@ public class WebApplicationContext extends ApplicationContext {
* the HTTP session.
* @return the application context for HttpSession.
*/
- static public WebApplicationContext getApplicationContext(
+ static public ServletApplicationContext getApplicationContext(
HttpSession session) {
- WebApplicationContext cx = (WebApplicationContext) session
- .getAttribute(WebApplicationContext.class.getName());
+ ServletApplicationContext cx = (ServletApplicationContext) session
+ .getAttribute(ServletApplicationContext.class.getName());
if (cx == null) {
- cx = new WebApplicationContext();
- session.setAttribute(WebApplicationContext.class.getName(), cx);
+ cx = new ServletApplicationContext();
+ session.setAttribute(ServletApplicationContext.class.getName(), cx);
}
if (cx.session == null) {
cx.session = session;
diff --git a/server/src/com/vaadin/server/WrappedHttpServletRequest.java b/server/src/com/vaadin/server/WrappedHttpServletRequest.java
index cb8a9e8c5f..b069235843 100644
--- a/server/src/com/vaadin/server/WrappedHttpServletRequest.java
+++ b/server/src/com/vaadin/server/WrappedHttpServletRequest.java
@@ -99,8 +99,8 @@ public class WrappedHttpServletRequest extends HttpServletRequestWrapper
@Override
public WebBrowser getWebBrowser() {
- WebApplicationContext context = (WebApplicationContext) Application
- .getCurrent().getContext();
+ ApplicationContext context = Application.getCurrent()
+ .getContext();
return context.getBrowser();
}
};
diff --git a/server/tests/src/com/vaadin/tests/server/TransactionListenersConcurrency.java b/server/tests/src/com/vaadin/tests/server/TransactionListenersConcurrency.java
index 302b534d8a..05ffcd1e36 100644
--- a/server/tests/src/com/vaadin/tests/server/TransactionListenersConcurrency.java
+++ b/server/tests/src/com/vaadin/tests/server/TransactionListenersConcurrency.java
@@ -23,7 +23,7 @@ import com.vaadin.Application;
import com.vaadin.Application.ApplicationStartEvent;
import com.vaadin.server.ApplicationContext;
import com.vaadin.server.DeploymentConfiguration;
-import com.vaadin.server.WebApplicationContext;
+import com.vaadin.server.ServletApplicationContext;
public class TransactionListenersConcurrency extends TestCase {
@@ -39,7 +39,7 @@ public class TransactionListenersConcurrency extends TestCase {
final List<Throwable> exceptions = new ArrayList<Throwable>();
HttpSession session = createSession();
- final WebApplicationContext context = WebApplicationContext
+ final ServletApplicationContext context = ServletApplicationContext
.getApplicationContext(session);
List<Thread> threads = new ArrayList<Thread>();
@@ -151,10 +151,10 @@ public class TransactionListenersConcurrency extends TestCase {
private static HttpSession createSession() {
HttpSession session = createMock(HttpSession.class);
EasyMock.expect(
- session.getAttribute(WebApplicationContext.class.getName()))
+ session.getAttribute(ServletApplicationContext.class.getName()))
.andReturn(null).anyTimes();
session.setAttribute(
- EasyMock.eq(WebApplicationContext.class.getName()),
+ EasyMock.eq(ServletApplicationContext.class.getName()),
EasyMock.anyObject());
EasyMock.replay(session);
diff --git a/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java b/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java
index 8a07168ef7..f4cf236a24 100644
--- a/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java
+++ b/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java
@@ -1,6 +1,6 @@
package com.vaadin.tests;
-import com.vaadin.server.WebApplicationContext;
+import com.vaadin.server.ApplicationContext;
import com.vaadin.server.WebBrowser;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Label;
@@ -9,7 +9,7 @@ public class VerifyBrowserVersion extends TestBase {
@Override
protected void setup() {
- WebApplicationContext context = (WebApplicationContext) getContext();
+ ApplicationContext context = getContext();
WebBrowser browser = context.getBrowser();
addComponent(new Label(browser.getBrowserApplication()));
addComponent(new Label("Touch device? "
diff --git a/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java b/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java
index 233da9722e..1f5f0dc691 100644
--- a/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java
+++ b/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java
@@ -1,7 +1,6 @@
package com.vaadin.tests.application;
import com.vaadin.Application;
-import com.vaadin.server.WebApplicationContext;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
@@ -16,8 +15,7 @@ public class ApplicationCloseTest extends TestBase {
protected void setup() {
Label applications = new Label("Applications in session: <br/>",
ContentMode.XHTML);
- for (Application a : ((WebApplicationContext) getContext())
- .getApplications()) {
+ for (Application a : getContext().getApplications()) {
applications.setValue(applications.getValue() + "App: " + a
+ "<br/>");
}
diff --git a/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java b/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java
index 9146cf5dea..96ebe1345f 100644
--- a/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java
+++ b/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java
@@ -1,6 +1,6 @@
package com.vaadin.tests.applicationcontext;
-import com.vaadin.server.WebApplicationContext;
+import com.vaadin.server.ServletApplicationContext;
import com.vaadin.tests.components.AbstractTestCase;
import com.vaadin.tests.util.Log;
import com.vaadin.ui.Button;
@@ -32,7 +32,7 @@ public class ChangeSessionId extends AbstractTestCase {
loginButton.addListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
- WebApplicationContext context = ((WebApplicationContext) getContext());
+ ServletApplicationContext context = ((ServletApplicationContext) getContext());
String oldSessionId = context.getHttpSession().getId();
context.reinitializeSession();
@@ -55,7 +55,7 @@ public class ChangeSessionId extends AbstractTestCase {
}
protected String getSessionId() {
- return ((WebApplicationContext) getContext()).getHttpSession().getId();
+ return ((ServletApplicationContext) getContext()).getHttpSession().getId();
}
@Override
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1975.java b/uitest/src/com/vaadin/tests/tickets/Ticket1975.java
index 9c6dd8c272..e85fe294f2 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket1975.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket1975.java
@@ -5,7 +5,7 @@ import java.io.File;
import java.io.FileInputStream;
import com.vaadin.Application;
-import com.vaadin.server.WebApplicationContext;
+import com.vaadin.server.ServletApplicationContext;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
@@ -33,7 +33,7 @@ public class Ticket1975 extends Application.LegacyApplication {
try {
cl1 = new CustomLayout(new ByteArrayInputStream(s.getBytes()));
layout.addComponent(cl1);
- WebApplicationContext wc = ((WebApplicationContext) getContext());
+ ServletApplicationContext wc = ((ServletApplicationContext) getContext());
layout.addComponent(new Button("Disable/Enable",
new ClickListener() {