Examples of RuntimeDelegate


Examples of javax.ws.rs.ext.RuntimeDelegate

public class AcceptCharsetHeaderDelegateTest {
    private HeaderDelegate<AcceptCharset> acceptCharsetDelegate;

    @Before
    public void setup() {
        RuntimeDelegate rd = RuntimeDelegate.getInstance();
        acceptCharsetDelegate = rd.createHeaderDelegate(AcceptCharset.class);
    }
View Full Code Here

Examples of javax.ws.rs.ext.RuntimeDelegate

public class CacheControlHeaderDelegateTest {

    @Test
    public void testSerializeCacheControlHeader() {
        RuntimeDelegate rd = RuntimeDelegate.getInstance();
        HeaderDelegate<CacheControl> cacheControlHeaderDelegate =
            rd.createHeaderDelegate(CacheControl.class);
        if (cacheControlHeaderDelegate == null) {
            fail("CacheControl header delegate is not regestered in RuntimeDelegateImpl");
        }

        String expectedCacheControlHeader =
View Full Code Here

Examples of javax.ws.rs.ext.RuntimeDelegate

        }
    }

    @Test
    public void testParseCacheControlHeader() {
        RuntimeDelegate rd = RuntimeDelegate.getInstance();
        HeaderDelegate<CacheControl> cacheControlHeaderDelegate =
            rd.createHeaderDelegate(CacheControl.class);
        if (cacheControlHeaderDelegate == null) {
            fail("CacheControl header delegate is not regestered in RuntimeDelegateImpl");
        }

        try {
View Full Code Here

Examples of javax.ws.rs.ext.RuntimeDelegate

    }

    @Test
    public void testParseSerializeMediaType() {

        RuntimeDelegate rd = RuntimeDelegate.getInstance();
        HeaderDelegate<MediaType> mtd = rd.createHeaderDelegate(MediaType.class);
        if (mtd == null) {
            fail("MediaType header delegate is not regestered in RuntimeDelegateImpl");
        }

        MediaType mt = mtd.fromString("application/xml");
View Full Code Here

Examples of javax.ws.rs.ext.RuntimeDelegate

        return Headers.toHttpDate(date);
    }
   
    public static RuntimeDelegate getOtherRuntimeDelegate() {
        try {
            RuntimeDelegate rd = RuntimeDelegate.getInstance();
            return rd instanceof RuntimeDelegateImpl ? null : rd;
        } catch (Throwable t) {
            return null;
        }
    }
View Full Code Here

Examples of javax.ws.rs.ext.RuntimeDelegate

        Map<String, List<Object>> headers = CastUtils.cast((Map<?, ?>)m.get(Message.PROTOCOL_HEADERS));
        return new MetadataMap<String, Object>(headers, false, false, true);
    }
   
    public static void convertHeaderValuesToString(Map<String, List<Object>> headers, boolean delegateOnly) {
        RuntimeDelegate rd = getOtherRuntimeDelegate();
        if (rd == null && delegateOnly) {
            return;
        }
        for (Map.Entry<String, List<Object>> entry : headers.entrySet()) {
            List<Object> values = entry.getValue();
View Full Code Here

Examples of javax.ws.rs.ext.RuntimeDelegate

    }
   
    @Test
    public void testGetHeaderStringUsingHeaderDelegate() throws Exception {
        StringBean bean = new StringBean("s3");
        RuntimeDelegate original = RuntimeDelegate.getInstance();
        RuntimeDelegate.setInstance(new StringBeanRuntimeDelegate(original));
        try {
            Response response = Response.ok().header(bean.get(), bean).build();
            String header = response.getHeaderString(bean.get());
            assertTrue(header.contains(bean.get()));
View Full Code Here

Examples of javax.ws.rs.ext.RuntimeDelegate

        public RuntimeDelegate getOriginal() {
            return original;
        }

        public static final void assertNotStringBeanRuntimeDelegate() {
            RuntimeDelegate delegate = RuntimeDelegate.getInstance();
            assertNotStringBeanRuntimeDelegate(delegate);
        }
View Full Code Here

Examples of javax.ws.rs.ext.RuntimeDelegate

        return this;
    }

    @Override
    public Builder header(String name, Object value) {
        RuntimeDelegate rd = HttpUtils.getOtherRuntimeDelegate();
        doSetHeader(rd, name, value);
        return this;
    }
View Full Code Here

Examples of javax.ws.rs.ext.RuntimeDelegate

        return this;
    }
   
    @Override
    public Builder headers(MultivaluedMap<String, Object> headers) {
        RuntimeDelegate rd = HttpUtils.getOtherRuntimeDelegate();
        for (Map.Entry<String, List<Object>> entry : headers.entrySet()) {
            for (Object value : entry.getValue()) {
                doSetHeader(rd, entry.getKey(), value);
            }
        }
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.