01: /*
02: * Copyright 2005 Joe Walker
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: package org.directwebremoting.impl;
17:
18: import org.directwebremoting.extend.FileGenerator;
19:
20: /**
21: * A helper to aid implementing {@link FileGenerator} that takes care of the
22: * filename and mimeType fields
23: * @author Joe Walker [joe at getahead dot ltd dot uk]
24: */
25: public abstract class AbstractFileGenerator implements FileGenerator {
26: /**
27: * Setup the filename and mimeType
28: */
29: public AbstractFileGenerator(String filename, String mimeType) {
30: this .filename = filename;
31: this .mimeType = mimeType;
32: }
33:
34: /* (non-Javadoc)
35: * @see org.directwebremoting.extend.FileGenerator#getFilename()
36: */
37: public String getFilename() {
38: return filename;
39: }
40:
41: /* (non-Javadoc)
42: * @see org.directwebremoting.extend.FileGenerator#getMimeType()
43: */
44: public String getMimeType() {
45: return mimeType;
46: }
47:
48: /**
49: * Sometimes the filename is user visible when downloading
50: */
51: private String filename;
52:
53: /**
54: * The mime type in case the browser needs to do something with the file
55: */
56: private String mimeType;
57: }
|