-
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.
- Loading branch information
1 parent
51bd1fc
commit 0e238a2
Showing
19 changed files
with
150 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,73 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:Q/src/Method.dart'; | ||
import 'package:Q/src/ApplicationConfiguration.dart'; | ||
import 'package:Q/src/configure/HttpRequestConfigure.dart'; | ||
import 'package:Q/src/configure/HttpResponseConfigure.dart'; | ||
import 'package:Q/src/configure/InterceptorConfigure.dart'; | ||
import 'package:Q/src/configure/MultipartConfigure.dart'; | ||
import 'package:Q/src/configure/RouterMappingConfigure.dart'; | ||
|
||
// 应用程序配置 | ||
abstract class Configuration { | ||
// 当前不支持的请求类型 | ||
List<ContentType> get unSupportedContentTypes; | ||
|
||
// 当前支持的请求类型 | ||
List<HttpMethod> get unSupportedMethods; | ||
|
||
// 默认返回结果的类型 | ||
ContentType get defaultProducedType; | ||
|
||
MultipartConfigure get multipartConfigure; | ||
|
||
RouterMappingConfigure get routerMappingConfigure; | ||
|
||
InterceptorConfigure get interceptorConfigure; | ||
|
||
HttpRequestConfigure get httpRequestConfigure; | ||
|
||
HttpResponseConfigure get httpResponseConfigure; | ||
|
||
Future<dynamic> init(ApplicationConfiguration applicationConfiguration); | ||
|
||
factory Configuration() => _Configuration(); | ||
} | ||
|
||
class _Configuration implements Configuration { | ||
_Configuration(); | ||
|
||
List<ContentType> unSupportedContentTypes_ = List(); | ||
|
||
List<HttpMethod> unSupportedMethods_ = List(); | ||
|
||
ContentType defaultProducedType_ = ContentType.json; | ||
|
||
MultipartConfigure _multipartConfigure = MultipartConfigure(); | ||
|
||
RouterMappingConfigure _routerMappingConfigure = RouterMappingConfigure(); | ||
|
||
InterceptorConfigure _interceptorConfigure = InterceptorConfigure(); | ||
|
||
HttpRequestConfigure _httpRequestConfigure = HttpRequestConfigure(); | ||
|
||
HttpResponseConfigure _httpResponseConfigure = HttpResponseConfigure(); | ||
|
||
@override | ||
List<ContentType> get unSupportedContentTypes { | ||
return this.unSupportedContentTypes_; | ||
MultipartConfigure get multipartConfigure { | ||
return this._multipartConfigure; | ||
} | ||
|
||
@override | ||
ContentType get defaultProducedType { | ||
return this.defaultProducedType_; | ||
RouterMappingConfigure get routerMappingConfigure { | ||
return this._routerMappingConfigure; | ||
} | ||
|
||
@override | ||
List<HttpMethod> get unSupportedMethods { | ||
return this.unSupportedMethods_; | ||
InterceptorConfigure get interceptorConfigure { | ||
return this._interceptorConfigure; | ||
} | ||
|
||
@override | ||
MultipartConfigure get multipartConfigure { | ||
return this._multipartConfigure; | ||
HttpRequestConfigure get httpRequestConfigure { | ||
return this._httpRequestConfigure; | ||
} | ||
|
||
@override | ||
RouterMappingConfigure get routerMappingConfigure { | ||
return this._routerMappingConfigure; | ||
HttpResponseConfigure get httpResponseConfigure { | ||
return this._httpResponseConfigure; | ||
} | ||
|
||
@override | ||
InterceptorConfigure get interceptorConfigure { | ||
return this._interceptorConfigure; | ||
Future<dynamic> init(ApplicationConfiguration applicationConfiguration) async { | ||
await Future.wait([ | ||
_multipartConfigure.init(), | ||
_routerMappingConfigure.init(), | ||
_httpResponseConfigure.init(), | ||
_httpRequestConfigure.init(), | ||
_interceptorConfigure.init() | ||
]); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
abstract class AbstractConfigure { | ||
Future<dynamic> init(); | ||
} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
final String APPLICATION_ENVIRONMENT_VARIABLE = 'application.environment'; | ||
final String APPLICATION_NAME = 'application.name'; | ||
final String APPLICATION_AUTHORS = 'application.author'; | ||
final String APPLICATION_CREATE_TIME = 'application.createTime'; | ||
final String APPLICATION_INTERCEPTOR_TIMEOUT = 'application.interceptor.timeout'; | ||
final String APPLICATION_ROUTER_DEFAULT_MAPPING = 'applixation.router.defaultMapping'; | ||
final String APPLICATION_REQUEST_UN_SUPPORTED_CONTENT_TYPES = 'application.request.unSpportedContentTypes'; | ||
final String APPLICATION_REQUEST_UN_SUPPORTED_METHODS = 'application.request.unSupportedMethods'; | ||
final String APPLICATION_MULTIPART_MAX_FILE_UPLOAD_SIZE = 'application.multipart.maxFileUploadSize'; | ||
final String APPLICATION_MULTIPART_FIX_NAME_SUFFIX_IF_ARRAY = 'application.multipart.fixNameSuffixIfArray'; | ||
final String APPLICATION_MULTIPART_DEFAULT_UPLOAD_TEMP_DIR_PATH = 'application.multipart.defaultUploadTempDirPath'; | ||
final String APPLICATION_RESPONSE_DEFAULT_PRODUCED_TYPE = 'application.response.defaultProducedType'; |
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 |
---|---|---|
@@ -1,10 +1,13 @@ | ||
library q_configure; | ||
|
||
export 'package:Q/src/configure/AbstractConfigure.dart'; | ||
export 'package:Q/src/configure/ApplicationConfigurationMapper.dart'; | ||
export 'package:Q/src/configure/CustomYamlNode.dart'; | ||
export 'package:Q/src/configure/CustomYamlNodeConverter.dart'; | ||
export 'package:Q/src/configure/CustomYamlNodeValueType.dart'; | ||
export 'package:Q/src/configure/CustomYamlPaser.dart'; | ||
export 'package:Q/src/configure/HttpRequestConfigure.dart'; | ||
export 'package:Q/src/configure/HttpResponseConfigure.dart'; | ||
export 'package:Q/src/configure/InterceptorConfigure.dart'; | ||
export 'package:Q/src/configure/MultipartConfigure.dart'; | ||
export 'package:Q/src/configure/RouterMappingConfigure.dart'; |
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,33 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:Q/src/Method.dart'; | ||
import 'package:Q/src/configure/AbstractConfigure.dart'; | ||
|
||
abstract class HttpRequestConfigure extends AbstractConfigure { | ||
factory HttpRequestConfigure() => _HttpRequestConfigure(); | ||
|
||
// 当前不支持的请求类型 | ||
List<ContentType> get unSupportedContentTypes; | ||
|
||
// 当前支持的请求类型 | ||
List<HttpMethod> get unSupportedMethods; | ||
} | ||
|
||
class _HttpRequestConfigure implements HttpRequestConfigure { | ||
List<ContentType> unSupportedContentTypes_ = List(); | ||
|
||
List<HttpMethod> unSupportedMethods_ = List(); | ||
|
||
@override | ||
List<ContentType> get unSupportedContentTypes { | ||
return this.unSupportedContentTypes_; | ||
} | ||
|
||
@override | ||
List<HttpMethod> get unSupportedMethods { | ||
return this.unSupportedMethods_; | ||
} | ||
|
||
@override | ||
Future<dynamic> init() async {} | ||
} |
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,24 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:Q/src/configure/AbstractConfigure.dart'; | ||
|
||
abstract class HttpResponseConfigure extends AbstractConfigure { | ||
factory HttpResponseConfigure() => _HttpResponseConfigure(); | ||
|
||
// 默认返回结果的类型 | ||
ContentType get defaultProducedType; | ||
} | ||
|
||
class _HttpResponseConfigure implements HttpResponseConfigure { | ||
_HttpResponseConfigure(); | ||
|
||
ContentType defaultProducedType_ = ContentType.json; | ||
|
||
@override | ||
ContentType get defaultProducedType { | ||
return this.defaultProducedType_; | ||
} | ||
|
||
@override | ||
Future<dynamic> init() async {} | ||
} |
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
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