mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Checking postback key.
This commit is contained in:
parent
e31b4fead5
commit
0ac263ad45
1 changed files with 11 additions and 1 deletions
|
@ -5,6 +5,7 @@ import org.eclipse.jetty.server.Request;
|
|||
import org.eclipse.jetty.server.handler.ResourceHandler;
|
||||
import org.eclipse.jetty.util.MultiMap;
|
||||
import uk.ac.ic.wlgitbridge.writelatex.WriteLatexAPI;
|
||||
import uk.ac.ic.wlgitbridge.writelatex.api.request.push.exception.InvalidPostbackKeyException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -26,9 +27,18 @@ public class AttsResourceHandler extends ResourceHandler {
|
|||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
||||
HttpURI uri = baseRequest.getUri();
|
||||
System.out.println(baseRequest.getMethod() + " " + uri);
|
||||
System.out.println(uri.getPath());
|
||||
MultiMap<String> multimap = new MultiMap<String>();
|
||||
uri.decodeQueryTo(multimap);
|
||||
String[] pathSections = uri.getPath().split("/");
|
||||
String key = multimap.getString("key");
|
||||
if (key == null || pathSections.length < 2) {
|
||||
throw new ServletException();
|
||||
}
|
||||
try {
|
||||
writeLatexDataSource.checkPostbackKey(pathSections[1], key);
|
||||
} catch (InvalidPostbackKeyException e) {
|
||||
throw new ServletException();
|
||||
}
|
||||
System.out.println(multimap);
|
||||
|
||||
if (false) {
|
||||
|
|
Loading…
Reference in a new issue