• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2009 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * 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,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.webkit;
18 
19 import java.io.InputStream;
20 import java.util.Map;
21 
22 /**
23  * This class encapsulates the content generated by a plugin.  The
24  * data itself is meant to be loaded into webkit via the
25  * PluginContentLoader class, which needs to be able to construct an
26  * HTTP response. For this, it needs a stream with the response body,
27  * the length of the body, the response headers, and the response
28  * status code. The PluginData class is the container for all these
29  * parts.
30  *
31  * @deprecated This class was intended to be used by Gears. Since Gears was
32  * deprecated, so is this class.
33  */
34 @Deprecated
35 public final class PluginData {
36     /**
37      * The content stream.
38      */
39     private InputStream mStream;
40     /**
41      * The content length.
42      */
43     private long mContentLength;
44     /**
45      * The associated HTTP response headers stored as a map of
46      * lowercase header name to [ unmodified header name, header value].
47      * TODO: This design was always a hack. Remove (involves updating
48      * the Gears C++ side).
49      */
50     private Map<String, String[]> mHeaders;
51 
52     /**
53      * The associated HTTP response code.
54      */
55     private int mStatusCode;
56 
57     /**
58      * Creates a PluginData instance.
59      *
60      * @param stream The stream that supplies content for the plugin.
61      * @param length The length of the plugin content.
62      * @param headers The response headers. Map of
63      * lowercase header name to [ unmodified header name, header value]
64      * @param length The HTTP response status code.
65      *
66      * @deprecated This class was intended to be used by Gears. Since Gears was
67      * deprecated, so is this class.
68      */
69     @Deprecated
PluginData( InputStream stream, long length, Map<String, String[]> headers, int code)70     public PluginData(
71             InputStream stream,
72             long length,
73             Map<String, String[]> headers,
74             int code) {
75         mStream = stream;
76         mContentLength = length;
77         mHeaders = headers;
78         mStatusCode = code;
79     }
80 
81     /**
82      * Returns the input stream that contains the plugin content.
83      *
84      * @return An InputStream instance with the plugin content.
85      *
86      * @deprecated This class was intended to be used by Gears. Since Gears was
87      * deprecated, so is this class.
88      */
89     @Deprecated
getInputStream()90     public InputStream getInputStream() {
91         return mStream;
92     }
93 
94     /**
95      * Returns the length of the plugin content.
96      *
97      * @return the length of the plugin content.
98      *
99      * @deprecated This class was intended to be used by Gears. Since Gears was
100      * deprecated, so is this class.
101      */
102     @Deprecated
getContentLength()103     public long getContentLength() {
104         return mContentLength;
105     }
106 
107     /**
108      * Returns the HTTP response headers associated with the plugin
109      * content.
110      *
111      * @return A Map<String, String[]> containing all headers. The
112      * mapping is 'lowercase header name' to ['unmodified header
113      * name', header value].
114      *
115      * @deprecated This class was intended to be used by Gears. Since Gears was
116      * deprecated, so is this class.
117      */
118     @Deprecated
getHeaders()119     public Map<String, String[]> getHeaders() {
120         return mHeaders;
121     }
122 
123     /**
124      * Returns the HTTP status code for the response.
125      *
126      * @return The HTTP statue code, e.g 200.
127      *
128      * @deprecated This class was intended to be used by Gears. Since Gears was
129      * deprecated, so is this class.
130      */
131     @Deprecated
getStatusCode()132     public int getStatusCode() {
133         return mStatusCode;
134     }
135 }
136