Examples of FormDataBodyPart


Examples of org.glassfish.jersey.media.multipart.FormDataBodyPart

                BodyPart bp;
                if (logger.isLoggable(Level.FINEST)) {
                    logger.log(Level.FINEST, "addToMultipart[{0}]: name: {1}, type: {2}", new Object[]{index, part.getName(), mt});
                }
                if (client2Server) {
                    bp = new FormDataBodyPart(part.getName(), part, mt);
                } else {
                    bp = new BodyPart(part, mt);
                    ContentDisposition cd = ContentDisposition.type("file").fileName(part.getName()).build();
                    if (logger.isLoggable(Level.FINEST)) {
                        logger.log(Level.FINEST, "addToMultipart[{0}]: Content Disposition: {1}", new Object[]{index, cd});
View Full Code Here

Examples of org.glassfish.jersey.media.multipart.FormDataBodyPart

        @Override
        protected FormDataContentDisposition get(HttpContext context) {
            FormDataMultiPart formDataMultiPart = getEntity(context);

            FormDataBodyPart formDataBodyPart = formDataMultiPart.getField(name);
            if (formDataBodyPart == null) {
                return null;
            }

            return formDataMultiPart.getField(name).getFormDataContentDisposition();
View Full Code Here

Examples of org.glassfish.jersey.media.multipart.FormDataBodyPart

        protected Object get(HttpContext context) {
            // Return the field value for the field specified by the sourceName property.
            final FormDataMultiPart formDataMultiPart = getEntity(context);

            List<FormDataBodyPart> formDataBodyParts = formDataMultiPart.getFields(parameter.getSourceName());
            FormDataBodyPart formDataBodyPart = (formDataBodyParts != null) ? formDataBodyParts.get(0) : null;

            MediaType mediaType = (formDataBodyPart != null) ? formDataBodyPart.getMediaType() : MediaType.TEXT_PLAIN_TYPE;

            MessageBodyWorkers messageBodyWorkers = context.getRequestContext().getWorkers();

            MessageBodyReader reader = messageBodyWorkers.getMessageBodyReader(
                    parameter.getRawType(),
                    parameter.getType(),
                    parameter.getAnnotations(),
                    mediaType);

            if (reader != null && !isPrimitiveType(parameter.getRawType())) {
                InputStream in;
                if (formDataBodyPart == null) {
                    if (parameter.getDefaultValue() != null) {
                        // Convert default value to bytes.
                        in = new ByteArrayInputStream(parameter.getDefaultValue().getBytes());
                    } else {
                        return null;
                    }
                } else {
                    in = ((BodyPartEntity) formDataBodyPart.getEntity()).getInputStream();
                }


                try {
                    //noinspection unchecked
View Full Code Here

Examples of org.glassfish.jersey.media.multipart.FormDataBodyPart

            String userAgent = headers.getFirst(HttpHeaders.USER_AGENT);
            fileNameFix = userAgent != null && userAgent.contains(" MSIE ");
        }

        for (MIMEPart mimePart : mimeMessage.getAttachments()) {
            BodyPart bodyPart = formData ? new FormDataBodyPart(fileNameFix) : new BodyPart();

            // Configure providers.
            bodyPart.setMessageBodyWorkers(workers);

            // Copy headers.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.