org.apache.tiles.request.Request Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tiles-request-api Show documentation
Show all versions of tiles-request-api Show documentation
API for the Tiles Request framework.
/*
* $Id: Request.java 1332134 2012-04-30 09:23:19Z mck $
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.tiles.request;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.tiles.request.attribute.Addable;
/**
* Encapsulation of request information.
*
* @version $Rev: 1332134 $ $Date: 2012-04-30 05:23:19 -0400 (Mon, 30 Apr 2012) $
*/
public interface Request {
/**
* Return an immutable Map that maps header names to the first (or only)
* header value (as a String).
*
* @return The header map.
*/
Map getHeader();
/**
* Return an immutable Map that maps header names to the set of all values
* specified in the request (as a String array). Header names must be
* matched in a case-insensitive manner.
*
* @return The header values map.
*/
Map getHeaderValues();
/**
* Return an Addable object that can be used to write headers to the response.
*
* @return An Addable object.
*/
Addable getResponseHeaders();
/**
* Returns a context map, given the scope name.
*
* @param scope The name of the scope.
* @return The context.
*/
Map getContext(String scope);
/**
* Returns all available scopes, that are the ones returned by
* {@link #getNativeScopes()} plus derivative scopes (e.g. flash scope).
*
* @return All the available scopes.
*/
List getAvailableScopes();
/**
* Returns the associated application context.
*
* @return The application context associated to this request.
*/
ApplicationContext getApplicationContext();
/**
* Returns an output stream to be used to write directly in the response.
*
* @return The output stream that writes in the response.
* @throws IOException If something goes wrong when getting the output stream.
*/
OutputStream getOutputStream() throws IOException;
/**
* Returns a writer to be used to write directly in the response.
*
* @return The writer that writes in the response.
* @throws IOException If something goes wrong when getting the writer.
*/
Writer getWriter() throws IOException;
/**
* Returns a print writer to be used to write directly in the response.
*
* @return The print writer that writes in the response.
* @throws IOException If something goes wrong when getting the print
* writer.
*/
PrintWriter getPrintWriter() throws IOException;
/**
* Checks if the response has been committed.
*
* @return true
only if the response has been committed.
*/
boolean isResponseCommitted();
/**
* Return an immutable Map that maps request parameter names to the first
* (or only) value (as a String).
*
* @return The parameter map.
*/
Map getParam();
/**
* Return an immutable Map that maps request parameter names to the set of
* all values (as a String array).
*
* @return The parameter values map.
*/
Map getParamValues();
/**
* Return the preferred Locale in which the client will accept content.
*
* @return The current request locale. It is the locale of the request
* object itself and it is NOT the locale that the user wants to use. See
* {@link org.apache.tiles.locale.LocaleResolver} to implement strategies to
* resolve locales.
*/
Locale getRequestLocale();
/**
* Determine whether or not the specified user is in the given role.
* @param role the role to check against.
* @return true
if the user is in the given role.
*/
boolean isUserInRole(String role);
}