Thu, 31 Aug 2017 15:18:52 +0800
merge
1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 package com.sun.xml.internal.ws.developer;
28 import javax.xml.ws.spi.WebServiceFeatureAnnotation;
29 import java.lang.annotation.*;
30 import java.io.File;
32 /**
33 * This feature represents the use of StreamingAttachment attachments with a
34 * web service.
35 *
36 * <p>
37 * for e.g.: To keep all MIME attachments in memory, do the following
38 *
39 * <pre>
40 * @WebService
41 * @MIME(memoryThreshold=-1L)
42 * public class HelloService {
43 * }
44 * </pre>
45 *
46 * @see StreamingAttachmentFeature
47 *
48 * @author Jitendra Kotamraju
49 */
50 @Retention(RetentionPolicy.RUNTIME)
51 @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
52 @Documented
53 @WebServiceFeatureAnnotation(id = StreamingAttachmentFeature.ID, bean = StreamingAttachmentFeature.class)
54 public @interface StreamingAttachment {
56 /**
57 * Directory in which large attachments are stored. {@link File#createTempFile}
58 * methods are used to create temp files for storing attachments. This
59 * value is used in {@link File#createTempFile}, if specified. If a file
60 * cannot be created in this dir, then all the content is kept in memory.
61 */
62 String dir() default "";
64 /**
65 * MIME message is parsed eagerly.
66 */
67 boolean parseEagerly() default false;
69 /**
70 * After this threshold(no of bytes per attachment), large attachment is
71 * written to file system.
72 *
73 * If the value is -1, then all the attachment content is kept in memory.
74 */
75 long memoryThreshold() default 1048576L;
77 }