Skip to content

Commit

Permalink
Create java http package (#971)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-james-dev authored Jun 26, 2023
1 parent ff1fcfe commit 067bff3
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkgs/java_http/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

- Initial development release.
27 changes: 27 additions & 0 deletions pkgs/java_http/LICENSE
Original file line number Diff line number Diff line change
@@ -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.
25 changes: 25 additions & 0 deletions pkgs/java_http/README.md
Original file line number Diff line number Diff line change
@@ -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).
12 changes: 12 additions & 0 deletions pkgs/java_http/example/java_http_example.dart
Original file line number Diff line number Diff line change
@@ -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}');
}
7 changes: 7 additions & 0 deletions pkgs/java_http/lib/java_http.dart
Original file line number Diff line number Diff line change
@@ -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';
9 changes: 9 additions & 0 deletions pkgs/java_http/lib/src/java_http_base.dart
Original file line number Diff line number Diff line change
@@ -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;
}
14 changes: 14 additions & 0 deletions pkgs/java_http/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions pkgs/java_http/test/java_http_test.dart
Original file line number Diff line number Diff line change
@@ -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);
});
});
}

0 comments on commit 067bff3

Please sign in to comment.