AAFC-BICoE/android-real-ws

Name: android-real-ws

Owner: Biological Informatics CoE @ Agriculture and Agri-Food Canada

Owner: Biological Informatics CoE @ Agriculture and Agri-Food Canada

Description: null

Created: 2014-01-23 19:23:33.0

Updated: 2016-11-07 18:42:19.0

Pushed: 2016-11-07 18:42:18.0

Homepage: null

Size: 95

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

What

Build

-DskipTests clean compile assembly:single

Run Mock

rt CLASSPATH=target/ws-1.0-SNAPSHOT-jar-with-dependencies.jar
 ca.gc.agr.mbb.seqdb.ws.http.Main

Starts web server on port 8080

Note: needs java >= v1.7

Mock Object Numbers

URLs to try

List all available services via URIs:

URI: http://localhost:8080/seqdb-ws/v1/



"meta": {
    "ellapsedMillis": 0,
    "thisUrl": "http://localhost:8080/seqdb-ws/v1/",
    "debugToggleUrl": "http://localhost:8080/seqdb-ws/v1/DEBUG",
    "debug": false,
    "mode": "mock",
    "timestamp": "Sun Feb 9 06:28:15 EST 2014",
status: 200
},
"pagingPayload": {
    "limit": 100,
    "baseUrl": "http://localhost:8080/seqdb-ws/v1/",
    "offset": 0,
"count": 4,
    "urls": [
        {
            "urlPath": "container"
        },
        {
            "urlPath": "container/count"
        },
        {
            "urlPath": "location"
        },
        {
            "urlPath": "location/count"
        }
    ],
    "total": 4
}


To construct the full URI for the web service, combine the pagingPayload.baseUrl with one of the pagingPayload.urls.urlPath.

Get count of containers:

URI: http://localhost:8080/seqdb-ws/v1/container/count

Should result in something like:


"meta": {
    "ellapsedMillis": 0,
    "thisUrl": "http://localhost:8080/",
    "debugToggleUrl": "http://localhost:8080/seqdb-ws/v1/DEBUG",
    "debug": true,
    "mode": "mock",
    "timestamp": "Sun Feb 9 06:28:15 EST 2014"
status": 200
},
"countPayload": {
    "total": 4
}

Get all container GET URIs

URI: http://localhost:8080/seqdb-ws/v1/container

This should result in something like:



"meta": {
    "ellapsedMillis": 0,
    "thisUrl": "http://localhost:8080/seqdb-ws/v1/container",
    "debugToggleUrl": "http://localhost:8080/seqdb-ws/v1/DEBUG",
    "debug": false,
    "mode": "mock",
    "timestamp": "Sun Feb 9 06:28:15 EST 2014"
status: 200
},
"pagingPayload": {
    "limit": 100,
    "baseUrl": "http://localhost:8080/seqdb-ws/v1/container",
    "offset": 0,
nextPageUrl": "http://localhost:8080/seqdb-ws/v1/container?offset=100&limit=100",
"count": 100,
    "urls": [
        {
            "urlPath": "0"
        },
        {
            "urlPath": "1"
        },
        {
            "urlPath": "2"
        },


ontent removed]


        {
            "urlPath": "40"
        },
        {
            "urlPath": "41"
        },
    ],
    "total": 42
}


Get a single container record by primary key

Now, use one of the above to get the full record: URI: http://localhost:8080/seqdb-ws/v1/container/1

Should result in something like:


"meta": {
    "ellapsedMillis": 0,
    "thisUrl": "http://localhost:8080/",
    "debugToggleUrl": "http://localhost:8080/seqdb-ws/v1/DEBUG",
    "debug": true,
    "mode": "mock",
    "timestamp": "Sun Feb 9 06:28:15 EST 2014",
status: 200
},
"container": {
    "id": 1,
    "containerNumber": "43",
    "containerType": {
        "name": "t2",
        "baseType": "t6",
        "numberOfWells": 10,
        "numberOfColumns": 8,
        "numberOfRows": 9,
        "id": 42
    },
    "locations": "http://localhost:8080/seqdb-ws/v1/location/container/1"
}

Note above that container.locations is the full URI to get the locations associated with a container. It has the form: location/container/PRIMARY_KEY

Using this URI http://localhost:8080/seqdb-ws/v1/location/container/1 should produce something like:



"meta": {
    "ellapsedMillis": 0,
    "thisUrl": "http://localhost:8080/seqdb-ws/v1/location/container/1",
    "debugToggleUrl": "http://localhost:8080/seqdb-ws/v1/DEBUG",
    "debug": false,
    "mode": "mock",
    "timestamp": "Sun Feb 9 06:28:15 EST 2014",
status: 200
},
"pagingPayload": {
    "limit": 100,
    "baseUrl": "http://localhost:8080/seqdb-ws/v1/location",
    "offset": 0,
nextPageUrl": "http://localhost:8080/seqdb-ws/v1/location?offset=10&limit=10",
    "urls": [
        {
            "urlPath": "41"
        },
        {
            "urlPath": "86"
        },
        {
            "urlPath": "126"
        },


ontent removed]



        {
            "urlPath": "786"
        },
        {
            "urlPath": "801"
        },
        {
            "urlPath": "836"
        }
    ],
    "total": 29
}


Debugging

The pagingPayload.urls by default only contain an urlPath that needs to be combined with the pagingPayload.baseUrl to get the resource service URI. There is a debug mode that supports an easier interactive session and prints a debugFullUrl that allows easier access. This can be turned on through either of the following ways:

Turning on debugging will now cause all service requests that produce a pagingPayload to include debugFullUrls:



"meta": {
    "ellapsedMillis": 0,
    "thisUrl": "http://localhost:8080/seqdb-ws/v1/",
    "debugToggleUrl": "http://localhost:8080/seqdb-ws/v1/DEBUG",
    "debug": true,
    "mode": "mock",
    "timestamp": "Sun Feb 9 06:28:15 EST 2014",
status: 200
},
"pagingPayload": {
    "limit": 100,
    "baseUrl": "http://localhost:8080/seqdb-ws/v1/",
    "offset": 0,
"count": 4,
    "urls": [
        {
            "urlPath": "container",
            "debugFullUrl": "http://localhost:8080/seqdb-ws/v1/container"
        },
        {
            "urlPath": "container/count",
            "debugFullUrl": "http://localhost:8080/seqdb-ws/v1/container/count"
        },
        {
            "urlPath": "location",
            "debugFullUrl": "http://localhost:8080/seqdb-ws/v1/location"
        },
        {
            "urlPath": "location/count",
            "debugFullUrl": "http://localhost:8080/seqdb-ws/v1/location/count"
        }
    ],
    "total": 4
}


What

Build

-DskipTests clean compile assembly:single

Run Mock

rt CLASSPATH=target/ws-1.0-SNAPSHOT-jar-with-dependencies.jar
 ca.gc.agr.mbb.seqdb.ws.http.Main

Starts web server on port 8080

Note: needs java >= v1.7

Mock Object Numbers

URLs to try

List all available services via URIs:

URI: http://localhost:8080/seqdb-ws/v1/



"meta": {
    "ellapsedMillis": 0,
    "thisUrl": "http://localhost:8080/seqdb-ws/v1/",
    "debugToggleUrl": "http://localhost:8080/seqdb-ws/v1/DEBUG",
    "debug": false,
    "mode": "mock",
    "timestamp": "Sun Feb 9 06:28:15 EST 2014",
status: 200
},
"pagingPayload": {
    "limit": 100,
    "baseUrl": "http://localhost:8080/seqdb-ws/v1/",
    "offset": 0,
"count": 4,
    "urls": [
        {
            "urlPath": "container"
        },
        {
            "urlPath": "container/count"
        },
        {
            "urlPath": "location"
        },
        {
            "urlPath": "location/count"
        }
    ],
    "total": 4
}


To construct the full URI for the web service, combine the pagingPayload.baseUrl with one of the pagingPayload.urls.urlPath.

Get count of containers:

URI: http://localhost:8080/seqdb-ws/v1/container/count

Should result in something like:


"meta": {
    "ellapsedMillis": 0,
    "thisUrl": "http://localhost:8080/",
    "debugToggleUrl": "http://localhost:8080/seqdb-ws/v1/DEBUG",
    "debug": true,
    "mode": "mock",
    "timestamp": "Sun Feb 9 06:28:15 EST 2014"
status": 200
},
"countPayload": {
    "total": 4
}

Get all container GET URIs

URI: http://localhost:8080/seqdb-ws/v1/container

This should result in something like:



"meta": {
    "ellapsedMillis": 0,
    "thisUrl": "http://localhost:8080/seqdb-ws/v1/container",
    "debugToggleUrl": "http://localhost:8080/seqdb-ws/v1/DEBUG",
    "debug": false,
    "mode": "mock",
    "timestamp": "Sun Feb 9 06:28:15 EST 2014"
status: 200
},
"pagingPayload": {
    "limit": 100,
    "baseUrl": "http://localhost:8080/seqdb-ws/v1/container",
    "offset": 0,
nextPageUrl": "http://localhost:8080/seqdb-ws/v1/container?offset=100&limit=100",
"count": 100,
    "urls": [
        {
            "urlPath": "0"
        },
        {
            "urlPath": "1"
        },
        {
            "urlPath": "2"
        },


ontent removed]


        {
            "urlPath": "40"
        },
        {
            "urlPath": "41"
        },
    ],
    "total": 42
}


Get a single container record by primary key

Now, use one of the above to get the full record: URI: http://localhost:8080/seqdb-ws/v1/container/1

Should result in something like:


"meta": {
    "ellapsedMillis": 0,
    "thisUrl": "http://localhost:8080/",
    "debugToggleUrl": "http://localhost:8080/seqdb-ws/v1/DEBUG",
    "debug": true,
    "mode": "mock",
    "timestamp": "Sun Feb 9 06:28:15 EST 2014",
status: 200
},
"container": {
    "id": 1,
    "containerNumber": "43",
    "containerType": {
        "name": "t2",
        "baseType": "t6",
        "numberOfWells": 10,
        "numberOfColumns": 8,
        "numberOfRows": 9,
        "id": 42
    },
    "locations": "http://localhost:8080/seqdb-ws/v1/location/container/1"
}

Note above that container.locations is the full URI to get the locations associated with a container. It has the form: location/container/PRIMARY_KEY

Using this URI http://localhost:8080/seqdb-ws/v1/location/container/1 should produce something like:



"meta": {
    "ellapsedMillis": 0,
    "thisUrl": "http://localhost:8080/seqdb-ws/v1/location/container/1",
    "debugToggleUrl": "http://localhost:8080/seqdb-ws/v1/DEBUG",
    "debug": false,
    "mode": "mock",
    "timestamp": "Sun Feb 9 06:28:15 EST 2014",
status: 200
},
"pagingPayload": {
    "limit": 100,
    "baseUrl": "http://localhost:8080/seqdb-ws/v1/location",
    "offset": 0,
nextPageUrl": "http://localhost:8080/seqdb-ws/v1/location?offset=10&limit=10",
    "urls": [
        {
            "urlPath": "41"
        },
        {
            "urlPath": "86"
        },
        {
            "urlPath": "126"
        },


ontent removed]



        {
            "urlPath": "786"
        },
        {
            "urlPath": "801"
        },
        {
            "urlPath": "836"
        }
    ],
    "total": 29
}


Debugging

The pagingPayload.urls by default only contain an urlPath that needs to be combined with the pagingPayload.baseUrl to get the resource service URI. There is a debug mode that supports an easier interactive session and prints a debugFullUrl that allows easier access. This can be turned on through either of the following ways:

Turning on debugging will now cause all service requests that produce a pagingPayload to include debugFullUrls:



"meta": {
    "ellapsedMillis": 0,
    "thisUrl": "http://localhost:8080/seqdb-ws/v1/",
    "debugToggleUrl": "http://localhost:8080/seqdb-ws/v1/DEBUG",
    "debug": true,
    "mode": "mock",
    "timestamp": "Sun Feb 9 06:28:15 EST 2014",
status: 200
},
"pagingPayload": {
    "limit": 100,
    "baseUrl": "http://localhost:8080/seqdb-ws/v1/",
    "offset": 0,
"count": 4,
    "urls": [
        {
            "urlPath": "container",
            "debugFullUrl": "http://localhost:8080/seqdb-ws/v1/container"
        },
        {
            "urlPath": "container/count",
            "debugFullUrl": "http://localhost:8080/seqdb-ws/v1/container/count"
        },
        {
            "urlPath": "location",
            "debugFullUrl": "http://localhost:8080/seqdb-ws/v1/location"
        },
        {
            "urlPath": "location/count",
            "debugFullUrl": "http://localhost:8080/seqdb-ws/v1/location/count"
        }
    ],
    "total": 4
}



This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.