1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 package org.apache.mina.session; 21 22 import org.apache.mina.api.IoFuture; 23 24 /** 25 * The write request created by the {@link org.apache.mina.api.IoSession#write} method, 26 * which is transmitted through the filter chain and finish as a socket write.<br/> 27 * 28 * We store the original message into this data structure, along the associated potentially 29 * modified message if the original message gets encoded during the process.<br/> 30 * 31 * Note that when we always ends with the message being a ByteBuffer when we reach 32 * the socket.<br/> 33 * 34 * We also keep a Future into this data structure to inform the caller about the write 35 * completion. 36 * 37 * @author <a href="http://mina.apache.org">Apache MINA Project</a> 38 */ 39 public interface WriteRequest { 40 /** 41 * Get the message stored for this request. 42 * 43 * @return the contained message 44 */ 45 Object getMessage(); 46 47 /** 48 * Store the encoded message 49 * 50 * @param The encoded message 51 */ 52 void setMessage(Object message); 53 54 /** 55 * Gets the original message, as written by the handler, before passing through the filter chain. 56 * 57 * @return The original message 58 */ 59 Object getOriginalMessage(); 60 61 /** 62 * The future to be completed on a write success 63 * @return the future 64 */ 65 IoFuture<Void> getFuture(); 66 67 /** 68 * Store the future into the request 69 * @param the future 70 */ 71 void setFuture(IoFuture<Void> future); 72 }