01: /*
02: * Copyright 2005-2007 Noelios Consulting.
03: *
04: * The contents of this file are subject to the terms of the Common Development
05: * and Distribution License (the "License"). You may not use this file except in
06: * compliance with the License.
07: *
08: * You can obtain a copy of the license at
09: * http://www.opensource.org/licenses/cddl1.txt See the License for the specific
10: * language governing permissions and limitations under the License.
11: *
12: * When distributing Covered Code, include this CDDL HEADER in each file and
13: * include the License file at http://www.opensource.org/licenses/cddl1.txt If
14: * applicable, add the following below this CDDL HEADER, with the fields
15: * enclosed by brackets "[]" replaced with your own identifying information:
16: * Portions Copyright [yyyy] [name of copyright owner]
17: */
18:
19: package com.noelios.restlet.ext.simple;
20:
21: import java.io.IOException;
22: import java.net.Socket;
23:
24: import simple.http.BufferedPipelineFactory;
25: import simple.http.Pipeline;
26:
27: /**
28: * A subclass of BufferedPipelineFactory that sets the connection socket on each
29: * pipeline for later retrieval.
30: *
31: * @author Jerome Louvel (contact@noelios.com)
32: */
33: public class SimplePipelineFactory extends BufferedPipelineFactory {
34: public static final String PROPERTY_SOCKET = "org.restlet.ext.simple.socket";
35:
36: /**
37: * Constructor.
38: */
39: public SimplePipelineFactory() {
40: super ();
41: }
42:
43: /**
44: * Constructor.
45: *
46: * @param size
47: * The size of the output buffer used
48: */
49: public SimplePipelineFactory(int size) {
50: super (size);
51: }
52:
53: @Override
54: public Pipeline getInstance(Socket sock) throws IOException {
55: Pipeline result = super.getInstance(sock);
56: result.put(PROPERTY_SOCKET, sock);
57: return result;
58: }
59: }
|