• 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  * @hide
32  * @deprecated This class was intended to be used by Gears. Since Gears was
33  * deprecated, so is this class.
34  */
35 @Deprecated
36 public final class PluginData {
37     /**
38      * The content stream.
39      */
40     private InputStream mStream;
41     /**
42      * The content length.
43      */
44     private long mContentLength;
45     /**
46      * The associated HTTP response headers stored as a map of
47      * lowercase header name to [ unmodified header name, header value].
48      * TODO: This design was always a hack. Remove (involves updating
49      * the Gears C++ side).
50      */
51     private Map<String, String[]> mHeaders;
52 
53     /**
54      * The associated HTTP response code.
55      */
56     private int mStatusCode;
57 
58     /**
59      * Creates a PluginData instance.
60      *
61      * @param stream The stream that supplies content for the plugin.
62      * @param length The length of the plugin content.
63      * @param headers The response headers. Map of
64      * lowercase header name to [ unmodified header name, header value]
65      * @param length The HTTP response status code.
66      *
67      * @hide
68      * @deprecated This class was intended to be used by Gears. Since Gears was
69      * deprecated, so is this class.
70      */
71     @Deprecated
PluginData( InputStream stream, long length, Map<String, String[]> headers, int code)72     public PluginData(
73             InputStream stream,
74             long length,
75             Map<String, String[]> headers,
76             int code) {
77         mStream = stream;
78         mContentLength = length;
79         mHeaders = headers;
80         mStatusCode = code;
81     }
82 
83     /**
84      * Returns the input stream that contains the plugin content.
85      *
86      * @return An InputStream instance with the plugin content.
87      *
88      * @hide
89      * @deprecated This class was intended to be used by Gears. Since Gears was
90      * deprecated, so is this class.
91      */
92     @Deprecated
getInputStream()93     public InputStream getInputStream() {
94         return mStream;
95     }
96 
97     /**
98      * Returns the length of the plugin content.
99      *
100      * @return the length of the plugin content.
101      *
102      * @hide
103      * @deprecated This class was intended to be used by Gears. Since Gears was
104      * deprecated, so is this class.
105      */
106     @Deprecated
getContentLength()107     public long getContentLength() {
108         return mContentLength;
109     }
110 
111     /**
112      * Returns the HTTP response headers associated with the plugin
113      * content.
114      *
115      * @return A Map<String, String[]> containing all headers. The
116      * mapping is 'lowercase header name' to ['unmodified header
117      * name', header value].
118      *
119      * @hide
120      * @deprecated This class was intended to be used by Gears. Since Gears was
121      * deprecated, so is this class.
122      */
123     @Deprecated
getHeaders()124     public Map<String, String[]> getHeaders() {
125         return mHeaders;
126     }
127 
128     /**
129      * Returns the HTTP status code for the response.
130      *
131      * @return The HTTP statue code, e.g 200.
132      *
133      * @hide
134      * @deprecated This class was intended to be used by Gears. Since Gears was
135      * deprecated, so is this class.
136      */
137     @Deprecated
getStatusCode()138     public int getStatusCode() {
139         return mStatusCode;
140     }
141 }
142