001: /*
002: * This file is part of the Echo Web Application Framework (hereinafter "Echo").
003: * Copyright (C) 2002-2005 NextApp, Inc.
004: *
005: * Version: MPL 1.1/GPL 2.0/LGPL 2.1
006: *
007: * The contents of this file are subject to the Mozilla Public License Version
008: * 1.1 (the "License"); you may not use this file except in compliance with
009: * the License. You may obtain a copy of the License at
010: * http://www.mozilla.org/MPL/
011: *
012: * Software distributed under the License is distributed on an "AS IS" basis,
013: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
014: * for the specific language governing rights and limitations under the
015: * License.
016: *
017: * Alternatively, the contents of this file may be used under the terms of
018: * either the GNU General Public License Version 2 or later (the "GPL"), or
019: * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
020: * in which case the provisions of the GPL or the LGPL are applicable instead
021: * of those above. If you wish to allow use of your version of this file only
022: * under the terms of either the GPL or the LGPL, and not to allow others to
023: * use your version of this file under the terms of the MPL, indicate your
024: * decision by deleting the provisions above and replace them with the notice
025: * and other provisions required by the GPL or the LGPL. If you do not delete
026: * the provisions above, a recipient may use your version of this file under
027: * the terms of any one of the MPL, the GPL or the LGPL.
028: */
029:
030: package nextapp.echo2.webcontainer;
031:
032: import java.security.Principal;
033: import java.util.Map;
034:
035: import javax.servlet.http.Cookie;
036: import javax.servlet.http.HttpSession;
037:
038: import nextapp.echo2.app.TaskQueueHandle;
039: import nextapp.echo2.webrender.ClientConfiguration;
040: import nextapp.echo2.webrender.ClientProperties;
041: import nextapp.echo2.webrender.ServerDelayMessage;
042: import nextapp.echo2.webrender.Service;
043:
044: /**
045: * Contextual information about the application container provided to an
046: * application instance. The <code>ContainerContext</code> will be stored
047: * as a context property of an application's <code>ApplicationInstance</code>,
048: * under the key constant <code>CONTEXT_PROPERTY_NAME</code>.
049: *
050: * This interface should not be implemented outside of the core
051: * framework.
052: */
053: public interface ContainerContext {
054:
055: /**
056: * Property name by which a <code>ContainerContext</code> may be retrieved
057: * from an <code>ApplicationInstance</code>'s context properties.
058: *
059: * @see nextapp.echo2.app.ApplicationInstance#getContextProperty(java.lang.String)
060: */
061: public static final String CONTEXT_PROPERTY_NAME = ContainerContext.class
062: .getName();
063:
064: /**
065: * Returns the <code>ClientProperties</code> describing the user's
066: * client web browser environment.
067: *
068: * @return the <code>ClientProperties</code>
069: */
070: public ClientProperties getClientProperties();
071:
072: /**
073: * Return any <code>Cookie</code>s sent on the current HTTP request.
074: *
075: * @return the <code>Cookie</code>s
076: */
077: public Cookie[] getCookies();
078:
079: /**
080: * Returns an immutable <code>Map</code> containing the HTTP request
081: * parameters sent on the initial request to the application.
082: *
083: * @return the initial request parameter map
084: */
085: public Map getInitialRequestParameterMap();
086:
087: /**
088: * Returns the URI of the specified <code>Service</code>.
089: *
090: * @param service the <code>Service</code>
091: * @return the URI
092: */
093: public String getServiceUri(Service service);
094:
095: /**
096: * Returns the URI of the Echo2 servlet.
097: *
098: * @return the servlet URI
099: */
100: public String getServletUri();
101:
102: /**
103: * Returns the <code>HttpSession</code> in which the application is
104: * being stored.
105: *
106: * @return the <code>HttpSession</code>
107: */
108: public HttpSession getSession();
109:
110: /**
111: * Returns the authenticated user <code>Principal</code>.
112: *
113: * @return the authenticated user <code>Principal</code>
114: */
115: public Principal getUserPrincipal();
116:
117: /**
118: * Determines if the authenticated user is in the specified logical "role",
119: * by querying the inbound servlet request.
120: */
121: public boolean isUserInRole(String role);
122:
123: /**
124: * Sets the <code>ClientConfiguration</code> describing
125: * application-specific client configuration settings.
126: *
127: * @param clientConfiguration the new <code>ClientConfiguration</code>
128: */
129: public void setClientConfiguration(
130: ClientConfiguration clientConfiguration);
131:
132: /**
133: * Sets the <code>ServerDelayMessage</code> displayed during
134: * client/server-interactions.
135: *
136: * @param serverDelayMessage the new <code>ServerDelayMessage</code>
137: */
138: public void setServerDelayMessage(
139: ServerDelayMessage serverDelayMessage);
140:
141: /**
142: * Sets the interval between asynchronous callbacks from the client to check
143: * for queued tasks for a given <code>TaskQueue</code>. If multiple
144: * <code>TaskQueue</code>s are active, the smallest specified interval should
145: * be used. The default interval is 500ms.
146: *
147: * @param taskQueue the <code>TaskQueue</code>
148: * @param ms the number of milliseconds between asynchronous client
149: * callbacks
150: */
151: public void setTaskQueueCallbackInterval(TaskQueueHandle taskQueue,
152: int ms);
153: }
|