Package io.undertow.server.handlers.form

Examples of io.undertow.server.handlers.form.FormData


        for (Map.Entry<String, Deque<String>> entry : queryParameters.entrySet()) {
            arrayMap.put(entry.getKey(), new ArrayList<String>(entry.getValue()));
        }
        if (exchange.getRequestMethod().equals(Methods.POST)) {

            final FormData parsedFormData = parseFormData();
            if (parsedFormData != null) {
                Iterator<String> it = parsedFormData.iterator();
                while (it.hasNext()) {
                    final String name = it.next();
                    Deque<FormData.FormValue> val = parsedFormData.get(name);
                    if (arrayMap.containsKey(name)) {
                        ArrayList<String> existing = arrayMap.get(name);
                        for (final FormData.FormValue v : val) {
                            if(!v.isFile()) {
                                existing.add(v.getValue());
View Full Code Here


            String mimeType = exchange.getRequestHeaders().getFirst(Headers.CONTENT_TYPE);
            if (mimeType != null && mimeType.startsWith(MultiPartParserDefinition.MULTIPART_FORM_DATA)) {
                final ManagedServlet originalServlet = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY).getOriginalServletPathMatch().getServletChain().getManagedServlet();
                final FormDataParser parser = originalServlet.getFormParserFactory().createParser(exchange);
                if(parser != null) {
                    final FormData value = parser.parseBlocking();
                    for (final String namedPart : value) {
                        for (FormData.FormValue part : value.get(namedPart)) {
                            parts.add(new PartImpl(namedPart, part, requestContext.getOriginalServletPathMatch().getServletChain().getManagedServlet().getServletInfo().getMultipartConfig(), servletContext));
                        }
                    }
                }
            } else {
View Full Code Here

            queryParameters = exchange.getQueryParameters();
        }
        Deque<String> params = queryParameters.get(name);
        if (params == null) {
            if (exchange.getRequestMethod().equals(Methods.POST)) {
                final FormData parsedFormData = parseFormData();
                if (parsedFormData != null) {
                    FormData.FormValue res = parsedFormData.getFirst(name);
                    if (res == null || res.isFile()) {
                        return null;
                    } else {
                        return res.getValue();
                    }
View Full Code Here

        if (queryParameters == null) {
            queryParameters = exchange.getQueryParameters();
        }
        final Set<String> parameterNames = new HashSet<String>(queryParameters.keySet());
        if (exchange.getRequestMethod().equals(Methods.POST)) {
            final FormData parsedFormData = parseFormData();
            if (parsedFormData != null) {
                Iterator<String> it = parsedFormData.iterator();
                while (it.hasNext()) {
                    String name = it.next();
                    for(FormData.FormValue param : parsedFormData.get(name)) {
                        if(!param.isFile()) {
                            parameterNames.add(name);
                            break;
                        }
                    }
View Full Code Here

            for (String param : params) {
                ret.add(param);
            }
        }
        if (exchange.getRequestMethod().equals(Methods.POST)) {
            final FormData parsedFormData = parseFormData();
            if (parsedFormData != null) {
                Deque<FormData.FormValue> res = parsedFormData.get(name);
                if (res != null) {
                    for (FormData.FormValue value : res) {
                        if(!value.isFile()) {
                            ret.add(value.getValue());
                        }
View Full Code Here

        for (Map.Entry<String, Deque<String>> entry : queryParameters.entrySet()) {
            arrayMap.put(entry.getKey(), new ArrayList<String>(entry.getValue()));
        }
        if (exchange.getRequestMethod().equals(Methods.POST)) {

            final FormData parsedFormData = parseFormData();
            if (parsedFormData != null) {
                Iterator<String> it = parsedFormData.iterator();
                while (it.hasNext()) {
                    final String name = it.next();
                    Deque<FormData.FormValue> val = parsedFormData.get(name);
                    if (arrayMap.containsKey(name)) {
                        ArrayList<String> existing = arrayMap.get(name);
                        for (final FormData.FormValue v : val) {
                            if(!v.isFile()) {
                                existing.add(v.getValue());
View Full Code Here

    private Map<String, String[]> readPostParameters(HttpServerExchange exchange) throws IOException {
        final Map<String, String[]> ret = new HashMap<String, String[]>();
        FormDataParser parser = FormParserFactory.builder(false).addParser(new FormEncodedDataDefinition().setForceCreation(true)).build().createParser(exchange);

        FormData formData = parser.parseBlocking();
        Iterator<String> it = formData.iterator();
        while (it.hasNext()) {
            final String name = it.next();
            Deque<FormData.FormValue> val = formData.get(name);
            if (ret.containsKey(name)) {
                String[] existing = ret.get(name);
                String[] array = new String[val.size() + existing.length];
                System.arraycopy(existing, 0, array, 0, existing.length);
                int i = existing.length;
View Full Code Here

        if (parts == null) {
            final List<Part> parts = new ArrayList<Part>();
            String mimeType = exchange.getRequestHeaders().getFirst(Headers.CONTENT_TYPE);
            if (mimeType != null && mimeType.startsWith(MultiPartHandler.MULTIPART_FORM_DATA)) {
                final FormDataParser parser = exchange.getAttachment(FormDataParser.ATTACHMENT_KEY);
                final FormData value = parser.parseBlocking();
                for (final String namedPart : value) {
                    for (FormData.FormValue part : value.get(namedPart)) {
                        //TODO: non-file parts?
                        parts.add(new PartImpl(namedPart, part));
                    }
                }
            } else {
View Full Code Here

        if (exchange.getRequestMethod().equals(Methods.POST)) {
            readStarted = true;
            final FormDataParser parser = exchange.getAttachment(FormDataParser.ATTACHMENT_KEY);
            if (parser != null) {
                try {
                    FormData formData = parser.parseBlocking();
                    Iterator<String> it = formData.iterator();
                    while (it.hasNext()) {
                        parameterNames.add(it.next());
                    }
                } catch (IOException e) {
                    throw new RuntimeException(e);
View Full Code Here

        if (exchange.getRequestMethod().equals(Methods.POST)) {
            readStarted = true;
            final FormDataParser parser = exchange.getAttachment(FormDataParser.ATTACHMENT_KEY);
            if (parser != null) {
                try {
                    FormData formData = parser.parseBlocking();
                    Iterator<String> it = formData.iterator();
                    while (it.hasNext()) {
                        final String name = it.next();
                        Deque<FormData.FormValue> val = formData.get(name);
                        if (ret.containsKey(name)) {
                            String[] existing = ret.get(name);
                            String[] array = new String[val.size() + existing.length];
                            System.arraycopy(existing, 0, array, 0, existing.length);
                            int i = existing.length;
View Full Code Here

TOP

Related Classes of io.undertow.server.handlers.form.FormData

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.