1/*2 * $Id: TilesRequestContext.java 527536 2007-04-11 15:44:51Z apetrelli $3 *4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */21package org.apache.tiles.context;
2223import java.io.IOException;
24import java.util.Locale;
25import java.util.Map;
2627/***28 * Encapsulation of request information.29 *30 * @since 2.031 * @version $Rev: 527536 $ $Date: 2007-04-11 17:44:51 +0200 (Wed, 11 Apr 2007) $32 */33publicinterfaceTilesRequestContext {
3435/***36 * Return an immutable Map that maps header names to the first (or only)37 * header value (as a String).38 *39 * @return The header map.40 */41 Map<String, String> getHeader();
4243/***44 * Return an immutable Map that maps header names to the set of all values45 * specified in the request (as a String array). Header names must be46 * matched in a case-insensitive manner.47 *48 * @return The header values map.49 */50 Map<String, String[]> getHeaderValues();
5152/***53 * Return a mutable Map that maps request scope attribute names to their54 * values.55 *56 * @return The request scope map.57 */58 Map<String, Object> getRequestScope();
5960/***61 * Return a mutable Map that maps session scope attribute names to their62 * values.63 *64 * @return The request scope map.65 */66 Map<String, Object> getSessionScope();
6768/***69 * Dispatches the request to a specified path.70 *71 * @param path The path to dispatch to.72 * @throws IOException If something goes wrong during dispatching.73 */74void dispatch(String path) throws IOException;
7576/***77 * Includes the response from the specified URL in the current response output.78 *79 * @param path The path to include.80 * @throws IOException If something goes wrong during inclusion.81 */82void include(String path) throws IOException;
8384/***85 * Return an immutable Map that maps request parameter names to the first86 * (or only) value (as a String).87 *88 * @return The parameter map.89 */90 Map<String, String> getParam();
9192/***93 * Return an immutable Map that maps request parameter names to the set of94 * all values (as a String array).95 *96 * @return The parameter values map.97 */98 Map<String, String[]> getParamValues();
99100/***101 * Return the preferred Locale in which the client will accept content.102 *103 * @return The current request locale. It is the locale of the request104 * object itself and it is NOT the locale that the user wants to use. See105 * {@link org.apache.tiles.locale.LocaleResolver} to implement strategies to106 * resolve locales.107 */108 Locale getRequestLocale();
109110/***111 * Determine whether or not the specified user is in the given role.112 * @param role the role to check against.113 * @return <code>true</code> if the user is in the given role.114 */115boolean isUserInRole(String role);
116117/***118 * Get the underlying request.119 *120 * @return The current request object.121 */122 Object getRequest();
123124/***125 * Get the underlying response.126 *127 * @return The current request object.128 */129 Object getResponse();
130 }