Package org.apache.cxf.jaxrs.ext

Examples of org.apache.cxf.jaxrs.ext.MessageContextImpl


    private static Object processFormParam(Message m, String key,
                                           Class<?> pClass, Type genericType,
                                           String defaultValue,
                                           boolean decode) {
       
        MessageContext mc = new MessageContextImpl(m);
        MediaType mt = mc.getHttpHeaders().getMediaType();
       
        MultivaluedMap<String, String> params = new MetadataMap<String, String>();
       
        if (mt == null || mt.isCompatible(MediaType.APPLICATION_FORM_URLENCODED_TYPE)) {
            String body = (String)m.get("org.apache.cxf.jaxrs.provider.form.body");
View Full Code Here


        } else if (Providers.class.isAssignableFrom(clazz)) {
            o = new ProvidersImpl(contextMessage);
        } else if (ContextResolver.class.isAssignableFrom(clazz)) {
            o = createContextResolver(genericType, contextMessage);
        } else if (MessageContext.class.isAssignableFrom(clazz)) {
            o = new MessageContextImpl(m);
        }
       
        o = o == null ? createServletResourceValue(contextMessage, clazz) : o;
        return clazz.cast(o);
    }
View Full Code Here

   
    @Test
    public void testWrite() throws Exception {
        XSLTJaxbProvider provider = new XSLTJaxbProvider();
        provider.setOutTemplate(TEMPLATE_LOCATION);
        provider.setMessageContext(new MessageContextImpl(createMessage()));
        Book b = new Book();
        b.setId(123L);
        b.setName("TheBook");
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        provider.writeTo(b, Book.class, Book.class, b.getClass().getAnnotations(),
View Full Code Here

            protected XMLStreamWriter getStreamWriter(Object obj, OutputStream os, MediaType mt) {
                return StaxUtils.createXMLStreamWriter(os);
            }
        };
        provider.setOutTemplate(TEMPLATE_LOCATION);
        provider.setMessageContext(new MessageContextImpl(createMessage()));
        Book b = new Book();
        b.setId(123L);
        b.setName("TheBook");
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        provider.writeTo(b, Book.class, Book.class, b.getClass().getAnnotations(),
View Full Code Here

    @Test
    public void testOutAttributesAsElementsForList() throws Exception {

        //Provider
        JAXBElementProvider provider = new JAXBElementProvider();
        provider.setMessageContext(new MessageContextImpl(createMessage()));
        provider.setCollectionWrapperName("tagholders");
        Map<String, String> map = new HashMap<String, String>();
        map.put("{http://tags}*", "*");
        provider.setOutTransformElements(map);
        provider.setAttributesToElements(true);
View Full Code Here

                                           Class<?> pClass, Type genericType,
                                           Annotation[] paramAnns,
                                           String defaultValue,
                                           boolean decode) {
       
        MessageContext mc = new MessageContextImpl(m);
        MediaType mt = mc.getHttpHeaders().getMediaType();
       
        @SuppressWarnings("unchecked")
        MultivaluedMap<String, String> params =
            (MultivaluedMap<String, String>)m.get(FormUtils.FORM_PARAM_MAP);
       
View Full Code Here

        } else if (Providers.class.isAssignableFrom(clazz)) {
            o = new ProvidersImpl(contextMessage);
        } else if (ContextResolver.class.isAssignableFrom(clazz)) {
            o = createContextResolver(genericType, contextMessage);
        } else if (MessageContext.class.isAssignableFrom(clazz)) {
            o = new MessageContextImpl(m);
        } else if (SearchContext.class.isAssignableFrom(clazz)) {
            o = new SearchContextImpl(m);
        } else if (Application.class.isAssignableFrom(clazz)) {
            ProviderInfo<?> providerInfo =
                (ProviderInfo)contextMessage.getExchange().getEndpoint().get(Application.class.getName());
View Full Code Here

        m.setExchange(exc);
        m.put(Message.RESPONSE_CODE, "200");
       
        MessageBodyReader<Response> reader = new ResponseReader(Book.class) {
            protected MessageContext getContext() {
                return new MessageContextImpl(m);
            }
        };
        ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes());
        Response r = reader.readFrom(Response.class, Response.class,
            new Annotation[0], MediaType.TEXT_XML_TYPE, headers, is);
View Full Code Here

                                           Class<?> pClass, Type genericType,
                                           Annotation[] paramAnns,
                                           String defaultValue,
                                           boolean decode) {
       
        MessageContext mc = new MessageContextImpl(m);
        MediaType mt = mc.getHttpHeaders().getMediaType();
       
        @SuppressWarnings("unchecked")
        MultivaluedMap<String, String> params =
            (MultivaluedMap<String, String>)m.get(FormUtils.FORM_PARAM_MAP);
       
View Full Code Here

            o = createHttpHeaders(contextMessage, clazz);
        } else if (SecurityContext.class.isAssignableFrom(clazz)) {
            SecurityContext customContext = contextMessage.get(SecurityContext.class);
            o = customContext == null ? new SecurityContextImpl(contextMessage) : customContext;
        } else if (MessageContext.class.isAssignableFrom(clazz)) {
            o = new MessageContextImpl(m);
        } else if (ResourceInfo.class.isAssignableFrom(clazz)) {
            o = new ResourceInfoImpl(contextMessage);
        } else if (ResourceContext.class.isAssignableFrom(clazz)) {
            o = new ResourceContextImpl(contextMessage, contextMessage.getExchange().get(OperationResourceInfo.class));
        } else if (Request.class.isAssignableFrom(clazz)) {
View Full Code Here

TOP

Related Classes of org.apache.cxf.jaxrs.ext.MessageContextImpl

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.