Skip to content

Commit

Permalink
Download SVG as ... - Pass Browser URL to server for error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
danjasuw committed Jun 27, 2019
1 parent 641474d commit 892212f
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ export class SVGDownloadUtils {
fileTypeField.setAttribute("value", typeString);
form.appendChild( svgStringField );
form.appendChild( fileTypeField );

const browserURL = window.location.href;
const browserURLField = document.createElement( "input" );
browserURLField.setAttribute("name", "browserURL");
browserURLField.setAttribute("value", browserURL);
form.appendChild( browserURLField );

document.body.appendChild(form); // Not entirely sure if this is necessary

form.submit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,13 @@ var ViewPsmPerPeptideLoadedFromWebServiceTemplate = function() {
fileTypeField.setAttribute("value", download_type);
form.appendChild( svgStringField );
form.appendChild( fileTypeField );

const browserURL = window.location.href;
const browserURLField = document.createElement( "input" );
browserURLField.setAttribute("name", "browserURL");
browserURLField.setAttribute("value", browserURL);
form.appendChild( browserURLField );

document.body.appendChild(form); // Not entirely sure if this is necessary
form.submit();
document.body.removeChild( form );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,13 @@ var ViewPsmsLoadedFromWebServiceTemplate = function() {
fileTypeField.setAttribute("value", download_type);
form.appendChild( svgStringField );
form.appendChild( fileTypeField );

const browserURL = window.location.href;
const browserURLField = document.createElement( "input" );
browserURLField.setAttribute("name", "browserURL");
browserURLField.setAttribute("value", browserURL);
form.appendChild( browserURLField );

document.body.appendChild(form); // Not entirely sure if this is necessary
form.submit();
document.body.removeChild( form );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ var CreateMergedSearchesLinkCountsVennDiagram = function() {
fileTypeField.setAttribute("value", download_type);
form.appendChild( svgStringField );
form.appendChild( fileTypeField );

const browserURL = window.location.href;
const browserURLField = document.createElement( "input" );
browserURLField.setAttribute("name", "browserURL");
browserURLField.setAttribute("value", browserURL);
form.appendChild( browserURLField );

document.body.appendChild(form); // Not entirely sure if this is necessary
form.submit();
document.body.removeChild( form );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6353,8 +6353,16 @@ var ImagePagePrimaryRootCodeClass = function() {
var fileTypeField = document.createElement( "input" );
fileTypeField.setAttribute("name", "fileType");
fileTypeField.setAttribute("value", typeString);

form.appendChild( svgStringField );
form.appendChild( fileTypeField );

const browserURL = window.location.href;
const browserURLField = document.createElement( "input" );
browserURLField.setAttribute("name", "browserURL");
browserURLField.setAttribute("value", browserURL);
form.appendChild( browserURLField );

document.body.appendChild(form); // Not entirely sure if this is necessary
form.submit();
document.body.removeChild( form );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ var QC_ChartDownloadHelp = function() {
fileTypeField.setAttribute("value", download_type);
form.appendChild( svgStringField );
form.appendChild( fileTypeField );

const browserURL = window.location.href;
const browserURLField = document.createElement( "input" );
browserURLField.setAttribute("name", "browserURL");
browserURLField.setAttribute("value", browserURL);
form.appendChild( browserURLField );

document.body.appendChild(form); // Not entirely sure if this is necessary
form.submit();
document.body.removeChild( form );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public ActionForward execute( ActionMapping mapping,
ActionForm actionForm,
HttpServletRequest request,
HttpServletResponse response ) throws Exception {

String referrerURLString = null;
String thisURLString = null;
URL referrerURL = null;
Expand All @@ -82,6 +82,10 @@ public ActionForward execute( ActionMapping mapping,
throw e;
}

// log.warn( "Request FileType: " + form.getFileType() );
// log.warn( "Request BrowserURL: " + form.getBrowserURL() );
// log.warn( "Request SvgString: " + form.getSvgString() );

try {
// ensure referrer was on the same server as this Action to prevent abuse
referrerURLString = request.getHeader("referer");
Expand Down Expand Up @@ -169,6 +173,8 @@ public ActionForward execute( ActionMapping mapping,

String msg = "Exception: RemoteAddr: " + request.getRemoteAddr()
+ ", Exception caught: " + e.toString()
+ "\nBrowserURL: " + form.getBrowserURL()
+ "\nFileType: " + form.getFileType()
+ "\nreferrerURL: " + referrerURLString
+ "\nthisURLString: " + thisURLString
+ "\nInput SVG:" + form.getSvgString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ public String getFileType() {
public void setFileType(String fileType) {
this.fileType = fileType;
}
public String getBrowserURL() {
return browserURL;
}
public void setBrowserURL(String browserURL) {
this.browserURL = browserURL;
}


private String svgString;
private String fileType;
private String browserURL;

}

0 comments on commit 892212f

Please sign in to comment.