forked from apache/dubbo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support more content types for Triple protocol (apache#13387)
* Add more content type support for triple * Add more content type support for triple * Add tests & Bug fix * Code style fix * Code style fix * Code style fix * Code style fix * Code style fix * Set codec related dependencies to provided * Change CodecUtil to bean * Support Triple response encode by Accept header * Support Triple response encode by Accept header * Fix npe * Refactor response encode * Bug fix * Style fix * Bug fix & Add log * Style fix * Bug fix * Update ExceptionUtilsTest.java * Refactor * Fix code style * Refactor * Refactor * Code style fix * Refactor * Refactor * Code style optimize * Code style optimize * Refactor MultipartCodec * Add tests & Remove some dep * Remove commons_fileupload from bom * Simplify depedencies & clean up * Fix jaxb version * Enhance reliability for MultipartCodec & Add tests * Enhance reliability for MultipartCodec * Add test cases * Add test cases * Add test cases * Add test cases * Add test for xml safety * Add test for xml safety * Refactor CodecFactory * Refactor CodecFactory * Refactor CodecFactory * Add codec cache * Fix npe * Fix npe --------- Co-authored-by: nameless <x1544669126@gmail.com>
- Loading branch information
1 parent
2f4a78e
commit 6118aa5
Showing
52 changed files
with
1,838 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...emoting-http12/src/main/java/org/apache/dubbo/remoting/http12/message/CodecMediaType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* 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.dubbo.remoting.http12.message; | ||
|
||
public interface CodecMediaType { | ||
|
||
MediaType mediaType(); | ||
|
||
default boolean supports(String mediaType) { | ||
return mediaType.startsWith(mediaType().getName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...ing-http12/src/main/java/org/apache/dubbo/remoting/http12/message/HttpMessageDecoder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* 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.dubbo.remoting.http12.message; | ||
|
||
import org.apache.dubbo.remoting.http12.exception.DecodeException; | ||
|
||
import java.io.InputStream; | ||
|
||
public interface HttpMessageDecoder extends CodecMediaType { | ||
|
||
Object decode(InputStream inputStream, Class<?> targetType) throws DecodeException; | ||
|
||
default Object[] decode(InputStream inputStream, Class<?>[] targetTypes) throws DecodeException { | ||
// default decode first target type | ||
return new Object[] { | ||
this.decode(inputStream, targetTypes == null || targetTypes.length == 0 ? null : targetTypes[0]) | ||
}; | ||
} | ||
|
||
MediaType mediaType(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...ing-http12/src/main/java/org/apache/dubbo/remoting/http12/message/HttpMessageEncoder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* 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.dubbo.remoting.http12.message; | ||
|
||
import org.apache.dubbo.remoting.http12.exception.EncodeException; | ||
|
||
import java.io.OutputStream; | ||
|
||
public interface HttpMessageEncoder extends CodecMediaType { | ||
|
||
void encode(OutputStream outputStream, Object data) throws EncodeException; | ||
|
||
default void encode(OutputStream outputStream, Object[] data) throws EncodeException { | ||
// default encode first data | ||
this.encode(outputStream, data == null || data.length == 0 ? null : data[0]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.