blob: 902f5f3a9ecd0369ac2ffb3b3293d23f00744ff7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
/*
@VaadinApache2LicenseForJavaFiles@
*/
package com.vaadin.service;
import java.io.File;
import java.io.Serializable;
import java.net.URL;
import java.util.Collection;
import com.vaadin.Application;
import com.vaadin.terminal.ApplicationResource;
import com.vaadin.terminal.gwt.server.AbstractCommunicationManager;
/**
* <code>ApplicationContext</code> provides information about the running
* context of the application. Each context is shared by all applications that
* are open for one user. In a web-environment this corresponds to a
* HttpSession.
*
* @author Vaadin Ltd.
* @since 3.1
*/
public interface ApplicationContext extends Serializable {
/**
* Returns application context base directory.
*
* Typically an application is deployed in a such way that is has an
* application directory. For web applications this directory is the root
* directory of the web applications. In some cases applications might not
* have an application directory (for example web applications running
* inside a war).
*
* @return The application base directory or null if the application has no
* base directory.
*/
public File getBaseDirectory();
/**
* Returns a collection of all the applications in this context.
*
* Each application context contains all active applications for one user.
*
* @return A collection containing all the applications in this context.
*/
public Collection<Application> getApplications();
/**
* Adds a transaction listener to this context. The transaction listener is
* called before and after each each request related to this session except
* when serving static resources.
*
* The transaction listener must not be null.
*
* @see com.vaadin.service.ApplicationContext#addTransactionListener(com.vaadin.service.ApplicationContext.TransactionListener)
*/
public void addTransactionListener(TransactionListener listener);
/**
* Removes a transaction listener from this context.
*
* @param listener
* the listener to be removed.
* @see TransactionListener
*/
public void removeTransactionListener(TransactionListener listener);
/**
* Generate a URL that can be used as the relative location of e.g. an
* {@link ApplicationResource}.
*
* This method should only be called from the processing of a UIDL request,
* not from a background thread. The return value is null if used outside a
* suitable request.
*
* @deprecated this method is intended for terminal implementation only and
* is subject to change/removal from the interface (to
* {@link AbstractCommunicationManager})
*
* @param resource
* @param urlKey
* a key for the resource that can later be extracted from a URL
* with {@link #getURLKey(URL, String)}
*/
@Deprecated
public String generateApplicationResourceURL(ApplicationResource resource,
String urlKey);
/**
* Tests if a URL is for an application resource (APP/...).
*
* @deprecated this method is intended for terminal implementation only and
* is subject to change/removal from the interface (to
* {@link AbstractCommunicationManager})
*
* @param context
* @param relativeUri
* @return
*/
@Deprecated
public boolean isApplicationResourceURL(URL context, String relativeUri);
/**
* Gets the identifier (key) from an application resource URL. This key is
* the one that was given to
* {@link #generateApplicationResourceURL(ApplicationResource, String)} when
* creating the URL.
*
* @deprecated this method is intended for terminal implementation only and
* is subject to change/removal from the interface (to
* {@link AbstractCommunicationManager})
*
*
* @param context
* @param relativeUri
* @return
*/
@Deprecated
public String getURLKey(URL context, String relativeUri);
/**
* Interface for listening to transaction events. Implement this interface
* to listen to all transactions between the client and the application.
*
*/
public interface TransactionListener extends Serializable {
/**
* Invoked at the beginning of every transaction.
*
* The transaction is linked to the context, not the application so if
* you have multiple applications running in the same context you need
* to check that the request is associated with the application you are
* interested in. This can be done looking at the application parameter.
*
* @param application
* the Application object.
* @param transactionData
* the Data identifying the transaction.
*/
public void transactionStart(Application application,
Object transactionData);
/**
* Invoked at the end of every transaction.
*
* The transaction is linked to the context, not the application so if
* you have multiple applications running in the same context you need
* to check that the request is associated with the application you are
* interested in. This can be done looking at the application parameter.
*
* @param applcation
* the Application object.
* @param transactionData
* the Data identifying the transaction.
*/
public void transactionEnd(Application application,
Object transactionData);
}
}
|