Package org.apache.abdera.protocol.server.multipart

Examples of org.apache.abdera.protocol.server.multipart.MultipartInputStream


            RequestContext request, InputStream requestData)
            throws IOException, ParseException, MessagingException {

        // NOTE: because request.getInputStream() has already been read
        // we pass in a seperate input stream containing the request data
        MultipartInputStream stream = getMultipartStream(request, requestData);
        List<MultipartRelatedPost> result = new LinkedList<MultipartRelatedPost>();
        stream.skipBoundary();

        String start = request.getContentType().getParameter(START_PARAM);

        Document<Source> source = null;
        Map<String, String> entryHeaders = new HashMap<String, String>();
        InputStream data = null;
        Map<String, String> dataHeaders = new HashMap<String, String>();

        Map<String, String> headers = getHeaders(stream);

        // first part is required to be the feed or entry
        if (start == null
                || start.length() == 0
                || (headers.containsKey(CONTENT_ID_HEADER) && start
                        .equals(headers.get(CONTENT_ID_HEADER)))
                || (headers.containsKey(CONTENT_TYPE_HEADER) && MimeTypeHelper
                        .isAtom(headers.get(CONTENT_TYPE_HEADER)))) {
            source = getEntry(stream, request);
            entryHeaders.putAll(headers);
        } else {
            throw new ParseException("First part was not a feed or entry: "
                    + headers);
            // data = getDataInputStream(multipart);
            // dataHeaders.putAll(headers);
        }

        try {
            while (stream.available() > 0) {
                stream.skipBoundary();
                headers = getHeaders(stream);
                if (start != null
                        && (headers.containsKey(CONTENT_ID_HEADER) && start
                                .equals(headers.get(CONTENT_ID_HEADER)))
                        && (headers.containsKey(CONTENT_TYPE_HEADER) && MimeTypeHelper
View Full Code Here


        PushbackInputStream pushBackInput = new PushbackInputStream(
                inputStream, 2);
        pushBackInput.unread("\r\n".getBytes());

        return new MultipartInputStream(pushBackInput, boundary.getBytes());
    }
View Full Code Here

TOP

Related Classes of org.apache.abdera.protocol.server.multipart.MultipartInputStream

Copyright © 2018 www.massapicom. 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.