001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.commons.chain.web.javax; 018 019import java.util.Map; 020 021import javax.servlet.http.Cookie; 022 023import org.apache.commons.chain.Context; 024import org.apache.commons.chain.impl.ContextBase; 025 026/** 027 * Extended {@link Context} that provides web based applications that use 028 * it a "generic" view of HTTP related requests and responses, without 029 * tying the application to a particular underlying Java API (such as 030 * servlets). It is expected that a concrete subclass of {@link WebContext} 031 * for each API (such as 032 * {@code org.apache.commons.chain.web.javax.servlet.ServletWebContext}) will 033 * support adapting that particular API's implementation of request and 034 * response objects into this generic framework. 035 * 036 * <p>The characteristics of a web request/response are made visible via 037 * a series of JavaBeans properties (and mapped to read-only attributes 038 * of the same name, as supported by {@link ContextBase}.</p> 039 * 040 * @author Craig R. McClanahan 041 * @version $Revision$ $Date$ 042 */ 043public abstract class WebContext extends ContextBase { 044 private static final long serialVersionUID = 6804961872140299027L; 045 046 /** 047 * The Default-Constructor for this class. 048 */ 049 public WebContext() { 050 } 051 052 /** 053 * Return a mutable {@code Map} that maps application scope 054 * attribute names to their values. 055 * 056 * @return Application scope Map. 057 */ 058 public abstract Map<String, Object> getApplicationScope(); 059 060 /** 061 * Return an immutable {@code Map} that maps header names to 062 * the first (or only) header value (as a String). Header names must 063 * be matched in a case-insensitive manner. 064 * 065 * @return Header values Map. 066 */ 067 public abstract Map<String, String> getHeader(); 068 069 /** 070 * Return an immutable {@code Map} that maps header names to 071 * the set of all values specified in the request (as a String array). 072 * Header names must be matched in a case-insensitive manner. 073 * 074 * @return Header values Map. 075 */ 076 public abstract Map<String, String[]> getHeaderValues(); 077 078 /** 079 * Return an immutable {@code Map} that maps context application 080 * initialization parameters to their values. 081 * 082 * @return Initialization parameter Map. 083 */ 084 public abstract Map<String, String> getInitParam(); 085 086 /** 087 * Return an immutable {@code Map} that maps request parameter 088 * names to the first (or only) value (as a String). 089 * 090 * @return Request parameter Map. 091 */ 092 public abstract Map<String, String> getParam(); 093 094 /** 095 * Return an immutable {@code Map} that maps request parameter 096 * names to the set of all values (as a String array). 097 * 098 * @return Request parameter Map. 099 */ 100 public abstract Map<String, String[]> getParamValues(); 101 102 /** 103 * Return an immutable {@code Map} that maps cookie names to 104 * the set of cookies specified in the request. 105 * 106 * @return Map of Cookies. 107 * 108 * @since Chain 1.1 109 */ 110 public abstract Map<String, Cookie> getCookies(); 111 112 /** 113 * Return a mutable {@code Map} that maps request scope 114 * attribute names to their values. 115 * 116 * @return Request scope Map. 117 */ 118 public abstract Map<String, Object> getRequestScope(); 119 120 /** 121 * Return a mutable {@code Map} that maps session scope 122 * attribute names to their values. 123 * 124 * @return Session scope Map. 125 */ 126 public abstract Map<String, Object> getSessionScope(); 127}