View Javadoc

1   /*
2    * Copyright 2009 Red Hat, Inc.
3    *
4    * Red Hat licenses this file to you under the Apache License, version 2.0
5    * (the "License"); you may not use this file except in compliance with the
6    * License.  You may obtain a copy of the License at:
7    *
8    *    http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package org.jboss.netty.handler.codec.http2;
17  
18  import java.nio.charset.Charset;
19  
20  /**
21   * Interface to enable creation of InterfaceHttpData objects
22   *
23   * @author <a href="http://www.jboss.org/netty/">The Netty Project</a>
24   * @author Andy Taylor (andy.taylor@jboss.org)
25   * @author <a href="http://gleamynode.net/">Trustin Lee</a>
26   * @author <a href="http://openr66.free.fr/">Frederic Bregier</a>
27   *
28   */
29  public interface HttpDataFactory {
30      /**
31      *
32      * @param request associated request
33      * @param name
34      * @return a new Attribute with no value
35      * @throws NullPointerException
36      * @throws IllegalArgumentException
37      */
38     public Attribute createAttribute(HttpRequest request, String name)
39             throws NullPointerException, IllegalArgumentException;
40  
41      /**
42       *
43       * @param request associated request
44       * @param name
45       * @param value
46       * @return a new Attribute
47       * @throws NullPointerException
48       * @throws IllegalArgumentException
49       */
50      public Attribute createAttribute(HttpRequest request, String name, String value)
51              throws NullPointerException, IllegalArgumentException;
52  
53      /**
54       *
55       * @param request associated request
56       * @param name
57       * @param filename
58       * @param contentType
59       * @param charset
60       * @param contentTransferEncoding
61       * @param size the size of the Uploaded file
62       * @return a new FileUpload
63       */
64      public FileUpload createFileUpload(HttpRequest request, String name, String filename,
65              String contentType, String contentTransferEncoding, Charset charset,
66              long size) throws NullPointerException, IllegalArgumentException;
67  
68      /**
69       * Remove the given InterfaceHttpData from clean list (will not delete the file, except if the file
70       * is still a temporary one as setup at construction)
71       * @param request associated request
72       * @param data
73       */
74      public void removeHttpDataFromClean(HttpRequest request, InterfaceHttpData data);
75  
76      /**
77       * Remove all InterfaceHttpData from virtual File storage from clean list for the request
78       * 
79       * @param request associated request
80       */
81      public void cleanRequestHttpDatas(HttpRequest request);
82      
83      /**
84       * Remove all InterfaceHttpData from virtual File storage from clean list for all requests
85       * 
86       */
87      public void cleanAllHttpDatas();
88  }