Package org.apache.camel.component.cxf

Examples of org.apache.camel.component.cxf.CxfOperationException


        buffer.append("]");
        return buffer.toString();
    }

    protected CxfOperationException populateCxfRsProducerException(Exchange exchange, Response response, int responseCode) {
        CxfOperationException exception;
        String uri = exchange.getFromEndpoint().getEndpointUri();
        String statusText = Response.Status.fromStatusCode(responseCode).toString();
        Map<String, String> headers = parseResponseHeaders(response, exchange);
        //Get the response detail string
        String copy = exchange.getContext().getTypeConverter().convertTo(String.class, response.getEntity());
        if (responseCode >= 300 && responseCode < 400) {
            String redirectLocation;
            if (response.getMetadata().getFirst("Location") != null) {
                redirectLocation = response.getMetadata().getFirst("location").toString();
                exception = new CxfOperationException(uri, responseCode, statusText, redirectLocation, headers, copy);
            } else {
                //no redirect location
                exception = new CxfOperationException(uri, responseCode, statusText, null, headers, copy);
            }
        } else {
            //internal server error(error code 500)
            exception = new CxfOperationException(uri, responseCode, statusText, null, headers, copy);
        }

        return exception;
    }
View Full Code Here


                }
            });
        // we should get the exception here
        assertNotNull("Expect the exception here", exchange.getException());
        CxfOperationException exception = (CxfOperationException)exchange.getException();
       
        assertEquals("Get a wrong response body", "Cannot find the customer!", exception.getResponseBody());
       
    }
View Full Code Here

                }
            });
        // we should get the exception here
        assertNotNull("Expect the exception here", exchange.getException());
        CxfOperationException exception = (CxfOperationException)exchange.getException();
       
        assertEquals("Get a wrong response body", "Cannot find the customer!", exception.getResponseBody());
       
    }
View Full Code Here

        buffer.append("]");
        return buffer.toString();
    }

    protected CxfOperationException populateCxfRsProducerException(Exchange exchange, Response response, int responseCode) {
        CxfOperationException exception;
        String uri = exchange.getFromEndpoint().getEndpointUri();
        String statusText = Response.Status.fromStatusCode(responseCode).toString();
        Map<String, String> headers = parseResponseHeaders(response, exchange);
        //Get the response detail string
        String copy = exchange.getContext().getTypeConverter().convertTo(String.class, response.getEntity());
        if (responseCode >= 300 && responseCode < 400) {
            String redirectLocation;
            if (response.getMetadata().getFirst("Location") != null) {
                redirectLocation = response.getMetadata().getFirst("location").toString();
                exception = new CxfOperationException(uri, responseCode, statusText, redirectLocation, headers, copy);
            } else {
                //no redirect location
                exception = new CxfOperationException(uri, responseCode, statusText, null, headers, copy);
            }
        } else {
            //internal server error(error code 500)
            exception = new CxfOperationException(uri, responseCode, statusText, null, headers, copy);
        }

        return exception;
    }
View Full Code Here

                }
            });
        // we should get the exception here
        assertNotNull("Expect the exception here", exchange.getException());
        CxfOperationException exception = (CxfOperationException)exchange.getException();
       
        assertEquals("Get a wrong response body", "Cannot find the customer!", exception.getResponseBody());
       
    }
View Full Code Here

        buffer.append("]");
        return buffer.toString();
    }

    protected CxfOperationException populateCxfRsProducerException(Exchange exchange, Response response, int responseCode) {
        CxfOperationException exception;
        String uri = exchange.getFromEndpoint().getEndpointUri();
        String statusText = Response.Status.fromStatusCode(responseCode).toString();
        Map<String, String> headers = parseResponseHeaders(response, exchange);
        String copy = response.toString();
        if (responseCode >= 300 && responseCode < 400) {
            String redirectLocation;
            if (response.getMetadata().getFirst("Location") != null) {
                redirectLocation = response.getMetadata().getFirst("location").toString();
                exception = new CxfOperationException(uri, responseCode, statusText, redirectLocation, headers, copy);
            } else {
                //no redirect location
                exception = new CxfOperationException(uri, responseCode, statusText, null, headers, copy);
            }
        } else {
            //internal server error(error code 500)
            exception = new CxfOperationException(uri, responseCode, statusText, null, headers, copy);
        }

        return exception;
    }
View Full Code Here

        buffer.append("]");
        return buffer.toString();
    }

    protected CxfOperationException populateCxfRsProducerException(Exchange exchange, Response response, int responseCode) {
        CxfOperationException exception;
        String uri = exchange.getFromEndpoint().getEndpointUri();
        String statusText = Response.Status.fromStatusCode(responseCode).toString();
        Map<String, String> headers = parseResponseHeaders(response, exchange);
        String copy = response.toString();
        if (responseCode >= 300 && responseCode < 400) {
            String redirectLocation;
            if (response.getMetadata().getFirst("Location") != null) {
                redirectLocation = response.getMetadata().getFirst("location").toString();
                exception = new CxfOperationException(uri, responseCode, statusText, redirectLocation, headers, copy);
            } else {
                //no redirect location
                exception = new CxfOperationException(uri, responseCode, statusText, null, headers, copy);
            }
        } else {
            //internal server error(error code 500)
            exception = new CxfOperationException(uri, responseCode, statusText, null, headers, copy);
        }

        return exception;
    }
View Full Code Here

        buffer.append("]");
        return buffer.toString();
    }

    protected CxfOperationException populateCxfRsProducerException(Exchange exchange, Response response, int responseCode) {
        CxfOperationException exception;
        String uri = exchange.getFromEndpoint().getEndpointUri();
        String statusText = Response.Status.fromStatusCode(responseCode).toString();
        Map<String, String> headers = parseResponseHeaders(response, exchange);
        String copy = response.toString();
        if (responseCode >= 300 && responseCode < 400) {
            String redirectLocation;
            if (response.getMetadata().getFirst("Location") != null) {
                redirectLocation = response.getMetadata().getFirst("location").toString();
                exception = new CxfOperationException(uri, responseCode, statusText, redirectLocation, headers, copy);
            } else {
                //no redirect location
                exception = new CxfOperationException(uri, responseCode, statusText, null, headers, copy);
            }
        } else {
            //internal server error(error code 500)
            exception = new CxfOperationException(uri, responseCode, statusText, null, headers, copy);
        }

        return exception;
    }
View Full Code Here

                }
            });
        // we should get the exception here
        assertNotNull("Expect the exception here", exchange.getException());
        CxfOperationException exception = (CxfOperationException)exchange.getException();
       
        System.out.println(exception.getResponseBody());
       
    }
View Full Code Here

        buffer.append("]");
        return buffer.toString();
    }

    protected CxfOperationException populateCxfRsProducerException(Exchange exchange, Response response, int responseCode) {
        CxfOperationException exception;
        String uri = exchange.getFromEndpoint().getEndpointUri();
        String statusText = Response.Status.fromStatusCode(responseCode).toString();
        Map<String, String> headers = parseResponseHeaders(response, exchange);
        //Get the response detail string
        String copy = exchange.getContext().getTypeConverter().convertTo(String.class, response.getEntity());
        System.out.println("The entity response is " + copy + "!");
        if (responseCode >= 300 && responseCode < 400) {
            String redirectLocation;
            if (response.getMetadata().getFirst("Location") != null) {
                redirectLocation = response.getMetadata().getFirst("location").toString();
                exception = new CxfOperationException(uri, responseCode, statusText, redirectLocation, headers, copy);
            } else {
                //no redirect location
                exception = new CxfOperationException(uri, responseCode, statusText, null, headers, copy);
            }
        } else {
            //internal server error(error code 500)
            exception = new CxfOperationException(uri, responseCode, statusText, null, headers, copy);
        }

        return exception;
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.component.cxf.CxfOperationException

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.