01: /* Copyright 2003 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05: package org.jasig.portal;
06:
07: import java.io.IOException;
08: import java.io.InputStream;
09: import java.io.OutputStream;
10: import java.util.Map;
11:
12: /**
13: * Internal adapter for a multithreaded character channel that also implements IMimeResponse (capable of using DonwloadWorker)
14: * @author <a href="mailto:nbolton@unicon.net">Nick Bolton</a>
15: * @version $Revision: 34812 $
16: * @see MultithreadedChannelAdapter
17: */
18: public class MultithreadedMimeResponseCharacterChannelAdapter extends
19: MultithreadedCharacterChannelAdapter implements IMimeResponse {
20: public MultithreadedMimeResponseCharacterChannelAdapter(
21: IMultithreadedCharacterChannel channel, String uid)
22: throws PortalException {
23: super (channel, uid);
24: if (!(channel instanceof IMultithreadedMimeResponse)) {
25: throw (new PortalException(
26: "MultithreadedMimeResponseChannelAdapter: Cannot adapt "
27: + channel.getClass().getName()));
28: }
29: }
30:
31: public String getContentType() {
32: return ((IMultithreadedMimeResponse) channel)
33: .getContentType(uid);
34: }
35:
36: public InputStream getInputStream() throws IOException {
37: return ((IMultithreadedMimeResponse) channel)
38: .getInputStream(uid);
39: }
40:
41: public void downloadData(OutputStream out) throws IOException {
42: ((IMultithreadedMimeResponse) channel).downloadData(out, uid);
43: }
44:
45: public String getName() {
46: return ((IMultithreadedMimeResponse) channel).getName(uid);
47: }
48:
49: public Map getHeaders() {
50: return ((IMultithreadedMimeResponse) channel).getHeaders(uid);
51: }
52:
53: public void reportDownloadError(Exception e) {
54: ((IMultithreadedMimeResponse) channel).reportDownloadError(e);
55: }
56: }
|