001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *  http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    
020    
021    package javax.servlet;
022    
023    /**
024     * @version $Rev: 882070 $ $Date: 2009-11-19 03:13:31 -0500 (Thu, 19 Nov 2009) $
025     * @since 3.0
026     */
027    public class AsyncEvent {
028    
029        private final AsyncContext context;
030        private final ServletRequest request;
031        private final ServletResponse response;
032        private final Throwable throwable;
033    
034        public AsyncEvent(AsyncContext context) {
035            this.context = context;
036            this.request = null;
037            this.response = null;
038            this.throwable = null;
039        }
040    
041        public AsyncEvent(AsyncContext context, ServletRequest request, ServletResponse response) {
042            this.context = context;
043            this.request = request;
044            this.response = response;
045            this.throwable = null;
046        }
047    
048    
049        public AsyncEvent(AsyncContext context, ServletRequest request, ServletResponse response, Throwable throwable) {
050            this.context = context;
051            this.request = request;
052            this.response = response;
053            this.throwable = throwable;
054        }
055    
056        public AsyncEvent(AsyncContext context, Throwable throwable) {
057            this.context = context;
058            this.request = null;
059            this.response = null;
060            this.throwable = throwable;
061        }
062    
063        public AsyncContext getAsyncContext() {
064            return context;
065        }
066    
067        public ServletRequest getSuppliedRequest() {
068            return request;
069        }
070    
071        public ServletResponse getSuppliedResponse() {
072            return response;
073        }
074    
075        public Throwable getThrowable() {
076            return throwable;
077        }
078    }