Compare commits

..

28 Commits

Author SHA1 Message Date
Luca Frosini eec32da4d7 Merge pull request 'Fixed `getInputStream()` in a `GXInboundResponse` created from a connection, if is not a success response (HTTP code not in `2xx` and `3xx`)' (!1) from mauro.mugnaini/gx-rest:master into master
Reviewed-on: gCubeSystem/gx-rest#1
Reviewed-by: Luca Frosini <luca.frosini@isti.cnr.it>
2024-05-14 15:48:08 +02:00
Mauro Mugnaini b3af1e29f8 Merge pull request 'Update from upstream' (#1) from gCubeSystem/gx-rest:master into master
Reviewed-on: #1
2024-04-29 12:11:30 +02:00
Luca Frosini 74cb5bdaa5 Updated maven-parent 2023-10-05 11:34:36 +02:00
luca.frosini 0d7b341f8e Ignored MacOs File 2023-06-21 11:40:00 +02:00
Mauro Mugnaini 88d588b29c Fixed `getInputStream()` from connection if is not a success response (HTTP code not in `2xx` and `3xx`) 2023-03-22 13:41:47 +01:00
Luca Frosini 4bd280b1c5 Removed ide specific files 2023-03-02 12:07:21 +01:00
Luca Frosini d615a454bb Removed ide specific files 2023-03-02 12:00:13 +01:00
Luca Frosini 1da0e27c42 Cleaning code from dependencies which must be removed 2022-07-15 16:00:24 +02:00
Luca Frosini 2be6f3b7fd Fixed changelog 2022-07-08 15:15:32 +02:00
Luca Frosini 8573d2c6e3 Removed isExtCall because the authorization is not set automatically
anymore
2022-07-08 15:12:58 +02:00
Lucio Lelii 66ce9b8a23 porting to smartgears 4 2022-06-15 17:57:12 +02:00
Luca Frosini b4bbaf8816 Fixed gcube-bom version 2021-06-23 14:49:24 +02:00
Luca Frosini 6ef9d93725 Fixed versions for release 2021-06-23 14:22:19 +02:00
Luca Frosini f4c942ddb6 Removed -SNAPSHOT for release 2021-06-23 12:57:36 +02:00
Luca Frosini e9af3d2d23 Fixed CHANGELOG 2021-05-27 16:10:31 +02:00
Luca Frosini 2ea1c4f820 Merge branch 'master' of gitea@code-repo.d4science.org:gCubeSystem/gx-rest.git 2021-05-27 15:26:19 +02:00
Luca Frosini a26f583a0e Supporting new UMA token 2021-05-27 15:14:24 +02:00
Luca Frosini 86509bb7c3 Moved link from http to https in a comment refs #20779 2021-02-22 09:35:27 +01:00
Luca Frosini 60b9690890 Removed unused class member 2020-10-08 15:55:07 +02:00
Luca Frosini 744a92db82 Removed unused import 2020-10-08 15:54:46 +02:00
Luca Frosini b565aab839 Suppressed deprecation warning 2020-10-08 15:54:35 +02:00
Luca Frosini b84ac8b29b Closed scanner 2020-10-08 15:54:17 +02:00
Luca Frosini 3a6e2fc2ef Ignored generated directory 2020-10-08 14:45:06 +02:00
Luca Frosini 5b8695ba58 Fixed version 2020-08-06 17:48:32 +02:00
Luca Frosini ef270edbd5 Removed eclipse project files 2020-08-06 14:51:52 +02:00
Luca Frosini f027923cdf Switched JSON Management to gcube-jackson 2020-08-06 14:51:24 +02:00
Manuele Simi 93569cd265 Update CHANGELOG.md. 2020-07-23 14:58:02 +02:00
Manuele Simi 8948534883 Add CHANGELOG, README and LICENSE files to each module (as requested by the maven-parent). 2020-06-21 16:34:22 -04:00
77 changed files with 1263 additions and 919 deletions

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

6
.gitignore vendored
View File

@ -1,3 +1,7 @@
token.* token.*
.svn .svn
target target
.classpath
.project
.settings/
/.DS_Store

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="gxHTTP" />
<module name="gxJRS" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="gx-rest" target="1.8" />
<module name="gxHTTP" target="1.8" />
<module name="gxJRS" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gxHTTP" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gxJRS" charset="UTF-8" />
</component>
</project>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: ch.qos.logback:logback-classic:1.0.13">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-classic/1.0.13/logback-classic-1.0.13.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-classic/1.0.13/logback-classic-1.0.13-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-classic/1.0.13/logback-classic-1.0.13-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: ch.qos.logback:logback-core:1.0.13">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-core/1.0.13/logback-core-1.0.13.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-core/1.0.13/logback-core-1.0.13-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/ch/qos/logback/logback-core/1.0.13/logback-core-1.0.13-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.6.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.6.0/jackson-annotations-2.6.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.6.0/jackson-annotations-2.6.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.6.0/jackson-annotations-2.6.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: com.fasterxml.jackson.core:jackson-core:2.6.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.6.0/jackson-core-2.6.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.6.0/jackson-core-2.6.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.6.0/jackson-core-2.6.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: com.fasterxml.jackson.core:jackson-databind:2.6.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.6.0/jackson-databind-2.6.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.6.0/jackson-databind-2.6.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.6.0/jackson-databind-2.6.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: javax.annotation:javax.annotation-api:1.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: javax.ws.rs:javax.ws.rs-api:2.0.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/javax/ws/rs/javax.ws.rs-api/2.0.1/javax.ws.rs-api-2.0.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/javax/ws/rs/javax.ws.rs-api/2.0.1/javax.ws.rs-api-2.0.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/javax/ws/rs/javax.ws.rs-api/2.0.1/javax.ws.rs-api-2.0.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: junit:junit:4.12">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.gcube.common:authorization-client:2.0.6">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/gcube/common/authorization-client/2.0.6/authorization-client-2.0.6.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/gcube/common/authorization-client/2.0.6/authorization-client-2.0.6-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/gcube/common/authorization-client/2.0.6/authorization-client-2.0.6-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.gcube.common:common-authorization:2.2.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/gcube/common/common-authorization/2.2.0/common-authorization-2.2.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/gcube/common/common-authorization/2.2.0/common-authorization-2.2.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/gcube/common/common-authorization/2.2.0/common-authorization-2.2.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.gcube.core:common-configuration-scanner:1.0.0-SNAPSHOT">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/gcube/core/common-configuration-scanner/1.0.0-SNAPSHOT/common-configuration-scanner-1.0.0-20150723.095939-518.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/gcube/core/common-configuration-scanner/1.0.0-SNAPSHOT/common-configuration-scanner-1.0.0-20150723.095939-518-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/gcube/core/common-configuration-scanner/1.0.0-SNAPSHOT/common-configuration-scanner-1.0.0-20150723.095939-518-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.gcube.core:common-scope:1.2.2-SNAPSHOT">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/gcube/core/common-scope/1.2.2-SNAPSHOT/common-scope-1.2.2-20180717.153655-1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/gcube/core/common-scope/1.2.2-SNAPSHOT/common-scope-1.2.2-20180717.153655-1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/gcube/core/common-scope/1.2.2-SNAPSHOT/common-scope-1.2.2-20180717.153655-1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.gcube.core:common-scope-maps:1.2.0-SNAPSHOT">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/gcube/core/common-scope-maps/1.2.0-SNAPSHOT/common-scope-maps-1.2.0-20191106.151101-1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/gcube/core/common-scope-maps/1.2.0-SNAPSHOT/common-scope-maps-1.2.0-20191106.151101-1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/gcube/core/common-scope-maps/1.2.0-SNAPSHOT/common-scope-maps-1.2.0-20191106.151101-1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.hk2.external:aopalliance-repackaged:2.5.0-b32">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/external/aopalliance-repackaged/2.5.0-b32/aopalliance-repackaged-2.5.0-b32.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/external/aopalliance-repackaged/2.5.0-b32/aopalliance-repackaged-2.5.0-b32-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/external/aopalliance-repackaged/2.5.0-b32/aopalliance-repackaged-2.5.0-b32-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.hk2.external:javax.inject:2.5.0-b32">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/external/javax.inject/2.5.0-b32/javax.inject-2.5.0-b32.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/external/javax.inject/2.5.0-b32/javax.inject-2.5.0-b32-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/external/javax.inject/2.5.0-b32/javax.inject-2.5.0-b32-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.hk2:hk2-api:2.5.0-b32">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-api/2.5.0-b32/hk2-api-2.5.0-b32.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-api/2.5.0-b32/hk2-api-2.5.0-b32-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-api/2.5.0-b32/hk2-api-2.5.0-b32-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.hk2:hk2-locator:2.5.0-b32">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-locator/2.5.0-b32/hk2-locator-2.5.0-b32.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-locator/2.5.0-b32/hk2-locator-2.5.0-b32-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-locator/2.5.0-b32/hk2-locator-2.5.0-b32-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.hk2:hk2-utils:2.5.0-b32">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-utils/2.5.0-b32/hk2-utils-2.5.0-b32.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-utils/2.5.0-b32/hk2-utils-2.5.0-b32-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/hk2-utils/2.5.0-b32/hk2-utils-2.5.0-b32-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.hk2:osgi-resource-locator:1.0.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/osgi-resource-locator/1.0.1/osgi-resource-locator-1.0.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/osgi-resource-locator/1.0.1/osgi-resource-locator-1.0.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/hk2/osgi-resource-locator/1.0.1/osgi-resource-locator-1.0.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.jersey.bundles.repackaged:jersey-guava:2.25.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/bundles/repackaged/jersey-guava/2.25.1/jersey-guava-2.25.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/bundles/repackaged/jersey-guava/2.25.1/jersey-guava-2.25.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/bundles/repackaged/jersey-guava/2.25.1/jersey-guava-2.25.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.jersey.core:jersey-client:2.25.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/core/jersey-client/2.25.1/jersey-client-2.25.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/core/jersey-client/2.25.1/jersey-client-2.25.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/core/jersey-client/2.25.1/jersey-client-2.25.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.jersey.core:jersey-common:2.25.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/core/jersey-common/2.25.1/jersey-common-2.25.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/core/jersey-common/2.25.1/jersey-common-2.25.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/core/jersey-common/2.25.1/jersey-common-2.25.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.glassfish.jersey.inject:jersey-hk2:2.27">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/inject/jersey-hk2/2.27/jersey-hk2-2.27.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/inject/jersey-hk2/2.27/jersey-hk2-2.27-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/glassfish/jersey/inject/jersey-hk2/2.27/jersey-hk2-2.27-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.hamcrest:hamcrest-core:1.3">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.javassist:javassist:3.20.0-GA">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.slf4j:slf4j-api:1.7.25">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gxREST</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

46
CHANGELOG.md Normal file
View File

@ -0,0 +1,46 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for gxREST
## [v2.0.0-SNAPSHOT]
- removed all the old providers
- removed set of gcube headers
- removed isExtCall because authorization headers are not added automatically anymore
## [v1.2.0]
- Managing new UMA token and not only old authz gcube token [#21525]
- Switched JSON management to gcube-jackson [#19737]
## [v1.1.3] [r4.20.0] - 2019-10-19
- Allow clients to set secure protocol
- Switch from TLSv1 to TLSv1.2
## [v1.1.2] [r4.20.0] - 2019-10-19
- Migration to Git
## [v1.1.1] [r4.0.0] - 2019-03-30
- Allow to set the media type for the returned entity in the Error Response.
## [v1.1.0] [r4.13.1] - 2019-02-26
- ...
## [v1.0.1] [r4.13.0] - 2018-11-20
- ...
## [v1.0.0] [r4.12.0] - 2018-06-20
- First Release

312
LICENSE.md Normal file
View File

@ -0,0 +1,312 @@
# European Union Public Licence V. 1.1
EUPL © the European Community 2007
This European Union Public Licence (the “EUPL”) applies to the Work or Software
(as defined below) which is provided under the terms of this Licence. Any use of
the Work, other than as authorised under this Licence is prohibited (to the
extent such use is covered by a right of the copyright holder of the Work).
The Original Work is provided under the terms of this Licence when the Licensor
(as defined below) has placed the following notice immediately following the
copyright notice for the Original Work:
Licensed under the EUPL V.1.1
or has expressed by any other mean his willingness to license under the EUPL.
## 1. Definitions
In this Licence, the following terms have the following meaning:
- The Licence: this Licence.
- The Original Work or the Software: the software distributed and/or
communicated by the Licensor under this Licence, available as Source Code and
also as Executable Code as the case may be.
- Derivative Works: the works or software that could be created by the Licensee,
based upon the Original Work or modifications thereof. This Licence does not
define the extent of modification or dependence on the Original Work required
in order to classify a work as a Derivative Work; this extent is determined by
copyright law applicable in the country mentioned in Article 15.
- The Work: the Original Work and/or its Derivative Works.
- The Source Code: the human-readable form of the Work which is the most
convenient for people to study and modify.
- The Executable Code: any code which has generally been compiled and which is
meant to be interpreted by a computer as a program.
- The Licensor: the natural or legal person that distributes and/or communicates
the Work under the Licence.
- Contributor(s): any natural or legal person who modifies the Work under the
Licence, or otherwise contributes to the creation of a Derivative Work.
- The Licensee or “You”: any natural or legal person who makes any usage of the
Software under the terms of the Licence.
- Distribution and/or Communication: any act of selling, giving, lending,
renting, distributing, communicating, transmitting, or otherwise making
available, on-line or off-line, copies of the Work or providing access to its
essential functionalities at the disposal of any other natural or legal
person.
## 2. Scope of the rights granted by the Licence
The Licensor hereby grants You a world-wide, royalty-free, non-exclusive,
sub-licensable licence to do the following, for the duration of copyright vested
in the Original Work:
- use the Work in any circumstance and for all usage, reproduce the Work, modify
- the Original Work, and make Derivative Works based upon the Work, communicate
- to the public, including the right to make available or display the Work or
- copies thereof to the public and perform publicly, as the case may be, the
- Work, distribute the Work or copies thereof, lend and rent the Work or copies
- thereof, sub-license rights in the Work or copies thereof.
Those rights can be exercised on any media, supports and formats, whether now
known or later invented, as far as the applicable law permits so.
In the countries where moral rights apply, the Licensor waives his right to
exercise his moral right to the extent allowed by law in order to make effective
the licence of the economic rights here above listed.
The Licensor grants to the Licensee royalty-free, non exclusive usage rights to
any patents held by the Licensor, to the extent necessary to make use of the
rights granted on the Work under this Licence.
## 3. Communication of the Source Code
The Licensor may provide the Work either in its Source Code form, or as
Executable Code. If the Work is provided as Executable Code, the Licensor
provides in addition a machine-readable copy of the Source Code of the Work
along with each copy of the Work that the Licensor distributes or indicates, in
a notice following the copyright notice attached to the Work, a repository where
the Source Code is easily and freely accessible for as long as the Licensor
continues to distribute and/or communicate the Work.
## 4. Limitations on copyright
Nothing in this Licence is intended to deprive the Licensee of the benefits from
any exception or limitation to the exclusive rights of the rights owners in the
Original Work or Software, of the exhaustion of those rights or of other
applicable limitations thereto.
## 5. Obligations of the Licensee
The grant of the rights mentioned above is subject to some restrictions and
obligations imposed on the Licensee. Those obligations are the following:
Attribution right: the Licensee shall keep intact all copyright, patent or
trademarks notices and all notices that refer to the Licence and to the
disclaimer of warranties. The Licensee must include a copy of such notices and a
copy of the Licence with every copy of the Work he/she distributes and/or
communicates. The Licensee must cause any Derivative Work to carry prominent
notices stating that the Work has been modified and the date of modification.
Copyleft clause: If the Licensee distributes and/or communicates copies of the
Original Works or Derivative Works based upon the Original Work, this
Distribution and/or Communication will be done under the terms of this Licence
or of a later version of this Licence unless the Original Work is expressly
distributed only under this version of the Licence. The Licensee (becoming
Licensor) cannot offer or impose any additional terms or conditions on the Work
or Derivative Work that alter or restrict the terms of the Licence.
Compatibility clause: If the Licensee Distributes and/or Communicates Derivative
Works or copies thereof based upon both the Original Work and another work
licensed under a Compatible Licence, this Distribution and/or Communication can
be done under the terms of this Compatible Licence. For the sake of this clause,
“Compatible Licence” refers to the licences listed in the appendix attached to
this Licence. Should the Licensees obligations under the Compatible Licence
conflict with his/her obligations under this Licence, the obligations of the
Compatible Licence shall prevail.
Provision of Source Code: When distributing and/or communicating copies of the
Work, the Licensee will provide a machine-readable copy of the Source Code or
indicate a repository where this Source will be easily and freely available for
as long as the Licensee continues to distribute and/or communicate the Work.
Legal Protection: This Licence does not grant permission to use the trade names,
trademarks, service marks, or names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the copyright notice.
## 6. Chain of Authorship
The original Licensor warrants that the copyright in the Original Work granted
hereunder is owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each Contributor warrants that the copyright in the modifications he/she brings
to the Work are owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each time You accept the Licence, the original Licensor and subsequent
Contributors grant You a licence to their contributions to the Work, under the
terms of this Licence.
## 7. Disclaimer of Warranty
The Work is a work in progress, which is continuously improved by numerous
contributors. It is not a finished work and may therefore contain defects or
“bugs” inherent to this type of software development.
For the above reason, the Work is provided under the Licence on an “as is” basis
and without warranties of any kind concerning the Work, including without
limitation merchantability, fitness for a particular purpose, absence of defects
or errors, accuracy, non-infringement of intellectual property rights other than
copyright as stated in Article 6 of this Licence.
This disclaimer of warranty is an essential part of the Licence and a condition
for the grant of any rights to the Work.
## 8. Disclaimer of Liability
Except in the cases of wilful misconduct or damages directly caused to natural
persons, the Licensor will in no event be liable for any direct or indirect,
material or moral, damages of any kind, arising out of the Licence or of the use
of the Work, including without limitation, damages for loss of goodwill, work
stoppage, computer failure or malfunction, loss of data or any commercial
damage, even if the Licensor has been advised of the possibility of such
damage. However, the Licensor will be liable under statutory product liability
laws as far such laws apply to the Work.
## 9. Additional agreements
While distributing the Original Work or Derivative Works, You may choose to
conclude an additional agreement to offer, and charge a fee for, acceptance of
support, warranty, indemnity, or other liability obligations and/or services
consistent with this Licence. However, in accepting such obligations, You may
act only on your own behalf and on your sole responsibility, not on behalf of
the original Licensor or any other Contributor, and only if You agree to
indemnify, defend, and hold each Contributor harmless for any liability incurred
by, or claims asserted against such Contributor by the fact You have accepted
any such warranty or additional liability.
## 10. Acceptance of the Licence
The provisions of this Licence can be accepted by clicking on an icon “I agree”
placed under the bottom of a window displaying the text of this Licence or by
affirming consent in any other similar way, in accordance with the rules of
applicable law. Clicking on that icon indicates your clear and irrevocable
acceptance of this Licence and all of its terms and conditions.
Similarly, you irrevocably accept this Licence and all of its terms and
conditions by exercising any rights granted to You by Article 2 of this Licence,
such as the use of the Work, the creation by You of a Derivative Work or the
Distribution and/or Communication by You of the Work or copies thereof.
## 11. Information to the public
In case of any Distribution and/or Communication of the Work by means of
electronic communication by You (for example, by offering to download the Work
from a remote location) the distribution channel or media (for example, a
website) must at least provide to the public the information requested by the
applicable law regarding the Licensor, the Licence and the way it may be
accessible, concluded, stored and reproduced by the Licensee.
## 12. Termination of the Licence
The Licence and the rights granted hereunder will terminate automatically upon
any breach by the Licensee of the terms of the Licence.
Such a termination will not terminate the licences of any person who has
received the Work from the Licensee under the Licence, provided such persons
remain in full compliance with the Licence.
## 13. Miscellaneous
Without prejudice of Article 9 above, the Licence represents the complete
agreement between the Parties as to the Work licensed hereunder.
If any provision of the Licence is invalid or unenforceable under applicable
law, this will not affect the validity or enforceability of the Licence as a
whole. Such provision will be construed and/or reformed so as necessary to make
it valid and enforceable.
The European Commission may publish other linguistic versions and/or new
versions of this Licence, so far this is required and reasonable, without
reducing the scope of the rights granted by the Licence. New versions of the
Licence will be published with a unique version number.
All linguistic versions of this Licence, approved by the European Commission,
have identical value. Parties can take advantage of the linguistic version of
their choice.
## 14. Jurisdiction
Any litigation resulting from the interpretation of this License, arising
between the European Commission, as a Licensor, and any Licensee, will be
subject to the jurisdiction of the Court of Justice of the European Communities,
as laid down in article 238 of the Treaty establishing the European Community.
Any litigation arising between Parties, other than the European Commission, and
resulting from the interpretation of this License, will be subject to the
exclusive jurisdiction of the competent court where the Licensor resides or
conducts its primary business.
## 15. Applicable Law
This Licence shall be governed by the law of the European Union country where
the Licensor resides or has his registered office.
This licence shall be governed by the Belgian law if:
- a litigation arises between the European Commission, as a Licensor, and any
- Licensee; the Licensor, other than the European Commission, has no residence
- or registered office inside a European Union country.
## Appendix
“Compatible Licences” according to article 5 EUPL are:
- GNU General Public License (GNU GPL) v. 2
- Open Software License (OSL) v. 2.1, v. 3.0
- Common Public License v. 1.0
- Eclipse Public License v. 1.0
- Cecill v. 2.0

View File

@ -1,5 +1,6 @@
gxRest # gxREST
----
The gCube eXtensions to the Rest Protocol (gxRest) is a set of Java libraries designed to provide convenient round-trip interaction between a Restful web application (also known as "service") and its clients. The gCube eXtensions to the Rest Protocol (gxRest) is a set of Java libraries designed to provide convenient round-trip interaction between a Restful web application (also known as "service") and its clients.
gxRest has the flexibility for different degrees of exploitation: gxRest has the flexibility for different degrees of exploitation:

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

5
gxHTTP/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
/.classpath
/bin/
.project
.settings/
target/

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gxHTTP</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -1,6 +0,0 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@ -1,5 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

46
gxHTTP/CHANGELOG.md Normal file
View File

@ -0,0 +1,46 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for gxHTTP
## [v2.0.0-SNAPSHOT]
- removed all the old providers
- removed set of gcube headers
- removed isExtCall because authorization headers are not added automatically anymore
## [v1.2.0]
- Managing new UMA token and not only old authz gcube token [#21525]
- Switched JSON management to gcube-jackson [#19737]
## [v1.1.3] [r4.20.0] - 2019-10-19
- Allow clients to set secure protocol
- Switch from TLSv1 to TLSv1.2
## [v1.1.2] [r4.20.0] - 2019-10-19
- Migration to Git
## [v1.1.1] [r4.0.0] - 2019-03-30
- Allow to set the media type for the returned entity in the Error Response.
## [v1.1.0] [r4.13.1] - 2019-02-26
- ...
## [v1.0.1] [r4.13.0] - 2018-11-20
- ...
## [v1.0.0] [r4.12.0] - 2018-06-20
- First Release

312
gxHTTP/LICENSE.md Normal file
View File

@ -0,0 +1,312 @@
# European Union Public Licence V. 1.1
EUPL © the European Community 2007
This European Union Public Licence (the “EUPL”) applies to the Work or Software
(as defined below) which is provided under the terms of this Licence. Any use of
the Work, other than as authorised under this Licence is prohibited (to the
extent such use is covered by a right of the copyright holder of the Work).
The Original Work is provided under the terms of this Licence when the Licensor
(as defined below) has placed the following notice immediately following the
copyright notice for the Original Work:
Licensed under the EUPL V.1.1
or has expressed by any other mean his willingness to license under the EUPL.
## 1. Definitions
In this Licence, the following terms have the following meaning:
- The Licence: this Licence.
- The Original Work or the Software: the software distributed and/or
communicated by the Licensor under this Licence, available as Source Code and
also as Executable Code as the case may be.
- Derivative Works: the works or software that could be created by the Licensee,
based upon the Original Work or modifications thereof. This Licence does not
define the extent of modification or dependence on the Original Work required
in order to classify a work as a Derivative Work; this extent is determined by
copyright law applicable in the country mentioned in Article 15.
- The Work: the Original Work and/or its Derivative Works.
- The Source Code: the human-readable form of the Work which is the most
convenient for people to study and modify.
- The Executable Code: any code which has generally been compiled and which is
meant to be interpreted by a computer as a program.
- The Licensor: the natural or legal person that distributes and/or communicates
the Work under the Licence.
- Contributor(s): any natural or legal person who modifies the Work under the
Licence, or otherwise contributes to the creation of a Derivative Work.
- The Licensee or “You”: any natural or legal person who makes any usage of the
Software under the terms of the Licence.
- Distribution and/or Communication: any act of selling, giving, lending,
renting, distributing, communicating, transmitting, or otherwise making
available, on-line or off-line, copies of the Work or providing access to its
essential functionalities at the disposal of any other natural or legal
person.
## 2. Scope of the rights granted by the Licence
The Licensor hereby grants You a world-wide, royalty-free, non-exclusive,
sub-licensable licence to do the following, for the duration of copyright vested
in the Original Work:
- use the Work in any circumstance and for all usage, reproduce the Work, modify
- the Original Work, and make Derivative Works based upon the Work, communicate
- to the public, including the right to make available or display the Work or
- copies thereof to the public and perform publicly, as the case may be, the
- Work, distribute the Work or copies thereof, lend and rent the Work or copies
- thereof, sub-license rights in the Work or copies thereof.
Those rights can be exercised on any media, supports and formats, whether now
known or later invented, as far as the applicable law permits so.
In the countries where moral rights apply, the Licensor waives his right to
exercise his moral right to the extent allowed by law in order to make effective
the licence of the economic rights here above listed.
The Licensor grants to the Licensee royalty-free, non exclusive usage rights to
any patents held by the Licensor, to the extent necessary to make use of the
rights granted on the Work under this Licence.
## 3. Communication of the Source Code
The Licensor may provide the Work either in its Source Code form, or as
Executable Code. If the Work is provided as Executable Code, the Licensor
provides in addition a machine-readable copy of the Source Code of the Work
along with each copy of the Work that the Licensor distributes or indicates, in
a notice following the copyright notice attached to the Work, a repository where
the Source Code is easily and freely accessible for as long as the Licensor
continues to distribute and/or communicate the Work.
## 4. Limitations on copyright
Nothing in this Licence is intended to deprive the Licensee of the benefits from
any exception or limitation to the exclusive rights of the rights owners in the
Original Work or Software, of the exhaustion of those rights or of other
applicable limitations thereto.
## 5. Obligations of the Licensee
The grant of the rights mentioned above is subject to some restrictions and
obligations imposed on the Licensee. Those obligations are the following:
Attribution right: the Licensee shall keep intact all copyright, patent or
trademarks notices and all notices that refer to the Licence and to the
disclaimer of warranties. The Licensee must include a copy of such notices and a
copy of the Licence with every copy of the Work he/she distributes and/or
communicates. The Licensee must cause any Derivative Work to carry prominent
notices stating that the Work has been modified and the date of modification.
Copyleft clause: If the Licensee distributes and/or communicates copies of the
Original Works or Derivative Works based upon the Original Work, this
Distribution and/or Communication will be done under the terms of this Licence
or of a later version of this Licence unless the Original Work is expressly
distributed only under this version of the Licence. The Licensee (becoming
Licensor) cannot offer or impose any additional terms or conditions on the Work
or Derivative Work that alter or restrict the terms of the Licence.
Compatibility clause: If the Licensee Distributes and/or Communicates Derivative
Works or copies thereof based upon both the Original Work and another work
licensed under a Compatible Licence, this Distribution and/or Communication can
be done under the terms of this Compatible Licence. For the sake of this clause,
“Compatible Licence” refers to the licences listed in the appendix attached to
this Licence. Should the Licensees obligations under the Compatible Licence
conflict with his/her obligations under this Licence, the obligations of the
Compatible Licence shall prevail.
Provision of Source Code: When distributing and/or communicating copies of the
Work, the Licensee will provide a machine-readable copy of the Source Code or
indicate a repository where this Source will be easily and freely available for
as long as the Licensee continues to distribute and/or communicate the Work.
Legal Protection: This Licence does not grant permission to use the trade names,
trademarks, service marks, or names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the copyright notice.
## 6. Chain of Authorship
The original Licensor warrants that the copyright in the Original Work granted
hereunder is owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each Contributor warrants that the copyright in the modifications he/she brings
to the Work are owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each time You accept the Licence, the original Licensor and subsequent
Contributors grant You a licence to their contributions to the Work, under the
terms of this Licence.
## 7. Disclaimer of Warranty
The Work is a work in progress, which is continuously improved by numerous
contributors. It is not a finished work and may therefore contain defects or
“bugs” inherent to this type of software development.
For the above reason, the Work is provided under the Licence on an “as is” basis
and without warranties of any kind concerning the Work, including without
limitation merchantability, fitness for a particular purpose, absence of defects
or errors, accuracy, non-infringement of intellectual property rights other than
copyright as stated in Article 6 of this Licence.
This disclaimer of warranty is an essential part of the Licence and a condition
for the grant of any rights to the Work.
## 8. Disclaimer of Liability
Except in the cases of wilful misconduct or damages directly caused to natural
persons, the Licensor will in no event be liable for any direct or indirect,
material or moral, damages of any kind, arising out of the Licence or of the use
of the Work, including without limitation, damages for loss of goodwill, work
stoppage, computer failure or malfunction, loss of data or any commercial
damage, even if the Licensor has been advised of the possibility of such
damage. However, the Licensor will be liable under statutory product liability
laws as far such laws apply to the Work.
## 9. Additional agreements
While distributing the Original Work or Derivative Works, You may choose to
conclude an additional agreement to offer, and charge a fee for, acceptance of
support, warranty, indemnity, or other liability obligations and/or services
consistent with this Licence. However, in accepting such obligations, You may
act only on your own behalf and on your sole responsibility, not on behalf of
the original Licensor or any other Contributor, and only if You agree to
indemnify, defend, and hold each Contributor harmless for any liability incurred
by, or claims asserted against such Contributor by the fact You have accepted
any such warranty or additional liability.
## 10. Acceptance of the Licence
The provisions of this Licence can be accepted by clicking on an icon “I agree”
placed under the bottom of a window displaying the text of this Licence or by
affirming consent in any other similar way, in accordance with the rules of
applicable law. Clicking on that icon indicates your clear and irrevocable
acceptance of this Licence and all of its terms and conditions.
Similarly, you irrevocably accept this Licence and all of its terms and
conditions by exercising any rights granted to You by Article 2 of this Licence,
such as the use of the Work, the creation by You of a Derivative Work or the
Distribution and/or Communication by You of the Work or copies thereof.
## 11. Information to the public
In case of any Distribution and/or Communication of the Work by means of
electronic communication by You (for example, by offering to download the Work
from a remote location) the distribution channel or media (for example, a
website) must at least provide to the public the information requested by the
applicable law regarding the Licensor, the Licence and the way it may be
accessible, concluded, stored and reproduced by the Licensee.
## 12. Termination of the Licence
The Licence and the rights granted hereunder will terminate automatically upon
any breach by the Licensee of the terms of the Licence.
Such a termination will not terminate the licences of any person who has
received the Work from the Licensee under the Licence, provided such persons
remain in full compliance with the Licence.
## 13. Miscellaneous
Without prejudice of Article 9 above, the Licence represents the complete
agreement between the Parties as to the Work licensed hereunder.
If any provision of the Licence is invalid or unenforceable under applicable
law, this will not affect the validity or enforceability of the Licence as a
whole. Such provision will be construed and/or reformed so as necessary to make
it valid and enforceable.
The European Commission may publish other linguistic versions and/or new
versions of this Licence, so far this is required and reasonable, without
reducing the scope of the rights granted by the Licence. New versions of the
Licence will be published with a unique version number.
All linguistic versions of this Licence, approved by the European Commission,
have identical value. Parties can take advantage of the linguistic version of
their choice.
## 14. Jurisdiction
Any litigation resulting from the interpretation of this License, arising
between the European Commission, as a Licensor, and any Licensee, will be
subject to the jurisdiction of the Court of Justice of the European Communities,
as laid down in article 238 of the Treaty establishing the European Community.
Any litigation arising between Parties, other than the European Commission, and
resulting from the interpretation of this License, will be subject to the
exclusive jurisdiction of the competent court where the Licensor resides or
conducts its primary business.
## 15. Applicable Law
This Licence shall be governed by the law of the European Union country where
the Licensor resides or has his registered office.
This licence shall be governed by the Belgian law if:
- a litigation arises between the European Commission, as a Licensor, and any
- Licensee; the Licensor, other than the European Commission, has no residence
- or registered office inside a European Union country.
## Appendix
“Compatible Licences” according to article 5 EUPL are:
- GNU General Public License (GNU GPL) v. 2
- Open Software License (OSL) v. 2.1, v. 3.0
- Common Public License v. 1.0
- Eclipse Public License v. 1.0
- Cecill v. 2.0

18
gxHTTP/README.md Normal file
View File

@ -0,0 +1,18 @@
gxHTTP
----
The gCube eXtensions to the HTTP protocol.
## Documentation
* [gxHTTP](https://wiki.gcube-system.org/gcube/GxRest/GxHTTP)
## Deployment
Notes about how to deploy this component on an infrastructure or link to wiki doc (if any).
## Built With
* [Jersey](https://jersey.github.io/) - JAX-RS runtime
* [Maven](https://maven.apache.org/) - Dependency Management
## License
See [LICENSE.md](LICENSE.md)

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.gcube.common:authorization-client:2.0.6" level="project" />
<orderEntry type="library" name="Maven: org.gcube.common:common-authorization:2.2.0" level="project" />
<orderEntry type="library" name="Maven: org.gcube.core:common-scope:1.2.2-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.gcube.core:common-configuration-scanner:1.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.gcube.core:common-scope-maps:1.2.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
</component>
</module>

View File

@ -7,11 +7,11 @@
<parent> <parent>
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>
<artifactId>gxREST</artifactId> <artifactId>gxREST</artifactId>
<version>1.1.3</version> <version>2.0.0-SNAPSHOT</version>
</parent> </parent>
<groupId>org.gcube.common</groupId>
<artifactId>gxHTTP</artifactId> <artifactId>gxHTTP</artifactId>
<packaging>jar</packaging>
<name>gCube eXtensions to REST with HTTP</name> <name>gCube eXtensions to REST with HTTP</name>
<description>gCube eXtensions to REST based on HTTP</description> <description>gCube eXtensions to REST based on HTTP</description>
@ -28,15 +28,9 @@
</scm> </scm>
<dependencies> <dependencies>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
@ -45,19 +39,5 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-servicearchive</id>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -14,7 +14,6 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.gxhttp.request.GXHTTPStringRequest; import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -52,8 +51,7 @@ public class GXConnection {
private String body; private String body;
private InputStream bodyAsStream; private InputStream bodyAsStream;
private Map<String, String> properties = new HashMap<>(); private Map<String, String> properties = new HashMap<>();
private boolean extCall = false;
public GXConnection(String address) { public GXConnection(String address) {
this.address = address; this.address = address;
} }
@ -118,17 +116,12 @@ public class GXConnection {
public HttpURLConnection send(HTTPMETHOD method) throws Exception { public HttpURLConnection send(HTTPMETHOD method) throws Exception {
return send(this.buildURL(), method); return send(this.buildURL(), method);
} }
private HttpURLConnection send(URL url, HTTPMETHOD method) throws Exception { private HttpURLConnection send(URL url, HTTPMETHOD method) throws Exception {
HttpURLConnection uConn = (HttpURLConnection) url.openConnection(); HttpURLConnection uConn = (HttpURLConnection) url.openConnection();
if (!this.extCall) {
String token = SecurityTokenProvider.instance.get(); //uConn = addGCubeAuthorizationToken(uConn);
if (Objects.isNull(token) || token.isEmpty())
throw new IllegalStateException("The security token in the current environment is null.");
uConn.setRequestProperty(org.gcube.common.authorization.client.Constants.TOKEN_HEADER_ENTRY,
token);
}
uConn.setDoOutput(true); uConn.setDoOutput(true);
// uConn.setRequestProperty("Content-type", APPLICATION_JSON_CHARSET_UTF_8); // uConn.setRequestProperty("Content-type", APPLICATION_JSON_CHARSET_UTF_8);
if(this.agent!=null) { if(this.agent!=null) {
@ -172,7 +165,7 @@ public class GXConnection {
} }
return uConn; return uConn;
} }
private URL getURL(String urlString) throws MalformedURLException { private URL getURL(String urlString) throws MalformedURLException {
URL url = new URL(urlString); URL url = new URL(urlString);
if (url.getProtocol().equals("https")) { if (url.getProtocol().equals("https")) {
@ -245,19 +238,5 @@ public class GXConnection {
public void setProperty(String name, String value) { public void setProperty(String name, String value) {
this.properties.put(name, value); this.properties.put(name, value);
} }
/**
* @param extCall the extCall to set
*/
public void setExtCall(boolean extCall) {
this.extCall = extCall;
}
/**
* @return the extCall
*/
public boolean isExtCall() {
return extCall;
}
} }

View File

@ -85,17 +85,6 @@ public interface GXHTTP<BODY,RESPONSE> {
* @throws Exception * @throws Exception
*/ */
RESPONSE connect() throws Exception; RESPONSE connect() throws Exception;
/**
* Overrides the default security token.
* @param token the new token
*/
void setSecurityToken(String token);
/**
* States if the service being called in an external service (not gCube).
* @param ext true if external, false otherwise
*/
void isExternalCall(boolean ext);
} }

View File

@ -4,8 +4,8 @@ import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Objects;
import org.gcube.common.gxhttp.reference.GXConnection.HTTPMETHOD; import org.gcube.common.gxhttp.reference.GXConnection.HTTPMETHOD;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -15,6 +15,7 @@ import org.slf4j.LoggerFactory;
* Builder for GXHTTP Requests. * Builder for GXHTTP Requests.
* *
* @author Manuele Simi (ISTI CNR) * @author Manuele Simi (ISTI CNR)
* @author Luca Frosini (ISTI-CNR)
* *
*/ */
public class GXHTTPRequestBuilder { public class GXHTTPRequestBuilder {
@ -74,19 +75,9 @@ public class GXHTTPRequestBuilder {
return this; return this;
} }
public static final String UUID_REGEX = "^([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}-[a-fA-F0-9]{8,9}){1}$";
/**
* Overrides the default security token.
*
* @param token
*/
public void setSecurityToken(String token) {
if (!this.connection.isExtCall())
this.connection.setProperty(org.gcube.common.authorization.client.Constants.TOKEN_HEADER_ENTRY, token);
else
throw new UnsupportedOperationException("Cannot set the security token on an external call");
}
/** /**
* Add headers to the request. * Add headers to the request.
* *
@ -196,12 +187,4 @@ public class GXHTTPRequestBuilder {
return this.connection.send(HTTPMETHOD.CONNECT); return this.connection.send(HTTPMETHOD.CONNECT);
} }
/*
* (non-Javadoc)
*
* @see org.gcube.common.gxrest.request.GXHTTP#isExternalCall(boolean)
*/
public void isExternalCall(boolean ext) {
this.connection.setExtCall(ext);
}
} }

View File

@ -83,20 +83,6 @@ class GXHTTPCommonRequest {
public HttpURLConnection connect() throws Exception { public HttpURLConnection connect() throws Exception {
return builder.connect(); return builder.connect();
} }
/* (non-Javadoc)
* @see org.gcube.common.gxhttp.reference.GXHTTP#setSecurityToken(java.lang.String)
*/
public void setSecurityToken(String token) {
builder.setSecurityToken(token);
}
/* (non-Javadoc)
* @see org.gcube.common.gxhttp.reference.GXHTTP#isExternalCall(boolean)
*/
public void isExternalCall(boolean ext) {
builder.isExternalCall(ext);
}
/** /**
* Clear up the request. * Clear up the request.

View File

@ -1,6 +1,7 @@
package org.gcube.common.gxhttp; package org.gcube.common.gxhttp;
import static org.junit.Assert.*; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -9,15 +10,9 @@ import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import org.gcube.common.authorization.client.Constants;
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
import org.gcube.common.authorization.library.AuthorizationEntry;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.gxhttp.request.GXHTTPStringRequest; import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
import org.gcube.common.gxhttp.util.ContentUtils; import org.gcube.common.gxhttp.util.ContentUtils;
import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
@ -55,30 +50,6 @@ public class GXHTTPStringRequestTest {
} }
} }
@BeforeClass
public static void beforeClass() throws Exception {
setContext(DEFAULT_TEST_SCOPE);
}
public static void setContext(String token) throws ObjectNotFound, Exception {
if (DEFAULT_TEST_SCOPE.isEmpty()) {
skipTest = true;
return;
}
SecurityTokenProvider.instance.set(token);
}
public static String getCurrentScope(String token) throws ObjectNotFound, Exception {
AuthorizationEntry authorizationEntry = Constants.authorizationService().get(token);
String context = authorizationEntry.getContext();
return context;
}
@AfterClass
public static void afterClass() throws Exception {
SecurityTokenProvider.instance.reset();
}
/** /**
* Test method for {@link org.gcube.common.gxhttp.request.GXHTTPStringRequest#newRequest(java.lang.String)}. * Test method for {@link org.gcube.common.gxhttp.request.GXHTTPStringRequest#newRequest(java.lang.String)}.
*/ */

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

5
gxJRS/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
/.classpath
/bin/
.project
.settings/
target/

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gxRest</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -1,6 +0,0 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@ -1,5 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

45
gxJRS/CHANGELOG.md Normal file
View File

@ -0,0 +1,45 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for gxJRS
## [v2.0.0-SNAPSHOT]
- removed all the old providers
- removed set of gcube headers
- removed isExtCall because authorization headers are not added automatically anymore
## [v1.2.0]
- Managing new UMA token and not only old authz gcube token [#21525]
- Switched JSON management to gcube-jackson [#19737]
## [v1.1.3] [r4.20.0] - 2019-10-19
- Allow clients to set secure protocol
- Switch from TLSv1 to TLSv1.2
## [v1.1.2] [r4.20.0] - 2019-10-19
- Migration to Git
## [v1.1.1] [r4.0.0] - 2019-03-30
- Allow to set the media type for the returned entity in the Error Response.
## [v1.1.0] [r4.13.1] - 2019-02-26
- ...
## [v1.0.1] [r4.13.0] - 2018-11-20
- ...
## [v1.0.0] [r4.12.0] - 2018-06-20
- First Release

312
gxJRS/LICENSE.md Normal file
View File

@ -0,0 +1,312 @@
# European Union Public Licence V. 1.1
EUPL © the European Community 2007
This European Union Public Licence (the “EUPL”) applies to the Work or Software
(as defined below) which is provided under the terms of this Licence. Any use of
the Work, other than as authorised under this Licence is prohibited (to the
extent such use is covered by a right of the copyright holder of the Work).
The Original Work is provided under the terms of this Licence when the Licensor
(as defined below) has placed the following notice immediately following the
copyright notice for the Original Work:
Licensed under the EUPL V.1.1
or has expressed by any other mean his willingness to license under the EUPL.
## 1. Definitions
In this Licence, the following terms have the following meaning:
- The Licence: this Licence.
- The Original Work or the Software: the software distributed and/or
communicated by the Licensor under this Licence, available as Source Code and
also as Executable Code as the case may be.
- Derivative Works: the works or software that could be created by the Licensee,
based upon the Original Work or modifications thereof. This Licence does not
define the extent of modification or dependence on the Original Work required
in order to classify a work as a Derivative Work; this extent is determined by
copyright law applicable in the country mentioned in Article 15.
- The Work: the Original Work and/or its Derivative Works.
- The Source Code: the human-readable form of the Work which is the most
convenient for people to study and modify.
- The Executable Code: any code which has generally been compiled and which is
meant to be interpreted by a computer as a program.
- The Licensor: the natural or legal person that distributes and/or communicates
the Work under the Licence.
- Contributor(s): any natural or legal person who modifies the Work under the
Licence, or otherwise contributes to the creation of a Derivative Work.
- The Licensee or “You”: any natural or legal person who makes any usage of the
Software under the terms of the Licence.
- Distribution and/or Communication: any act of selling, giving, lending,
renting, distributing, communicating, transmitting, or otherwise making
available, on-line or off-line, copies of the Work or providing access to its
essential functionalities at the disposal of any other natural or legal
person.
## 2. Scope of the rights granted by the Licence
The Licensor hereby grants You a world-wide, royalty-free, non-exclusive,
sub-licensable licence to do the following, for the duration of copyright vested
in the Original Work:
- use the Work in any circumstance and for all usage, reproduce the Work, modify
- the Original Work, and make Derivative Works based upon the Work, communicate
- to the public, including the right to make available or display the Work or
- copies thereof to the public and perform publicly, as the case may be, the
- Work, distribute the Work or copies thereof, lend and rent the Work or copies
- thereof, sub-license rights in the Work or copies thereof.
Those rights can be exercised on any media, supports and formats, whether now
known or later invented, as far as the applicable law permits so.
In the countries where moral rights apply, the Licensor waives his right to
exercise his moral right to the extent allowed by law in order to make effective
the licence of the economic rights here above listed.
The Licensor grants to the Licensee royalty-free, non exclusive usage rights to
any patents held by the Licensor, to the extent necessary to make use of the
rights granted on the Work under this Licence.
## 3. Communication of the Source Code
The Licensor may provide the Work either in its Source Code form, or as
Executable Code. If the Work is provided as Executable Code, the Licensor
provides in addition a machine-readable copy of the Source Code of the Work
along with each copy of the Work that the Licensor distributes or indicates, in
a notice following the copyright notice attached to the Work, a repository where
the Source Code is easily and freely accessible for as long as the Licensor
continues to distribute and/or communicate the Work.
## 4. Limitations on copyright
Nothing in this Licence is intended to deprive the Licensee of the benefits from
any exception or limitation to the exclusive rights of the rights owners in the
Original Work or Software, of the exhaustion of those rights or of other
applicable limitations thereto.
## 5. Obligations of the Licensee
The grant of the rights mentioned above is subject to some restrictions and
obligations imposed on the Licensee. Those obligations are the following:
Attribution right: the Licensee shall keep intact all copyright, patent or
trademarks notices and all notices that refer to the Licence and to the
disclaimer of warranties. The Licensee must include a copy of such notices and a
copy of the Licence with every copy of the Work he/she distributes and/or
communicates. The Licensee must cause any Derivative Work to carry prominent
notices stating that the Work has been modified and the date of modification.
Copyleft clause: If the Licensee distributes and/or communicates copies of the
Original Works or Derivative Works based upon the Original Work, this
Distribution and/or Communication will be done under the terms of this Licence
or of a later version of this Licence unless the Original Work is expressly
distributed only under this version of the Licence. The Licensee (becoming
Licensor) cannot offer or impose any additional terms or conditions on the Work
or Derivative Work that alter or restrict the terms of the Licence.
Compatibility clause: If the Licensee Distributes and/or Communicates Derivative
Works or copies thereof based upon both the Original Work and another work
licensed under a Compatible Licence, this Distribution and/or Communication can
be done under the terms of this Compatible Licence. For the sake of this clause,
“Compatible Licence” refers to the licences listed in the appendix attached to
this Licence. Should the Licensees obligations under the Compatible Licence
conflict with his/her obligations under this Licence, the obligations of the
Compatible Licence shall prevail.
Provision of Source Code: When distributing and/or communicating copies of the
Work, the Licensee will provide a machine-readable copy of the Source Code or
indicate a repository where this Source will be easily and freely available for
as long as the Licensee continues to distribute and/or communicate the Work.
Legal Protection: This Licence does not grant permission to use the trade names,
trademarks, service marks, or names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the copyright notice.
## 6. Chain of Authorship
The original Licensor warrants that the copyright in the Original Work granted
hereunder is owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each Contributor warrants that the copyright in the modifications he/she brings
to the Work are owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each time You accept the Licence, the original Licensor and subsequent
Contributors grant You a licence to their contributions to the Work, under the
terms of this Licence.
## 7. Disclaimer of Warranty
The Work is a work in progress, which is continuously improved by numerous
contributors. It is not a finished work and may therefore contain defects or
“bugs” inherent to this type of software development.
For the above reason, the Work is provided under the Licence on an “as is” basis
and without warranties of any kind concerning the Work, including without
limitation merchantability, fitness for a particular purpose, absence of defects
or errors, accuracy, non-infringement of intellectual property rights other than
copyright as stated in Article 6 of this Licence.
This disclaimer of warranty is an essential part of the Licence and a condition
for the grant of any rights to the Work.
## 8. Disclaimer of Liability
Except in the cases of wilful misconduct or damages directly caused to natural
persons, the Licensor will in no event be liable for any direct or indirect,
material or moral, damages of any kind, arising out of the Licence or of the use
of the Work, including without limitation, damages for loss of goodwill, work
stoppage, computer failure or malfunction, loss of data or any commercial
damage, even if the Licensor has been advised of the possibility of such
damage. However, the Licensor will be liable under statutory product liability
laws as far such laws apply to the Work.
## 9. Additional agreements
While distributing the Original Work or Derivative Works, You may choose to
conclude an additional agreement to offer, and charge a fee for, acceptance of
support, warranty, indemnity, or other liability obligations and/or services
consistent with this Licence. However, in accepting such obligations, You may
act only on your own behalf and on your sole responsibility, not on behalf of
the original Licensor or any other Contributor, and only if You agree to
indemnify, defend, and hold each Contributor harmless for any liability incurred
by, or claims asserted against such Contributor by the fact You have accepted
any such warranty or additional liability.
## 10. Acceptance of the Licence
The provisions of this Licence can be accepted by clicking on an icon “I agree”
placed under the bottom of a window displaying the text of this Licence or by
affirming consent in any other similar way, in accordance with the rules of
applicable law. Clicking on that icon indicates your clear and irrevocable
acceptance of this Licence and all of its terms and conditions.
Similarly, you irrevocably accept this Licence and all of its terms and
conditions by exercising any rights granted to You by Article 2 of this Licence,
such as the use of the Work, the creation by You of a Derivative Work or the
Distribution and/or Communication by You of the Work or copies thereof.
## 11. Information to the public
In case of any Distribution and/or Communication of the Work by means of
electronic communication by You (for example, by offering to download the Work
from a remote location) the distribution channel or media (for example, a
website) must at least provide to the public the information requested by the
applicable law regarding the Licensor, the Licence and the way it may be
accessible, concluded, stored and reproduced by the Licensee.
## 12. Termination of the Licence
The Licence and the rights granted hereunder will terminate automatically upon
any breach by the Licensee of the terms of the Licence.
Such a termination will not terminate the licences of any person who has
received the Work from the Licensee under the Licence, provided such persons
remain in full compliance with the Licence.
## 13. Miscellaneous
Without prejudice of Article 9 above, the Licence represents the complete
agreement between the Parties as to the Work licensed hereunder.
If any provision of the Licence is invalid or unenforceable under applicable
law, this will not affect the validity or enforceability of the Licence as a
whole. Such provision will be construed and/or reformed so as necessary to make
it valid and enforceable.
The European Commission may publish other linguistic versions and/or new
versions of this Licence, so far this is required and reasonable, without
reducing the scope of the rights granted by the Licence. New versions of the
Licence will be published with a unique version number.
All linguistic versions of this Licence, approved by the European Commission,
have identical value. Parties can take advantage of the linguistic version of
their choice.
## 14. Jurisdiction
Any litigation resulting from the interpretation of this License, arising
between the European Commission, as a Licensor, and any Licensee, will be
subject to the jurisdiction of the Court of Justice of the European Communities,
as laid down in article 238 of the Treaty establishing the European Community.
Any litigation arising between Parties, other than the European Commission, and
resulting from the interpretation of this License, will be subject to the
exclusive jurisdiction of the competent court where the Licensor resides or
conducts its primary business.
## 15. Applicable Law
This Licence shall be governed by the law of the European Union country where
the Licensor resides or has his registered office.
This licence shall be governed by the Belgian law if:
- a litigation arises between the European Commission, as a Licensor, and any
- Licensee; the Licensor, other than the European Commission, has no residence
- or registered office inside a European Union country.
## Appendix
“Compatible Licences” according to article 5 EUPL are:
- GNU General Public License (GNU GPL) v. 2
- Open Software License (OSL) v. 2.1, v. 3.0
- Common Public License v. 1.0
- Eclipse Public License v. 1.0
- Cecill v. 2.0

83
gxJRS/README.md Normal file
View File

@ -0,0 +1,83 @@
gxRest
----
The gCube eXtensions to the Rest Protocol (gxRest) is a set of Java libraries designed to provide convenient round-trip interaction between a Restful web application (also known as "service") and its clients.
gxRest has the flexibility for different degrees of exploitation:
* it can be entirely adopted both at client and service side with full benefit of its conventions;
* it can be used to send REST requests based only on plain HTTP;
* it can be used only to return HTTP code/messagess from the service;
* it can be used only to throw Exceptions from the service to the client.
## Examples of use
Sending a request:
```java
GXHTTPRequest request = GXHTTPRequest.newRequest("http://host:port/service/").from("GXRequestTest");
//prepare some parameters
String context ="...";
Map<String,String> queryParams = new WeakHashMap<>();
queryParams.put("param name", "param value");
GXInboundResponse response = request.path("context")
.queryParams(queryParams).withBody(context).post();
```
Returning a success response:
```java
@POST
public Response create(...) {
//Resource successfully created
URI location = ... //URI of the new resource
return GXOutboundSuccessResponse.newCREATEResponse(location)
.withMessage("Resource successfully created.")
.ofType(MediaType.APPLICATION_JSON)
.build();
}
```
Throwing an exception:
```java
@POST
public Response create(...) {
//Oh no, something failed here
GXOutboundErrorResponse.throwException(new MyCustomException("Resource already exists."));
}
```
Parsing a response
```java
// invoke the remote method and get a response.
GXInboundResponse response = ...;
if (response.hasException())
throw response.getException();
//assuming a created (200) code was expected
if (response.hasCREATEDCode()) {
System.out.println("Resource successfully created!");
}
//access content as string
String value = response.getStreamedContentAsString();
//unmasharll content as json
Context returnedContext = response.tryConvertStreamedContentFromJson(Context.class);
```
## Documentation
* [gxJRS](https://wiki.gcube-system.org/gcube/GxRest/GxJRS)
## Deployment
Notes about how to deploy this component on an infrastructure or link to wiki doc (if any).
## Built With
* [JAX-RS](https://github.com/eclipse-ee4j/jaxrs-api) - Java™ API for RESTful Web Services
* [Jersey](https://jersey.github.io/) - JAX-RS runtime
* [Maven](https://maven.apache.org/) - Dependency Management
## License
See [LICENSE.md](LICENSE.md)

View File

@ -13,11 +13,11 @@
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: javax.ws.rs:javax.ws.rs-api:2.0.1" level="project" /> <orderEntry type="library" name="Maven: javax.ws.rs:javax.ws.rs-api:2.0.1" level="project" />
<orderEntry type="module" module-name="gxHTTP" /> <orderEntry type="module" module-name="gxHTTP" />
<orderEntry type="library" name="Maven: org.gcube.common:authorization-client:2.0.6" level="project" /> <orderEntry type="library" name="Maven: org.gcube.common:authorization-client:2.0.7" level="project" />
<orderEntry type="library" name="Maven: org.gcube.common:common-authorization:2.2.0" level="project" /> <orderEntry type="library" name="Maven: org.gcube.common:common-authorization:2.3.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.gcube.core:common-scope:1.2.2-SNAPSHOT" level="project" /> <orderEntry type="library" name="Maven: org.gcube.core:common-scope:1.3.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.gcube.core:common-configuration-scanner:1.0.0-SNAPSHOT" level="project" /> <orderEntry type="library" name="Maven: org.gcube.core:common-configuration-scanner:1.1.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.gcube.core:common-scope-maps:1.2.0-SNAPSHOT" level="project" /> <orderEntry type="library" name="Maven: org.gcube.core:common-scope-maps:1.2.2-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.6.0" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.6.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.6.0" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.6.0" level="project" />

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>
<artifactId>gxREST</artifactId> <artifactId>gxREST</artifactId>
<version>1.1.3</version> <version>2.0.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>gxJRS</artifactId> <artifactId>gxJRS</artifactId>
@ -37,7 +37,7 @@
<dependency> <dependency>
<groupId>org.gcube.distribution</groupId> <groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId> <artifactId>gcube-bom</artifactId>
<version>1.3.1</version> <version>3.0.0-SNAPSHOT</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
@ -49,32 +49,24 @@
<dependency> <dependency>
<groupId>javax.ws.rs</groupId> <groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId> <artifactId>javax.ws.rs-api</artifactId>
<version>${jaxrs.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>
<artifactId>gxHTTP</artifactId> <artifactId>gxHTTP</artifactId>
<version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId> <artifactId>gcube-jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>gcube-jackson-core</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- Test Dependency --> <!-- Test Dependency -->
<dependency> <dependency>
@ -97,25 +89,9 @@
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>
<version>1.0.13</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-servicearchive</id>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -137,22 +137,6 @@ public class GXHTTPStreamRequest implements GXHTTP<InputStream,GXInboundResponse
return new GXInboundResponse(builder.connect()); return new GXInboundResponse(builder.connect());
} }
/* (non-Javadoc)
* @see org.gcube.common.gxrest.request.GXHTTP#setSecurityToken(java.lang.String)
*/
@Override
public void setSecurityToken(String token) {
builder.setSecurityToken(token);
}
/* (non-Javadoc)
* @see org.gcube.common.gxrest.request.GXHTTP#isExternalCall(boolean)
*/
@Override
public void isExternalCall(boolean ext) {
builder.isExternalCall(ext);
}
/** /**
* @param string * @param string
* @return the request * @return the request

View File

@ -155,22 +155,6 @@ public class GXHTTPStringRequest implements GXHTTP<String,GXInboundResponse> {
return new GXInboundResponse(builder.connect()); return new GXInboundResponse(builder.connect());
} }
/* (non-Javadoc)
* @see org.gcube.common.gxrest.request.GXHTTP#setSecurityToken(java.lang.String)
*/
@Override
public void setSecurityToken(String token) {
builder.setSecurityToken(token);
}
/* (non-Javadoc)
* @see org.gcube.common.gxrest.request.GXHTTP#isExternalCall(boolean)
*/
@Override
public void isExternalCall(boolean ext) {
builder.isExternalCall(ext);
}
/** /**
* @param string * @param string

View File

@ -7,8 +7,8 @@ import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException; import java.security.cert.CertificateException;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Objects;
import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
@ -25,7 +25,6 @@ import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.gxhttp.reference.GXConnection; import org.gcube.common.gxhttp.reference.GXConnection;
import org.gcube.common.gxhttp.reference.GXHTTP; import org.gcube.common.gxhttp.reference.GXHTTP;
import org.gcube.common.gxrest.response.inbound.GXInboundResponse; import org.gcube.common.gxrest.response.inbound.GXInboundResponse;
@ -45,7 +44,6 @@ public class GXWebTargetAdapterRequest implements GXHTTP<Entity<?>,GXInboundResp
private static final Logger logger = LoggerFactory.getLogger(GXWebTargetAdapterRequest.class); private static final Logger logger = LoggerFactory.getLogger(GXWebTargetAdapterRequest.class);
private MediaType[] mediaType; private MediaType[] mediaType;
MultivaluedMap<String, Object> headers = new MultivaluedHashMap<String, Object>(); MultivaluedMap<String, Object> headers = new MultivaluedHashMap<String, Object>();
private boolean extCall = false;
/** /**
* Creates a new request. * Creates a new request.
@ -121,26 +119,9 @@ public class GXWebTargetAdapterRequest implements GXHTTP<Entity<?>,GXInboundResp
} }
} }
this.adaptee = client.target(address); this.adaptee = client.target(address);
this.headers.add(org.gcube.common.authorization.client.Constants.TOKEN_HEADER_ENTRY,
SecurityTokenProvider.instance.get());
this.headers.add("User-Agent", this.getClass().getSimpleName()); this.headers.add("User-Agent", this.getClass().getSimpleName());
} }
/**
* Overrides the default security token.
*
* @param token
* the new token
*/
@Override
public void setSecurityToken(String token) {
if (!this.extCall)
this.headers.add(org.gcube.common.authorization.client.Constants.TOKEN_HEADER_ENTRY, token);
else
throw new UnsupportedOperationException("Cannot set the security token on an external call");
}
/** /**
* Sets the identity user agent associated to the request. * Sets the identity user agent associated to the request.
* *
@ -405,13 +386,4 @@ public class GXWebTargetAdapterRequest implements GXHTTP<Entity<?>,GXInboundResp
throw new UnsupportedOperationException("WebTarget does not support CONNECT"); throw new UnsupportedOperationException("WebTarget does not support CONNECT");
} }
/*
* (non-Javadoc)
*
* @see org.gcube.common.gxrest.request.GXHTTP#isExternalCall(boolean)
*/
@Override
public void isExternalCall(boolean ext) {
this.extCall = ext;
}
} }

View File

@ -6,7 +6,7 @@ package org.gcube.common.gxrest.response.entity;
* of an ETag response header. * of an ETag response header.
* *
* @author Manuele Simi (ISTI CNR) * @author Manuele Simi (ISTI CNR)
* @see <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11">HTTP/1.1 section 3.11</a> * @see <a href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11">HTTP/1.1 section 3.11</a>
*/ */
public final class EntityTag { public final class EntityTag {

View File

@ -115,7 +115,8 @@ public class SerializableErrorEntityTextReader implements MessageBodyReader<Seri
* @return the string read from the stream * @return the string read from the stream
*/ */
private static String convertStreamToString(InputStream is) { private static String convertStreamToString(InputStream is) {
java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A"); try (java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A")) {
return s.hasNext() ? s.next() : ""; return s.hasNext() ? s.next() : "";
}
} }
} }

View File

@ -104,7 +104,7 @@ public class GXInboundResponse {
// ContentUtils.toByteArray(connection.getInputStream()); // ContentUtils.toByteArray(connection.getInputStream());
if (this.contentType.equals(MediaType.TEXT_PLAIN) if (this.contentType.equals(MediaType.TEXT_PLAIN)
|| this.contentType.equals(MediaType.APPLICATION_JSON)) { || this.contentType.equals(MediaType.APPLICATION_JSON)) {
this.body = ContentUtils.toString(ContentUtils.toByteArray(connection.getInputStream())); this.body = ContentUtils.toString(ContentUtils.toByteArray(getInputStream()));
logger.trace("Response's content: " + this.body); logger.trace("Response's content: " + this.body);
this.contentAlreadyConsumed = true; this.contentAlreadyConsumed = true;
} }
@ -250,7 +250,7 @@ public class GXInboundResponse {
if(!this.contentAlreadyConsumed) { if(!this.contentAlreadyConsumed) {
if (this.fromConnection) { if (this.fromConnection) {
contentAlreadyConsumed = true; contentAlreadyConsumed = true;
return connection.getInputStream(); return isSuccessResponse() ? connection.getInputStream() : connection.getErrorStream();
} else if (this.fromResponse) { } else if (this.fromResponse) {
contentAlreadyConsumed = true; contentAlreadyConsumed = true;
return (InputStream) source.getEntity(); return (InputStream) source.getEntity();

View File

@ -1,6 +1,6 @@
package org.gcube.common.gxrest.response.inbound; package org.gcube.common.gxrest.response.inbound;
import com.fasterxml.jackson.databind.ObjectMapper; import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
/** /**
* Manipulation of an {@link GXInboundResponse}'s content. * Manipulation of an {@link GXInboundResponse}'s content.

View File

@ -1,6 +1,5 @@
package org.gcube.common.gxrest.response.outbound; package org.gcube.common.gxrest.response.outbound;
import javax.print.attribute.standard.Media;
import javax.ws.rs.WebApplicationException; import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;

View File

@ -1,6 +1,7 @@
package org.gcube.common.gxrest.request; package org.gcube.common.gxrest.request;
import static org.junit.Assert.*; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -8,10 +9,7 @@ import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import org.gcube.common.authorization.client.Constants; import org.gcube.com.fasterxml.jackson.databind.JsonMappingException;
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
import org.gcube.common.authorization.library.AuthorizationEntry;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.gxrest.response.inbound.GXInboundResponse; import org.gcube.common.gxrest.response.inbound.GXInboundResponse;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
@ -20,8 +18,6 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.BlockJUnit4ClassRunner; import org.junit.runners.BlockJUnit4ClassRunner;
import com.fasterxml.jackson.databind.JsonMappingException;
/** /**
* Test cases for {@link GXHTTPStringRequest} * Test cases for {@link GXHTTPStringRequest}
* *
@ -62,23 +58,17 @@ public class GXHTTPStringRequestTest {
setContext(DEFAULT_TEST_SCOPE); setContext(DEFAULT_TEST_SCOPE);
} }
public static void setContext(String token) throws ObjectNotFound, Exception { public static void setContext(String token) throws Exception {
if (DEFAULT_TEST_SCOPE.isEmpty()) { if (DEFAULT_TEST_SCOPE.isEmpty()) {
skipTest = true; skipTest = true;
return; return;
} }
SecurityTokenProvider.instance.set(token); //SecurityTokenProvider.instance.set(token);
}
public static String getCurrentScope(String token) throws ObjectNotFound, Exception {
AuthorizationEntry authorizationEntry = Constants.authorizationService().get(token);
String context = authorizationEntry.getContext();
return context;
} }
@AfterClass @AfterClass
public static void afterClass() throws Exception { public static void afterClass() throws Exception {
SecurityTokenProvider.instance.reset(); //SecurityTokenProvider.instance.reset();
} }
/** /**
@ -122,7 +112,8 @@ public class GXHTTPStringRequestTest {
} }
} }
@Test(expected=com.fasterxml.jackson.databind.JsonMappingException.class) @SuppressWarnings("deprecation")
@Test(expected=org.gcube.com.fasterxml.jackson.databind.JsonMappingException.class)
public void testPostNoBody() throws Exception { public void testPostNoBody() throws Exception {
if (skipTest) if (skipTest)
throw new JsonMappingException(""); throw new JsonMappingException("");

View File

@ -1,9 +1,17 @@
package org.gcube.common.gxrest.request; package org.gcube.common.gxrest.request;
import org.gcube.common.authorization.client.Constants; import static org.junit.Assert.assertTrue;
import org.gcube.common.authorization.client.exceptions.ObjectNotFound; import static org.junit.Assert.fail;
import org.gcube.common.authorization.library.AuthorizationEntry;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.Properties;
import java.util.WeakHashMap;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
import org.gcube.common.gxrest.response.inbound.GXInboundResponse; import org.gcube.common.gxrest.response.inbound.GXInboundResponse;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
@ -12,17 +20,6 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.BlockJUnit4ClassRunner; import org.junit.runners.BlockJUnit4ClassRunner;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.Properties;
import java.util.WeakHashMap;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/** /**
* Test cases for {@link GXWebTargetAdapterRequest#newHTTPSRequest(String)} * Test cases for {@link GXWebTargetAdapterRequest#newHTTPSRequest(String)}
* *
@ -34,7 +31,7 @@ public class GXWebTargetAdapterHTTPSRequestTest {
private GXWebTargetAdapterRequest request; private GXWebTargetAdapterRequest request;
private GXWebTargetAdapterRequest requestWithProtocol; // private GXWebTargetAdapterRequest requestWithProtocol;
public static String DEFAULT_TEST_SCOPE = ""; public static String DEFAULT_TEST_SCOPE = "";
@ -65,24 +62,18 @@ public class GXWebTargetAdapterHTTPSRequestTest {
setContext(DEFAULT_TEST_SCOPE); setContext(DEFAULT_TEST_SCOPE);
} }
public static void setContext(String token) throws ObjectNotFound, Exception { public static void setContext(String token) throws Exception {
if (skipTest || DEFAULT_TEST_SCOPE.isEmpty()) { if (skipTest || DEFAULT_TEST_SCOPE.isEmpty()) {
skipTest = true; skipTest = true;
return; return;
} else { } else {
SecurityTokenProvider.instance.set(token); //SecurityTokenProvider.instance.set(token);
} }
} }
public static String getCurrentScope(String token) throws ObjectNotFound, Exception {
AuthorizationEntry authorizationEntry = Constants.authorizationService().get(token);
String context = authorizationEntry.getContext();
return context;
}
@AfterClass @AfterClass
public static void afterClass() throws Exception { public static void afterClass() throws Exception {
SecurityTokenProvider.instance.reset(); //SecurityTokenProvider.instance.reset();
} }
/** /**
@ -91,7 +82,7 @@ public class GXWebTargetAdapterHTTPSRequestTest {
@Before @Before
public void testNewRequest() { public void testNewRequest() {
request = GXWebTargetAdapterRequest.newHTTPSRequest(DEFAULT_RM_URL).from("GXRequestTest"); request = GXWebTargetAdapterRequest.newHTTPSRequest(DEFAULT_RM_URL).from("GXRequestTest");
requestWithProtocol = GXWebTargetAdapterRequest.newHTTPSRequest(DEFAULT_RM_URL, "").from("GXRequestTest"); // requestWithProtocol = GXWebTargetAdapterRequest.newHTTPSRequest(DEFAULT_RM_URL, "").from("GXRequestTest");
} }
/** /**

View File

@ -1,6 +1,7 @@
package org.gcube.common.gxrest.request; package org.gcube.common.gxrest.request;
import static org.junit.Assert.*; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -11,10 +12,6 @@ import java.util.WeakHashMap;
import javax.ws.rs.client.Entity; import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.gcube.common.authorization.client.Constants;
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
import org.gcube.common.authorization.library.AuthorizationEntry;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.gxrest.response.inbound.GXInboundResponse; import org.gcube.common.gxrest.response.inbound.GXInboundResponse;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
@ -62,24 +59,19 @@ public class GXWebTargetAdapterRequestTest {
setContext(DEFAULT_TEST_SCOPE); setContext(DEFAULT_TEST_SCOPE);
} }
public static void setContext(String token) throws ObjectNotFound, Exception { public static void setContext(String token) throws Exception {
if (skipTest || DEFAULT_TEST_SCOPE.isEmpty()) { if (skipTest || DEFAULT_TEST_SCOPE.isEmpty()) {
skipTest = true; skipTest = true;
return; return;
} else { } else {
SecurityTokenProvider.instance.set(token); //SecurityTokenProvider.instance.set(token);
} }
} }
public static String getCurrentScope(String token) throws ObjectNotFound, Exception {
AuthorizationEntry authorizationEntry = Constants.authorizationService().get(token);
String context = authorizationEntry.getContext();
return context;
}
@AfterClass @AfterClass
public static void afterClass() throws Exception { public static void afterClass() throws Exception {
SecurityTokenProvider.instance.reset(); //SecurityTokenProvider.instance.reset();
} }
/** /**

View File

@ -1 +0,0 @@
gxREST

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="gxHTTP" />
<module name="gxJRS" />
</profile>
</annotationProcessing>
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/.." charset="UTF-8" />
<file url="file://$PROJECT_DIR$/../gxHTTP" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/../gxJRS" charset="UTF-8" />
</component>
</project>

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/../pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="SvnBranchConfigurationManager">
<option name="myConfigurationMap">
<map>
<entry key="$PROJECT_DIR$/..">
<value>
<SvnBranchConfiguration>
<option name="branchUrls">
<list>
<option value="https://svn.d4science.research-infrastructures.eu/gcube/branches" />
<option value="https://svn.d4science.research-infrastructures.eu/gcube/misc" />
<option value="https://svn.d4science.research-infrastructures.eu/gcube/private" />
<option value="https://svn.d4science.research-infrastructures.eu/gcube/tags" />
</list>
</option>
<option name="trunkUrl" value="https://svn.d4science.research-infrastructures.eu/gcube/trunk" />
</SvnBranchConfiguration>
</value>
</entry>
</map>
</option>
</component>
</project>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View File

@ -5,12 +5,12 @@
<parent> <parent>
<groupId>org.gcube.tools</groupId> <groupId>org.gcube.tools</groupId>
<artifactId>maven-parent</artifactId> <artifactId>maven-parent</artifactId>
<version>1.1.0</version> <version>1.2.0</version>
</parent> </parent>
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>
<artifactId>gxREST</artifactId> <artifactId>gxREST</artifactId>
<version>1.1.3</version> <version>2.0.0-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>gCube eXtensions to REST</name> <name>gCube eXtensions to REST</name>
<description>gCube eXtensions to REST</description> <description>gCube eXtensions to REST</description>
@ -47,7 +47,7 @@
<dependency> <dependency>
<groupId>org.gcube.distribution</groupId> <groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId> <artifactId>gcube-bom</artifactId>
<version>1.3.1</version> <version>3.0.0-SNAPSHOT</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>