Add HTTP publishing and image source operations#551
Merged
JLLeitschuh merged 56 commits intoWPIRoboticsProjects:masterfrom Jun 30, 2016
Merged
Add HTTP publishing and image source operations#551JLLeitschuh merged 56 commits intoWPIRoboticsProjects:masterfrom
JLLeitschuh merged 56 commits intoWPIRoboticsProjects:masterfrom
Conversation
buildSrc/build.gradle
Outdated
| compile gradleApi() | ||
| compile localGroovy() | ||
| compile group: 'com.google.guava', name: 'guava', version: '19.0' | ||
| compile group: 'com.google.guava', name: 'guava', version: '18.0' |
Member
Author
There was a problem hiding this comment.
I'm not sure why that's there; I had pulled from WPIRoboticsProjects/master so this may have gotten changed.
Edit: Reverted in 438cf2f
Current coverage is 53.72%@@ master #551 diff @@
========================================
Files 158 176 +18
Lines 4699 4993 +294
Methods 0 0
Branches 500 521 +21
========================================
+ Hits 2522 2682 +160
- Misses 2037 2164 +127
- Partials 140 147 +7
|
| private final HttpServerFactory serverFactory; | ||
| private HttpServer server; | ||
| private final Map<String, GetHandler> getHandlers; | ||
| private final Map<String, List<PostHandler>> postHandlers; |
Member
There was a problem hiding this comment.
You could have used a multi-map for this: https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap
Member
Author
There was a problem hiding this comment.
It would replace one stream operation and nothing else. Not much point.
GripServer returns a 423 error if a data request is sent while the pipeline is running
… static image source
This breaks compatibility with previous save files that use HTTP sources
…is running Use library-defined HTTP codes instead of redefining them 404 error when going to a URI such as /GRIP/data/foo or /GRIP/data* (now it has to be on a path that has a handler specifically assigned to it) Update tests to stop codacy bot from complaining so much
Remove GripProperties Tests are broken. Will be fixed in next commit.
It works on my Travis instance, so hopefully it's not borked on the main Travis instance
HTTP sources can only supply images POSTed to URLs under '/GRIP/upload/image', e.g. '/GRIP/upload/image/foo'
Also added logging to PedanticHandler when handling a request
- Remove unused imports and redundant asserts - Undid some Intellij autoformatting - Remove PipelineLoaded / PIpelineUnloaded events
… EventBus, add method to get server state
| this.server.setHandler(handlers); | ||
| handlers.addHandler(new NoContextHandler(contextStore)); | ||
|
|
||
| Runtime.getRuntime().addShutdownHook(new Thread(this::stop)); |
Member
There was a problem hiding this comment.
This still needs to be made a daemon thread.
Member
Author
There was a problem hiding this comment.
That's not how the shutdown hook API works. This is the proper way to do it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
How to use the publishing operations
Use them in the UI just like a NetworkTable publish operation
Getting the data
All data published will be at
http://localhost:8080/GRIP/data(or whatever port you set in the settings) in json format. To get specific data, put their names as parameters in the URL -- e.g. if you wantmyContoursReportandmyBlobsReport, go tohttp://localhost:8080/GRIP/data?myContoursReport&myBlobsReportHTTP image source
GRIP-side
Just use it like a normal image source. The URL is configurable under
/GRIP/upload/image/-- e.g./GRIP/upload/image/my-image. Note that this path must be under/GRIP/upload/image/Supplier-side
Perform an HTTP
POSToperation to/GRIP/upload/image/your-imagewith the raw image bytes as binary data. It will be reconstructed server-side and trigger the pipeline to run if the image is different form the last one POSTed to that path.