KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > nextapp > echo2 > webcontainer > ContainerContext


1 /*
2  * This file is part of the Echo Web Application Framework (hereinafter "Echo").
3  * Copyright (C) 2002-2005 NextApp, Inc.
4  *
5  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * Alternatively, the contents of this file may be used under the terms of
18  * either the GNU General Public License Version 2 or later (the "GPL"), or
19  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
20  * in which case the provisions of the GPL or the LGPL are applicable instead
21  * of those above. If you wish to allow use of your version of this file only
22  * under the terms of either the GPL or the LGPL, and not to allow others to
23  * use your version of this file under the terms of the MPL, indicate your
24  * decision by deleting the provisions above and replace them with the notice
25  * and other provisions required by the GPL or the LGPL. If you do not delete
26  * the provisions above, a recipient may use your version of this file under
27  * the terms of any one of the MPL, the GPL or the LGPL.
28  */

29
30 package nextapp.echo2.webcontainer;
31
32 import java.security.Principal JavaDoc;
33 import java.util.Map JavaDoc;
34
35 import javax.servlet.http.Cookie JavaDoc;
36 import javax.servlet.http.HttpSession JavaDoc;
37
38 import nextapp.echo2.app.TaskQueueHandle;
39 import nextapp.echo2.webrender.ClientConfiguration;
40 import nextapp.echo2.webrender.ClientProperties;
41 import nextapp.echo2.webrender.ServerDelayMessage;
42 import nextapp.echo2.webrender.Service;
43
44 /**
45  * Contextual information about the application container provided to an
46  * application instance. The <code>ContainerContext</code> will be stored
47  * as a context property of an application's <code>ApplicationInstance</code>,
48  * under the key constant <code>CONTEXT_PROPERTY_NAME</code>.
49  *
50  * This interface should not be implemented outside of the core
51  * framework.
52  */

53 public interface ContainerContext {
54     
55     /**
56      * Property name by which a <code>ContainerContext</code> may be retrieved
57      * from an <code>ApplicationInstance</code>'s context properties.
58      *
59      * @see nextapp.echo2.app.ApplicationInstance#getContextProperty(java.lang.String)
60      */

61     public static final String JavaDoc CONTEXT_PROPERTY_NAME = ContainerContext.class.getName();
62
63     /**
64      * Returns the <code>ClientProperties</code> describing the user's
65      * client web browser environment.
66      *
67      * @return the <code>ClientProperties</code>
68      */

69     public ClientProperties getClientProperties();
70     
71     /**
72      * Return any <code>Cookie</code>s sent on the current HTTP request.
73      *
74      * @return the <code>Cookie</code>s
75      */

76     public Cookie JavaDoc[] getCookies();
77     
78     /**
79      * Returns an immutable <code>Map</code> containing the HTTP request
80      * parameters sent on the initial request to the application.
81      *
82      * @return the initial request parameter map
83      */

84     public Map JavaDoc getInitialRequestParameterMap();
85     
86     /**
87      * Returns the URI of the specified <code>Service</code>.
88      *
89      * @param service the <code>Service</code>
90      * @return the URI
91      */

92     public String JavaDoc getServiceUri(Service service);
93     
94     /**
95      * Returns the URI of the Echo2 servlet.
96      *
97      * @return the servlet URI
98      */

99     public String JavaDoc getServletUri();
100     
101     /**
102      * Returns the <code>HttpSession</code> in which the application is
103      * being stored.
104      *
105      * @return the <code>HttpSession</code>
106      */

107     public HttpSession JavaDoc getSession();
108     
109     /**
110      * Returns the authenticated user <code>Principal</code>.
111      *
112      * @return the authenticated user <code>Principal</code>
113      */

114     public Principal JavaDoc getUserPrincipal();
115     
116     /**
117      * Determines if the authenticated user is in the specified logical "role",
118      * by querying the inbound servlet request.
119      */

120     public boolean isUserInRole(String JavaDoc role);
121
122     /**
123      * Sets the <code>ClientConfiguration</code> describing
124      * application-specific client configuration settings.
125      *
126      * @param clientConfiguration the new <code>ClientConfiguration</code>
127      */

128     public void setClientConfiguration(ClientConfiguration clientConfiguration);
129     
130     /**
131      * Sets the <code>ServerDelayMessage</code> displayed during
132      * client/server-interactions.
133      *
134      * @param serverDelayMessage the new <code>ServerDelayMessage</code>
135      */

136     public void setServerDelayMessage(ServerDelayMessage serverDelayMessage);
137     
138     /**
139      * Sets the interval between asynchronous callbacks from the client to check
140      * for queued tasks for a given <code>TaskQueue</code>. If multiple
141      * <code>TaskQueue</code>s are active, the smallest specified interval should
142      * be used. The default interval is 500ms.
143      *
144      * @param taskQueue the <code>TaskQueue</code>
145      * @param ms the number of milliseconds between asynchronous client
146      * callbacks
147      */

148     public void setTaskQueueCallbackInterval(TaskQueueHandle taskQueue, int ms);
149 }
150
Popular Tags