-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backport latest client changes from nbusy
- Loading branch information
Showing
9 changed files
with
115 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,3 @@ | |
public interface Middleware { | ||
void handler(ReqCtx ctx); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package neptulon.client; | ||
|
||
import com.google.gson.Gson; | ||
import com.google.gson.JsonElement; | ||
|
||
/** | ||
* Response context. | ||
*/ | ||
public class ResCtx { | ||
private final String id; | ||
private final JsonElement result; // result parameters | ||
private final Message.ResError error; // response error (if any) | ||
private final Gson gson; | ||
|
||
public ResCtx(String id, JsonElement result, Message.ResError error, Gson gson) { | ||
this.id = id; | ||
this.result = result; | ||
this.error = error; | ||
this.gson = gson; | ||
} | ||
|
||
public String getID() { | ||
return id; | ||
} | ||
|
||
|
||
public <T> T getResult(Class<T> classOfT) { | ||
return gson.fromJson(result, classOfT); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package neptulon.client.callbacks; | ||
|
||
/** | ||
* Callback for connection event. | ||
*/ | ||
public interface ConnCallback { | ||
void connected(); | ||
void disconnected(String reason); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package neptulon.client.callbacks; | ||
|
||
import neptulon.client.ResCtx; | ||
|
||
/** | ||
* Callback for responses. | ||
*/ | ||
public interface ResCallback { | ||
void handleResponse(ResCtx ctx); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters