Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/action/FormViewAction.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -95,7 +95,7 @@ public ModelAndView handleRequest(FORM form, BindException errors) throws Except
{
URLHelper url = getSuccessURL(form);
if (null != url)
return HttpView.redirect(url);
return HttpView.redirect(url, false);
try (Timing ignored = MiniProfiler.step("createView"))
{
ModelAndView successView = getSuccessView(form);
Expand Down
4 changes: 2 additions & 2 deletions api/src/org/labkey/api/action/SimpleRedirectAction.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,8 +23,8 @@
import org.springframework.web.servlet.ModelAndView;

/**
* Base class for actions that don't want to render their own page,
* but instead just bounce the user to another URL via a HTTP response code that redirects the browser
* Base class for actions that don't want to render their own page, but instead just bounce the user to another URL via
* an HTTP response code that redirects the browser
*/
public abstract class SimpleRedirectAction<FORM> extends SimpleViewAction<FORM>
{
Expand Down
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/util/URLHelper.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -915,7 +915,7 @@ public boolean isConfiguredExternalHost()
return false;
}

// Issue 35896 - Disallow external redirects to URLs not on the allow list
// Issue 35896 - Disallow external redirects to URLs not on the allowlist
public boolean isAllowableHost()
{
String host = StringUtils.trimToNull(this.getHost());
Expand Down
5 changes: 0 additions & 5 deletions api/src/org/labkey/api/view/HttpPostRedirectView.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,13 +24,8 @@
import java.util.Map;

/**
* User: kevink
* Date: 11/8/12
*
* Renders an HTML form that will POST inputs to a URL.
* Set the PageConfig template to Template.None before rendering the view.
*
* @see HttpRedirectView
*/
public class HttpPostRedirectView extends HttpView<Object>
{
Expand Down
49 changes: 0 additions & 49 deletions api/src/org/labkey/api/view/HttpRedirectView.java

This file was deleted.

17 changes: 8 additions & 9 deletions api/src/org/labkey/api/view/HttpView.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,10 +53,9 @@


/**
* BEWARE: Our shorts are showing a bit here. Our primary HTML components (aka views)
* are not spring Views. Architecturally they act like ModelAndView. We may want to
* fix this in the future, but we're moving forward with this conceptual co-mingling
* for now.
* BEWARE: Our shorts are showing a bit here. Our primary HTML components (aka views) are not spring Views.
* Architecturally, they act like ModelAndView. We may want to fix this in the future, but we're moving forward with
* this conceptual co-mingling for now.
*/
public abstract class HttpView<ModelBean> extends DefaultModelAndView<ModelBean> implements View, HasViewContext
{
Expand DownExpand Up@@ -595,20 +594,20 @@ protected void renderInternal(Object model, PrintWriter out) throws IOException

public static HttpView<?> redirect(URLHelper url, boolean allowAbsoluteUrl)
{
return new HttpRedirectView((!allowAbsoluteUrl || url.isLocalUri(getRootContext())) ? url.getLocalURIString() : url.getURIString());
String redirectUrl = (!allowAbsoluteUrl || url.isLocalUri(getRootContext())) ? url.getLocalURIString() : url.getURIString();
return redirect(redirectUrl);
}

public static HttpView<?> redirect(URLHelper url)
public static HttpView<?> redirect(ActionURL url)
{
return new HttpRedirectView(url.getLocalURIString());
return redirect(url.getLocalURIString());
}

public static HttpView<?> redirect(String url)
{
return new HttpRedirectView(url);
throw new RedirectException(url);
}


/**
* Pulls out the context's URL for redirecting. This fetches
* the original URL before any redirects, in case internally
Expand Down
8 changes: 1 addition & 7 deletions api/src/org/labkey/api/view/Portal.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -1584,18 +1584,12 @@ public static MultiValuedMap<String, WebPart> getPartsByLocation(Collection<WebP
return multiMap;
}

// The maintained view map is case-insensitive
public static WebPartFactory getPortalPart(String name)
{
return getViewMap().get(name);
}

// The maintained view map is now case-insensitive, so this is identical to the above method
@Deprecated // Call getPortalPart() instead - TODO: DELETE, unused
public static WebPartFactory getPortalPartCaseInsensitive(String name)
{
return getPortalPart(name);
}

private static synchronized Map<String, WebPartFactory> getViewMap()
{
if (null == _viewMap)
Expand Down
6 changes: 0 additions & 6 deletions api/src/org/labkey/filters/ContentSecurityPolicyFilter.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -244,12 +244,6 @@ public static String getScriptNonceHeader(HttpServletRequest request)

private static final SecureRandom rand = new SecureRandom();

@Deprecated // Keep around to ease the transition to the new method signature
public static void registerAllowedSources(Directive directive, String key, String... allowedSources)
{
registerAllowedSources(key, directive, allowedSources);
}

public static void registerAllowedSources(String key, Directive directive, String... allowedSources)
{
synchronized (SUBSTITUTION_LOCK)
Expand Down
4 changes: 2 additions & 2 deletions core/src/org/labkey/core/portal/ProjectController.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -635,7 +635,7 @@ public ModelAndView getView(AddWebPartForm form, boolean reshow, BindException e
{
URLHelper successURL = getSuccessURL(form);
if (null != successURL)
return HttpView.redirect(successURL);
return HttpView.redirect(successURL, false);
return HttpView.redirect(getContainer().getStartURL(getUser()));
}

Expand DownExpand Up@@ -915,7 +915,7 @@ public ModelAndView getView(CustomizePortletForm customizePortletForm, boolean r
handlePost(customizePortletForm, errors);
URLHelper successURL = getSuccessURL(customizePortletForm);
if (null != successURL)
return HttpView.redirect(successURL);
return HttpView.redirect(successURL, false);
return HttpView.redirect(getContainer().getStartURL(getUser()));
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -109,7 +109,7 @@ public void validateCommand(TestSecondaryForm form, Errors errors)
public ModelAndView getView(TestSecondaryForm form, boolean reshow, BindException errors)
{
if (!getUser().isGuest())
return HttpView.redirect(AuthenticationManager.getAfterLoginURL(getContainer(), null, getUser()));
return HttpView.redirect(AuthenticationManager.getAfterLoginURL(getContainer(), null, getUser()), false);

PrimaryAuthenticationResult result = AuthenticationManager.getPrimaryAuthenticationResult(getViewContext().getSession());

Expand Down
7 changes: 1 addition & 6 deletions query/src/org/labkey/query/reports/ReportsController.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -144,7 +144,6 @@
import org.labkey.api.util.URLHelper;
import org.labkey.api.view.ActionURL;
import org.labkey.api.view.HtmlView;
import org.labkey.api.view.HttpRedirectView;
import org.labkey.api.view.HttpView;
import org.labkey.api.view.JspView;
import org.labkey.api.view.NavTree;
Expand DownExpand Up@@ -203,10 +202,6 @@
import static org.labkey.api.util.DOM.SPAN;
import static org.labkey.api.util.DOM.cl;

/**
* User: Karl Lum
* Date: Apr 19, 2007
*/
public class ReportsController extends SpringActionController
{
private static final Logger _log = LogManager.getLogger(ReportsController.class);
Expand DownExpand Up@@ -1027,7 +1022,7 @@ public ModelAndView getView(ReportDesignBean<?> form, BindException errors) thro
return new HtmlView(SPAN(cl("labkey-error"), e.getMessage(), ". Unable to create report."));
}

if (!isPrint() && !(reportView instanceof HttpRedirectView) && DiscussionService.get() != null)
if (!isPrint() && DiscussionService.get() != null)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me even happier to eliminate HttpRedirectView.

{
DiscussionService service = DiscussionService.get();
String title = "Discuss report - " + _report.getDescriptor().getReportName();
Expand Down