diff --git a/pkgs/java_http/CHANGELOG.md b/pkgs/java_http/CHANGELOG.md new file mode 100644 index 0000000000..65e52db74c --- /dev/null +++ b/pkgs/java_http/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.0.1 + +- Initial development release. diff --git a/pkgs/java_http/LICENSE b/pkgs/java_http/LICENSE new file mode 100644 index 0000000000..cf6aefe5df --- /dev/null +++ b/pkgs/java_http/LICENSE @@ -0,0 +1,27 @@ +Copyright 2023, the Dart project authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google LLC nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/pkgs/java_http/README.md b/pkgs/java_http/README.md new file mode 100644 index 0000000000..5f54bd298b --- /dev/null +++ b/pkgs/java_http/README.md @@ -0,0 +1,25 @@ +A Dart package for making HTTP requests using native Java APIs +([java.net.HttpURLConnection](https://docs.oracle.com/javase/8/docs/api/java/net/HttpURLConnection.html)). + +Using native Java APIs has several advantages on Android: + + * Support for `KeyStore` `PrivateKey`s ([#50669](https://github.com/dart-lang/sdk/issues/50669)) + * Support for the system proxy ([#50434](https://github.com/dart-lang/sdk/issues/50434)) + * Support for user-installed certificates ([#50435](https://github.com/dart-lang/sdk/issues/50435)) + +## Status: Experimental + +**NOTE**: This package is currently experimental and published under the +[labs.dart.dev](https://dart.dev/dart-team-packages) pub publisher in order to +solicit feedback. + +For packages in the labs.dart.dev publisher we generally plan to either graduate +the package into a supported publisher (dart.dev, tools.dart.dev) after a period +of feedback and iteration, or discontinue the package. These packages have a +much higher expected rate of API and breaking changes. + +Your feedback is valuable and will help us evolve this package. +For general feedback and suggestions please comment in the +[feedback issue](https://github.com/dart-lang/http/issues/764). +For bugs, please file an issue in the +[bug tracker](https://github.com/dart-lang/http/issues). \ No newline at end of file diff --git a/pkgs/java_http/example/java_http_example.dart b/pkgs/java_http/example/java_http_example.dart new file mode 100644 index 0000000000..8b5e33d6f5 --- /dev/null +++ b/pkgs/java_http/example/java_http_example.dart @@ -0,0 +1,12 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// This code was generated by the Dart create command with the package template. + +import 'package:java_http/java_http.dart'; + +void main() { + var awesome = Awesome(); + print('awesome: ${awesome.isAwesome}'); +} diff --git a/pkgs/java_http/lib/java_http.dart b/pkgs/java_http/lib/java_http.dart new file mode 100644 index 0000000000..6498d22ead --- /dev/null +++ b/pkgs/java_http/lib/java_http.dart @@ -0,0 +1,7 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +library; + +export 'src/java_http_base.dart'; diff --git a/pkgs/java_http/lib/src/java_http_base.dart b/pkgs/java_http/lib/src/java_http_base.dart new file mode 100644 index 0000000000..8660e18936 --- /dev/null +++ b/pkgs/java_http/lib/src/java_http_base.dart @@ -0,0 +1,9 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// This code was generated by the Dart create command with the package template. + +class Awesome { + bool get isAwesome => true; +} diff --git a/pkgs/java_http/pubspec.yaml b/pkgs/java_http/pubspec.yaml new file mode 100644 index 0000000000..20cb429e54 --- /dev/null +++ b/pkgs/java_http/pubspec.yaml @@ -0,0 +1,14 @@ +name: java_http +description: A Dart package for making HTTP requests using java.net.HttpURLConnection. +version: 0.0.1 +repository: https://github.com/dart-lang/http/tree/master/pkgs/java_http +publish_to: none + +environment: + sdk: ^3.0.0 + +dependencies: + +dev_dependencies: + lints: ^2.0.0 + test: ^1.21.0 diff --git a/pkgs/java_http/test/java_http_test.dart b/pkgs/java_http/test/java_http_test.dart new file mode 100644 index 0000000000..e859141d2f --- /dev/null +++ b/pkgs/java_http/test/java_http_test.dart @@ -0,0 +1,22 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// This code was generated by the Dart create command with the package template. + +import 'package:java_http/java_http.dart'; +import 'package:test/test.dart'; + +void main() { + group('A group of tests', () { + final awesome = Awesome(); + + setUp(() { + // Additional setup goes here. + }); + + test('First Test', () { + expect(awesome.isAwesome, isTrue); + }); + }); +}