Examples of HttpMethods


Examples of org.apache.camel.component.http4.HttpMethods

        assertEquals(HttpMethods.GET, method);
    }

    @Test
    public void createMethodUseGETIfNoneQueryOrPayloadIsProvided() throws URISyntaxException {
        HttpMethods method = HttpHelper.createMethod(
                createExchangeWithOptionalHttpQueryAndHttpMethodHeader(null, null),
                createHttpEndpoint(true, "http://www.google.com/search"),
                false);

        assertEquals(HttpMethods.GET, method);
View Full Code Here

Examples of org.apache.camel.component.http4.HttpMethods

        assertEquals(HttpMethods.GET, method);
    }

    @Test
    public void createMethodUsePOSTIfNoneQueryButPayloadIsProvided() throws URISyntaxException {
        HttpMethods method = HttpHelper.createMethod(
                createExchangeWithOptionalHttpQueryAndHttpMethodHeader(null, null),
                createHttpEndpoint(true, "http://www.google.com/search"),
                true);

        assertEquals(HttpMethods.POST, method);
View Full Code Here

Examples of org.apache.camel.component.http4.HttpMethods

        assertEquals("http://www.google.com/search", url);
    }

    @Test
    public void createMethodAlwaysUseUserChoosenMethod() throws URISyntaxException {
        HttpMethods method = HttpProducerHelper.createMethod(
                createExchangeWithOptionalHttpQueryAndHttpMethodHeader("q=camel", HttpMethods.POST),
                createHttpEndpoint(true, "http://www.google.com/search"),
                false);

        assertEquals(HttpMethods.POST, method);
View Full Code Here

Examples of org.apache.camel.component.http4.HttpMethods

        assertEquals(HttpMethods.POST, method);
    }

    @Test
    public void createMethodUseGETIfQueryIsProvidedInHeader() throws URISyntaxException {
        HttpMethods method = HttpProducerHelper.createMethod(
                createExchangeWithOptionalHttpQueryAndHttpMethodHeader("q=camel", null),
                createHttpEndpoint(true, "http://www.google.com/search"),
                false);

        assertEquals(HttpMethods.GET, method);
View Full Code Here

Examples of org.apache.camel.component.http4.HttpMethods

        assertEquals(HttpMethods.GET, method);
    }

    @Test
    public void createMethodUseGETIfQueryIsProvidedInEndpointURI() throws URISyntaxException {
        HttpMethods method = HttpProducerHelper.createMethod(
                createExchangeWithOptionalHttpQueryAndHttpMethodHeader(null, null),
                createHttpEndpoint(true, "http://www.google.com/search?q=test"),
                false);

        assertEquals(HttpMethods.GET, method);
View Full Code Here

Examples of org.apache.camel.component.http4.HttpMethods

        assertEquals(HttpMethods.GET, method);
    }

    @Test
    public void createMethodUseGETIfNoneQueryOrPayloadIsProvided() throws URISyntaxException {
        HttpMethods method = HttpProducerHelper.createMethod(
                createExchangeWithOptionalHttpQueryAndHttpMethodHeader(null, null),
                createHttpEndpoint(true, "http://www.google.com/search"),
                false);

        assertEquals(HttpMethods.GET, method);
View Full Code Here

Examples of org.apache.camel.component.http4.HttpMethods

        assertEquals(HttpMethods.GET, method);
    }

    @Test
    public void createMethodUsePOSTIfNoneQueryButPayloadIsProvided() throws URISyntaxException {
        HttpMethods method = HttpProducerHelper.createMethod(
                createExchangeWithOptionalHttpQueryAndHttpMethodHeader(null, null),
                createHttpEndpoint(true, "http://www.google.com/search"),
                true);

        assertEquals(HttpMethods.POST, method);
View Full Code Here

Examples of org.apache.camel.component.http4.HttpMethods

        if (queryString == null) {
            queryString = endpoint.getHttpUri().getQuery();
        }

        // compute what method to use either GET or POST
        HttpMethods answer;
        HttpMethods m = exchange.getIn().getHeader(Exchange.HTTP_METHOD, HttpMethods.class);
        if (m != null) {
            // always use what end-user provides in a header
            answer = m;
        } else if (queryString != null) {
            // if a query string is provided then use GET
View Full Code Here

Examples of org.apache.camel.component.http4.HttpMethods

        if (queryString == null) {
            queryString = endpoint.getHttpUri().getRawQuery();
        }

        // compute what method to use either GET or POST
        HttpMethods answer;
        HttpMethods m = exchange.getIn().getHeader(Exchange.HTTP_METHOD, HttpMethods.class);
        if (m != null) {
            // always use what end-user provides in a header
            answer = m;
        } else if (queryString != null) {
            // if a query string is provided then use GET
View Full Code Here

Examples of org.apache.geronimo.security.util.HTTPMethods

            WebResourcePermission permission = new WebResourcePermission(name, actions);

            for (String roleName : pattern.getRoles()) {
                addPermissionToRole(roleName, permission, rolePermissions);
            }
            HTTPMethods methods = pattern.getHTTPMethods();
            int transportType = pattern.getTransport();

            addOrUpdatePattern(uncheckedUserPatterns, name, methods, transportType);
        }

        for (URLPattern pattern : uncheckedPatterns.values()) {
            String name = pattern.getQualifiedPattern(allSet);
            HTTPMethods methods = pattern.getHTTPMethods();

            addOrUpdatePattern(uncheckedResourcePatterns, name, methods, URLPattern.NA);

            int transportType = pattern.getTransport();
            addOrUpdatePattern(uncheckedUserPatterns, name, methods, transportType);
        }

        /**
         * A <code>WebResourcePermission</code> and a <code>WebUserDataPermission</code> must be instantiated for
         * each <tt>url-pattern</tt> in the deployment descriptor and the default pattern "/", that is not combined
         * by the <tt>web-resource-collection</tt> elements of the deployment descriptor with ever HTTP method
         * value.  The permission objects must be contructed using the qualified pattern as their name and with
         * actions defined by the subset of the HTTP methods that do not occur in combination with the pattern.
         * The resulting permissions that must be added to the unchecked policy statements by calling the
         * <code>addToUncheckedPolcy</code> method on the <code>PolicyConfiguration</code> object.
         */
        for (URLPattern pattern : allSet) {
            String name = pattern.getQualifiedPattern(allSet);
            HTTPMethods methods = pattern.getComplementedHTTPMethods();

            if (methods.isNone()) {
                continue;
            }

            addOrUpdatePattern(uncheckedResourcePatterns, name, methods, URLPattern.NA);
            addOrUpdatePattern(uncheckedUserPatterns, name, methods, URLPattern.NA);
        }

        URLPattern pattern = new URLPattern("/");
        if (!allSet.contains(pattern)) {
            String name = pattern.getQualifiedPattern(allSet);
            HTTPMethods methods = pattern.getComplementedHTTPMethods();

            addOrUpdatePattern(uncheckedResourcePatterns, name, methods, URLPattern.NA);
            addOrUpdatePattern(uncheckedUserPatterns, name, methods, URLPattern.NA);
        }

        //Create the uncheckedPermissions for WebResourcePermissions
        for (UncheckedItem item : uncheckedResourcePatterns.keySet()) {
            HTTPMethods methods = uncheckedResourcePatterns.get(item);
            String actions = URLPattern.getMethodsWithTransport(methods, item.getTransportType());

            uncheckedPermissions.add(new WebResourcePermission(item.getName(), actions));
        }
        //Create the uncheckedPermissions for WebUserDataPermissions
        for (UncheckedItem item : uncheckedUserPatterns.keySet()) {
            HTTPMethods methods = uncheckedUserPatterns.get(item);
            String actions = URLPattern.getMethodsWithTransport(methods, item.getTransportType());

            uncheckedPermissions.add(new WebUserDataPermission(item.getName(), actions));
        }

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.