Package com.sun.jersey.api.representation

Examples of com.sun.jersey.api.representation.Form


                parameters.put(n, request.getParameterValues(n));
            }

            OAuthToken rt = provider.newRequestToken(consKey, params.getCallback(), parameters);

            Form resp = new Form();
            resp.putSingle(OAuthParameters.TOKEN, rt.getToken());
            resp.putSingle(OAuthParameters.TOKEN_SECRET, rt.getSecret());
            resp.putSingle(OAuthParameters.CALLBACK_CONFIRMED, "true");
            return Response.ok(resp).build();
        } catch (OAuthException e) {
            return e.toResponse();
        }
    }
View Full Code Here


    private void filterFormParameters(HttpServletRequest hsr, ContainerRequest cr) throws IOException {
        if (cr.getMethod().equals("POST")
                && MediaTypes.typeEquals(MediaType.APPLICATION_FORM_URLENCODED_TYPE, cr.getMediaType())
                && !isEntityPresent(cr)) {
            Form f = new Form();

            Enumeration e = hsr.getParameterNames();
            while (e.hasMoreElements()) {
                String name = (String)e.nextElement();
                String[] values = hsr.getParameterValues(name);

                f.put(name, Arrays.asList(values));
            }

            if (!f.isEmpty()) {
                cr.getProperties().put(FormDispatchProvider.FORM_PROPERTY, f);
                if (LOGGER.isLoggable(Level.WARNING)) {
                    LOGGER.log(Level.WARNING,
                     "A servlet POST request, to the URI " + cr.getRequestUri() + ", " +
                     "contains form parameters in " +
View Full Code Here

*/
public class FormDispatchProvider implements ResourceMethodDispatchProvider {
    public static final String FORM_PROPERTY = "com.sun.jersey.api.representation.form";
   
    protected void processForm(HttpContext context) {
        Form form = (Form)context.getProperties().get(FORM_PROPERTY);
        if (form == null) {
            form = context.getRequest().getEntity(Form.class);
            context.getProperties().put(FORM_PROPERTY, form);
        }
    }
View Full Code Here

            this.extractor = extractor;
            this.decode = decode;
        }
       
        public Object getValue(HttpContext context) {
            Form form = (Form)
                    context.getProperties().get(FORM_PROPERTY);
            try {
                return extractor.extract(form);
            } catch (ContainerException e) {
                throw new WebApplicationException(e.getCause(), 400);
View Full Code Here

    protected MultivaluedParameterExtractorProvider getMultivaluedParameterExtractorProvider() {
        return mpep;
    }

    private void processForm(HttpContext context) {
        Form form = (Form)context.getProperties().get(FORM_PROPERTY);
        if (form == null) {
            form = context.getRequest().getEntity(Form.class);
            context.getProperties().put(FORM_PROPERTY, form);
        }
    }
View Full Code Here

    private void filterFormParameters(HttpServletRequest hsr, ContainerRequest cr) throws IOException {
        if (cr.getMethod().equals("POST")
                && MediaTypes.typeEquals(MediaType.APPLICATION_FORM_URLENCODED_TYPE, cr.getMediaType())
                && !isEntityPresent(cr)) {
            Form f = new Form();

            Enumeration e = hsr.getParameterNames();
            while (e.hasMoreElements()) {
                String name = (String)e.nextElement();
                String[] values = hsr.getParameterValues(name);

                f.put(name, Arrays.asList(values));
            }

            if (!f.isEmpty()) {
                cr.getProperties().put(FormDispatchProvider.FORM_PROPERTY, f);
                if (LOGGER.isLoggable(Level.WARNING)) {
                    LOGGER.log(Level.WARNING,
                     "A servlet POST request, to the URI " + cr.getRequestUri() + ", " +
                     "contains form parameters in " +
View Full Code Here

            Type genericType,
            Annotation annotations[],
            MediaType mediaType,
            MultivaluedMap<String, String> httpHeaders,
            InputStream entityStream) throws IOException {
        return readFrom(new Form(), mediaType, entityStream);
    }
View Full Code Here

                in = new ByteArrayInputStream(baos.toByteArray());
                setEntityInputStream(in);
            }

            ByteArrayInputStream bais = (ByteArrayInputStream)in;
            Form f = getEntity(Form.class);
            bais.reset();
            return f;
        } else {
            return new Form();
        }
    }
View Full Code Here

            this.extractor = extractor;
            this.decode = decode;
        }
       
        public Object getValue(HttpContext context) {
            Form form = (Form)
                    context.getProperties().get(FormDispatchProvider.FORM_PROPERTY);
            if (form == null) {
                form = getForm(context);
                if (form == null)
                    throw new IllegalStateException(
View Full Code Here

                return null;

            if (!MediaTypes.typeEquals(MediaType.APPLICATION_FORM_URLENCODED_TYPE, r.getMediaType()))
                return null;

            final Form form = r.getFormParameters();
            context.getProperties().put(FormDispatchProvider.FORM_PROPERTY, form);
            return form;
        }
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.representation.Form

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.