mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Fixed handler end of postback key.
This commit is contained in:
+6
-4
@@ -18,15 +18,17 @@ public class SnapshotPushPostbackContents implements JSONSource {
|
||||
|
||||
private final WriteLatexDataSource writeLatexDataSource;
|
||||
private final String projectName;
|
||||
private final String postbackKey;
|
||||
|
||||
private final SnapshotPostExceptionBuilder snapshotPostExceptionBuilder;
|
||||
|
||||
private int versionID;
|
||||
private SnapshotPostException exception;
|
||||
|
||||
public SnapshotPushPostbackContents(WriteLatexDataSource writeLatexDataSource, String projectName, String contents) {
|
||||
this.projectName = projectName;
|
||||
public SnapshotPushPostbackContents(WriteLatexDataSource writeLatexDataSource, String projectName, String postbackKey, String contents) {
|
||||
this.writeLatexDataSource = writeLatexDataSource;
|
||||
this.projectName = projectName;
|
||||
this.postbackKey = postbackKey;
|
||||
snapshotPostExceptionBuilder = new SnapshotPostExceptionBuilder();
|
||||
fromJSON(new Gson().fromJson(contents, JsonElement.class));
|
||||
}
|
||||
@@ -41,9 +43,9 @@ public class SnapshotPushPostbackContents implements JSONSource {
|
||||
|
||||
public void processPostback() throws UnexpectedPostbackException {
|
||||
if (exception == null) {
|
||||
writeLatexDataSource.postbackReceivedSuccessfully(projectName, versionID);
|
||||
writeLatexDataSource.postbackReceivedSuccessfully(projectName, postbackKey, versionID);
|
||||
} else {
|
||||
writeLatexDataSource.postbackReceivedWithException(projectName, exception);
|
||||
writeLatexDataSource.postbackReceivedWithException(projectName, postbackKey, exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -28,7 +28,8 @@ public class SnapshotPushPostbackHandler extends AbstractHandler {
|
||||
String contents = getContentsOfReader(request.getReader());
|
||||
String projectName = request.getRequestURI().split("/")[1];
|
||||
System.out.println("Postback received for project: " + projectName);
|
||||
SnapshotPushPostbackContents postbackContents = new SnapshotPushPostbackContents(writeLatexDataSource, projectName, contents);
|
||||
String postbackKey = "postback";
|
||||
SnapshotPushPostbackContents postbackContents = new SnapshotPushPostbackContents(writeLatexDataSource, projectName, postbackKey, contents);
|
||||
try {
|
||||
postbackContents.processPostback();
|
||||
} catch (UnexpectedPostbackException e) {
|
||||
|
||||
Reference in New Issue
Block a user