You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2008/11/22 14:32:46 UTC
svn commit: r719848 - in /activemq/camel/trunk/components:
camel-http/src/main/java/org/apache/camel/component/http/
camel-jetty/src/test/java/org/apache/camel/component/jetty/
Author: ningjiang
Date: Sat Nov 22 05:32:46 2008
New Revision: 719848
URL: http://svn.apache.org/viewvc?rev=719848&view=rev
Log:
Fixed the camel-jetty and camel-http CS errors
Modified:
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpOperationFailedException.java
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBindingRefTest.java
activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java
Modified: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java?rev=719848&r1=719847&r2=719848&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java (original)
+++ activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java Sat Nov 22 05:32:46 2008
@@ -1,3 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.camel.component.http;
import java.io.IOException;
Modified: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpOperationFailedException.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpOperationFailedException.java?rev=719848&r1=719847&r2=719848&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpOperationFailedException.java (original)
+++ activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpOperationFailedException.java Sat Nov 22 05:32:46 2008
@@ -22,21 +22,22 @@
import org.apache.camel.util.ObjectHelper;
import org.apache.commons.httpclient.StatusLine;
-public class HttpOperationFailedException extends CamelException {
+public class HttpOperationFailedException extends CamelException {
private final String redirectLocation;
private final int statusCode;
private final StatusLine statusLine;
- private InputStream responseBody;
+ private final InputStream responseBody;
- public HttpOperationFailedException(int statusCode, StatusLine statusLine, String location) {
+ public HttpOperationFailedException(int statusCode, StatusLine statusLine, String location, InputStream responseBody) {
super("HTTP operation failed with statusCode: " + statusCode + ", status: " + statusLine + (location != null ? ", redirectLocation: " + location : ""));
this.statusCode = statusCode;
this.statusLine = statusLine;
this.redirectLocation = location;
+ this.responseBody = responseBody;
}
- public HttpOperationFailedException(int statusCode, StatusLine statusLine) {
- this(statusCode, statusLine, null);
+ public HttpOperationFailedException(int statusCode, StatusLine statusLine, InputStream responseBody) {
+ this(statusCode, statusLine, null, responseBody);
}
public boolean isRedirectError() {
@@ -63,7 +64,5 @@
return responseBody;
}
- public void setResponseBody(InputStream responseBody) {
- this.responseBody = responseBody;
- }
+
}
\ No newline at end of file
Modified: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java?rev=719848&r1=719847&r2=719848&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java (original)
+++ activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java Sat Nov 22 05:32:46 2008
@@ -96,24 +96,23 @@
}
} else {
HttpOperationFailedException exception = null;
+ InputStream is = extractResponseBody(method);
if (responseCode >= 300 && responseCode < 400) {
String redirectLocation;
Header locationHeader = method.getResponseHeader("location");
if (locationHeader != null) {
redirectLocation = locationHeader.getValue();
- exception = new HttpOperationFailedException(responseCode, method.getStatusLine(), redirectLocation);
+ exception = new HttpOperationFailedException(responseCode, method.getStatusLine(), redirectLocation, is);
} else {
// no redirect location
- exception = new HttpOperationFailedException(responseCode, method.getStatusLine());
+ exception = new HttpOperationFailedException(responseCode, method.getStatusLine(), is);
}
} else {
// internal server error (error code 500)
- exception = new HttpOperationFailedException(responseCode, method.getStatusLine());
+ exception = new HttpOperationFailedException(responseCode, method.getStatusLine(), is);
}
- if (exception != null) {
- // set also the response body as well
- exception.setResponseBody(extractResponseBody(method));
+ if (exception != null) {
throw exception;
}
}
Modified: activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBindingRefTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBindingRefTest.java?rev=719848&r1=719847&r2=719848&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBindingRefTest.java (original)
+++ activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBindingRefTest.java Sat Nov 22 05:32:46 2008
@@ -1,3 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.camel.component.jetty;
import java.io.IOException;
Modified: activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java?rev=719848&r1=719847&r2=719848&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java (original)
+++ activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java Sat Nov 22 05:32:46 2008
@@ -1,3 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.camel.component.jetty;
import org.apache.camel.ContextTestSupport;