1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package org.apache.commons.chain.web.jakarta; 18 19 import java.util.Map; 20 21 import jakarta.servlet.http.Cookie; 22 23 import org.apache.commons.chain.Context; 24 import org.apache.commons.chain.impl.ContextBase; 25 26 /** 27 * Extended {@link Context} that provides web based applications that use 28 * it a "generic" view of HTTP related requests and responses, without 29 * tying the application to a particular underlying Java API (such as 30 * servlets). It is expected that a concrete subclass of {@link WebContext} 31 * for each API (such as 32 * {@code org.apache.commons.chain.web.jakarta.servlet.ServletWebContext}) will 33 * support adapting that particular API's implementation of request and 34 * response objects into this generic framework. 35 * 36 * <p>The characteristics of a web request/response are made visible via 37 * a series of JavaBeans properties (and mapped to read-only attributes 38 * of the same name, as supported by {@link ContextBase}.</p> 39 * 40 * @author Craig R. McClanahan 41 * @version $Revision$ $Date$ 42 */ 43 public abstract class WebContext extends ContextBase { 44 private static final long serialVersionUID = 6804961872140299027L; 45 46 /** 47 * The Default-Constructor for this class. 48 */ 49 public WebContext() { 50 } 51 52 /** 53 * Return a mutable {@code Map} that maps application scope 54 * attribute names to their values. 55 * 56 * @return Application scope Map. 57 */ 58 public abstract Map<String, Object> getApplicationScope(); 59 60 /** 61 * Return an immutable {@code Map} that maps header names to 62 * the first (or only) header value (as a String). Header names must 63 * be matched in a case-insensitive manner. 64 * 65 * @return Header values Map. 66 */ 67 public abstract Map<String, String> getHeader(); 68 69 /** 70 * Return an immutable {@code Map} that maps header names to 71 * the set of all values specified in the request (as a String array). 72 * Header names must be matched in a case-insensitive manner. 73 * 74 * @return Header values Map. 75 */ 76 public abstract Map<String, String[]> getHeaderValues(); 77 78 /** 79 * Return an immutable {@code Map} that maps context application 80 * initialization parameters to their values. 81 * 82 * @return Initialization parameter Map. 83 */ 84 public abstract Map<String, String> getInitParam(); 85 86 /** 87 * Return an immutable {@code Map} that maps request parameter 88 * names to the first (or only) value (as a String). 89 * 90 * @return Request parameter Map. 91 */ 92 public abstract Map<String, String> getParam(); 93 94 /** 95 * Return an immutable {@code Map} that maps request parameter 96 * names to the set of all values (as a String array). 97 * 98 * @return Request parameter Map. 99 */ 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 }