Restoring Back Link Behavior for a Report Viewer Servlet Template Added in AppDev Studio 4.4

Note: The Report Viewer template in the first maintenance release of AppDev Studio 4.4 already includes the following changes.
The Report Viewer Servlet templates for the SAS Web Infrastructure Platform and SAS Foundation Services do not preserve the back link behavior provided by these templates in the prior version of SAS AppDev Studio. It is possible to restore this behavior using appropriate URL parameters. This has been incorporated into the instructions for updating the content for these templates when migrating projects. The following instructions restore the code as it originally existed.
To restore the back link behavior to a new Report Viewer Servlet (uses SAS Web Report Viewer and SAS WIP) template:
  1. In the Project Explorer, expand the Java Resources folder, the src folder, and then the folder or folders that represent the packages where the servlet for the Report Viewer Servlet template was placed. The default folder is servlets.
  2. Right-click the Report Viewer servlet source file and select Open.
  3. From the main menu, select Editthen selectFind/Replace.
  4. In the Find field, enter INFORMATION_SELECTOR and click Find. The file scrolls to where the INFORMATION_SELECTOR constant is found.
  5. After this line, insert the following code:
    private static final String DEFAULT_BACK_LABEL = "Back to RFS";
    private static final String DEFAULT_BACK_DESC = 
       "Return to remote file selector in the ReportViewer Example";
  6. Locate the comment // Configurable values in the file. After this comment, insert the following code:
    private String backLabel;
    private String backDesc;
  7. Locate the comment // Setters for use with Spring configuration in the file. After this comment, insert the following code:
    public void setBackLabel(String backLabel) {
        this.backLabel = backLabel;
    }
    
    public void setBackDescription(String backDesc) {
        this.backDesc = backDesc;
    }
  8. Locate the comment // Ensure required fields are initialized in the file. After this comment, insert the following code:
    if (backLabel == null) {
        backLabel = DEFAULT_BACK_LABEL;
    }
    if (backDesc == null) {
        backDesc = DEFAULT_BACK_DESC;
    }
  9. In the Find field, enter Build URL and click Find. The file scrolls to where a try block contains a comment with this text.
  10. Replace the comment and the statement that follows it with the following code:
    // Build URL with parameters to open the report.
    String url = viewer + "&" + CommonKeys.PFS_REQUEST_PATH_URL + "="
       + URLEncoder.encode(path,"UTF-8")
       + "&" + CommonKeys.PFS_REQUEST_BACKURL_LIST + "="
       + URLEncoder.encode(request.getRequestURL().toString(), "UTF-8")
       + "&" + CommonKeys.PFS_REQUEST_BACKLABEL_LIST + "="
       + URLEncoder.encode(backLabel,"UTF-8")
       + "&" + CommonKeys.PFS_REQUEST_BACKDESCRIPTION_LIST + "="
       + URLEncoder.encode(backDesc, "UTF-8");
  11. Save and close the servlet source file.
To restore the back link behavior to a new Report Viewer Servlet (uses SAS Web Report Viewer and SAS FS) template example:
  1. In the Project Explorer, expand the Java Resources folder, the src folder, and then the folder or folders that represent the packages where the servlet for the Report Viewer Servlet template was placed. The default folder is servlets.
  2. Right-click the Report Viewer servlet source file and select Open.
  3. From the main menu, select Editthen selectFind/Replace.
  4. In the Find field, enter INFORMATION_SELECTOR and click Find. The file scrolls to where the INFORMATION_SELECTOR constant is found.
  5. After this line, insert the following code:
    private static final String BACK_LABEL = "Back to RFS";
    private static final String BACK_DESC =
       "Return to remote file selector in the ReportViewer Example";
    
  6. In the Find field, enter sendRedirect and click Find. The file scrolls to where a try block that contains a comment with this text.
  7. Replace the comment and the statement that follows it with the following code:
    // Build URL with parameters to open the report.
    String url = viewer + "?" + com.sas.web.keys.CommonKeys.PFS_REQUEST_PATH_URL
       + "=" + java.net.URLEncoder.encode(path,"UTF-8")
       + "&" + CommonKeys.PFS_REQUEST_BACKURL_LIST + "="
       + URLEncoder.encode(request.getRequestURL().toString(), "UTF-8")
       + "&" + CommonKeys.PFS_REQUEST_BACKLABEL_LIST + "="
       + URLEncoder.encode(BACK_LABEL,"UTF-8")
       + "&" + CommonKeys.PFS_REQUEST_BACKDESCRIPTION_LIST + "="
       + URLEncoder.encode(BACK_DESC, "UTF-8");
  8. Save and close the servlet source file.