Skip to content

Commit

Permalink
SAK-43114 Deprecated Web.serverUrl => RequestFilter.serverUrl (sakaip…
Browse files Browse the repository at this point in the history
  • Loading branch information
axxter99 authored Jan 31, 2020
1 parent e72de80 commit 09de618
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce
}

/**
* This method is a duplicate of org.sakaiproject.util.web.Web.serverUrl()
* This method is a duplicate of {@link org.sakaiproject.util.RequestFilter#serverUrl(HttpServletRequest)}
* Duplicated here from org.sakaiproject.util.web.Web.java so that
* the JSF tag library doesn't have a direct jar dependency on more of Sakai.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

import org.sakaiproject.rsf.copies.Web;
import org.sakaiproject.util.RequestFilter;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
Expand Down Expand Up @@ -51,7 +51,7 @@ public void setHttpServletRequest(HttpServletRequest request) {
// This method adjusts the protocol and port from a "correctly" computed
// URL to be closer to reality, via the hackery from Sakai "Web" utils.
public static String fixSakaiURL(HttpServletRequest req, String computed) {
String serverURL = Web.serverUrl(req);
String serverURL = RequestFilter.serverUrl(req);
int endprotpos = computed.indexOf("://");
int slashpos = computed.indexOf('/', endprotpos + 3);
return serverURL + computed.substring(slashpos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import org.sakaiproject.tool.cover.SessionManager;
import org.sakaiproject.util.ResourceLoader;
import org.sakaiproject.util.Web;
import org.sakaiproject.util.RequestFilter;

@Slf4j
public class SkinnableLogin extends HttpServlet implements Login {
Expand Down Expand Up @@ -240,7 +241,7 @@ else if ("/xlogin".equals(option))
session.setAttribute(ATTR_RETURN_URL, Web.returnUrl(req, null));

String containerCheckPath = this.getServletConfig().getInitParameter("container");
String containerCheckUrl = Web.serverUrl(req) + containerCheckPath;
String containerCheckUrl = RequestFilter.serverUrl(req) + containerCheckPath;

// support query parms in url for container auth
String queryString = req.getQueryString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
import org.sakaiproject.util.ResourceLoader;
import org.sakaiproject.util.Validator;
import org.sakaiproject.util.Web;
import org.sakaiproject.util.RequestFilter;

import lombok.extern.slf4j.Slf4j;

Expand Down Expand Up @@ -531,7 +532,7 @@ public PortalRenderContext includePortal(HttpServletRequest req,
PortalRenderContext rcontext = startPageContext(siteType, title, siteSkin, req, site);

// Make the top Url where the "top" url is
String portalTopUrl = Web.serverUrl(req)
String portalTopUrl = RequestFilter.serverUrl(req)
+ ServerConfigurationService.getString("portalPath") + "/";
if (prefix != null) portalTopUrl = portalTopUrl + prefix + "/";

Expand Down Expand Up @@ -673,7 +674,7 @@ public Map includeTool(HttpServletResponse res, HttpServletRequest req,
// Reset is different for Portlets
if (isPortletPlacement(placement))
{
resetActionUrl = Web.serverUrl(req)
resetActionUrl = RequestFilter.serverUrl(req)
+ ServerConfigurationService.getString("portalPath")
+ URLUtils.getSafePathInfo(req) + "?sakai.state.reset=true";
}
Expand Down Expand Up @@ -724,7 +725,7 @@ public Map includeTool(HttpServletResponse res, HttpServletRequest req,

if (renderResult.getJSR168HelpUrl() != null)
{
toolMap.put("toolJSR168Help", Web.serverUrl(req) + renderResult.getJSR168HelpUrl());
toolMap.put("toolJSR168Help", RequestFilter.serverUrl(req) + renderResult.getJSR168HelpUrl());
}

// Must have site.upd to see the Edit button
Expand All @@ -733,7 +734,7 @@ public Map includeTool(HttpServletResponse res, HttpServletRequest req,
if (securityService.unlock(SiteService.SECURE_UPDATE_SITE, site
.getReference()))
{
String editUrl = Web.serverUrl(req) + renderResult.getJSR168EditUrl();
String editUrl = RequestFilter.serverUrl(req) + renderResult.getJSR168EditUrl();
toolMap.put("toolJSR168Edit", editUrl);
toolMap.put("toolJSR168EditEncode", URLUtils.encodeUrl(editUrl));
}
Expand Down Expand Up @@ -1793,7 +1794,7 @@ public void includeLogin(PortalRenderContext rcontext, HttpServletRequest req,
{

// for the main login/out link
String logInOutUrl = Web.serverUrl(req);
String logInOutUrl = RequestFilter.serverUrl(req);
String message = null;
String image1 = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
import org.sakaiproject.util.ResourceLoader;
import org.sakaiproject.util.Validator;
import org.sakaiproject.util.Web;
import org.sakaiproject.util.RequestFilter;

import lombok.extern.slf4j.Slf4j;

Expand Down Expand Up @@ -577,7 +578,7 @@ public void doSite(HttpServletRequest req, HttpServletResponse res, Session sess
}catch(Exception e){}
//End - log the visit into SAKAI_EVENT

rcontext.put("currentUrlPath", Web.serverUrl(req) + req.getContextPath()
rcontext.put("currentUrlPath", RequestFilter.serverUrl(req) + req.getContextPath()
+ URLUtils.getSafePathInfo(req));

rcontext.put("usePortalSearch", ServerConfigurationService.getBoolean("portal.search.enabled", true));
Expand Down Expand Up @@ -943,7 +944,7 @@ public void includeTabs(PortalRenderContext rcontext, HttpServletRequest req,
rcontext.put("tabsAddLogout", Boolean.valueOf(addLogout));
if (addLogout)
{
String logoutUrl = Web.serverUrl(req)
String logoutUrl = RequestFilter.serverUrl(req)
+ ServerConfigurationService.getString("portalPath")
+ "/logout_gallery";
rcontext.put("tabsLogoutUrl", logoutUrl);
Expand All @@ -956,7 +957,7 @@ public void includeTabs(PortalRenderContext rcontext, HttpServletRequest req,
rcontext.put("tabsAddLogout", Boolean.valueOf(addLogout));
if (addLogout)
{
String logoutUrl = Web.serverUrl(req)
String logoutUrl = RequestFilter.serverUrl(req)
+ ServerConfigurationService.getString("portalPath")
+ "/logout_gallery";
rcontext.put("tabsLogoutUrl", logoutUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
import org.sakaiproject.util.MapUtil;
import org.sakaiproject.util.Validator;
import org.sakaiproject.util.Web;
import org.sakaiproject.util.RequestFilter;

import lombok.extern.slf4j.Slf4j;

Expand Down Expand Up @@ -475,7 +476,7 @@ public Map convertSiteToMap(HttpServletRequest req, Site s, String prefix,
m.put("shortDescription", Web.escapeHtml(shortDesc_trimmed));
}

String siteUrl = Web.serverUrl(req)
String siteUrl = RequestFilter.serverUrl(req)
+ ServerConfigurationService.getString("portalPath") + "/";
if (prefix != null) siteUrl = siteUrl + prefix + "/";
// siteUrl = siteUrl + Web.escapeUrl(siteHelper.getSiteEffectiveId(s));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.sakaiproject.util.PresenceObservingCourier;
import org.sakaiproject.util.ResourceLoader;
import org.sakaiproject.util.Web;
import org.sakaiproject.util.RequestFilter;

/**
* <p>
Expand Down Expand Up @@ -224,7 +225,7 @@ protected void sendAutoUpdate(PrintWriter out, HttpServletRequest req, String pl
int updateTime = PresenceService.getTimeout() / 2;

String userId = SessionManager.getCurrentSessionUserId();
StringBuilder url = new StringBuilder(Web.serverUrl(req));
StringBuilder url = new StringBuilder(RequestFilter.serverUrl(req));
url.append("/courier/");
url.append(placementId);
url.append("?userId=");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@
import org.sakaiproject.util.ResourceLoader;
import org.sakaiproject.util.SortedIterator;
import org.sakaiproject.util.Validator;
import org.sakaiproject.util.Web;
import org.sakaiproject.util.api.LinkMigrationHelper;

import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -15102,7 +15101,7 @@ public boolean displaySiteAlias() {

private void putDownloadParticipantPDFLinkIntoContext(Context context, RunData data, Site site) {
// the status servlet reqest url
String url = Web.serverUrl(data.getRequest()) + "/sakai-site-manage-tool/tool/printparticipant/" + site.getId();
String url = RequestFilter.serverUrl(data.getRequest()) + "/sakai-site-manage-tool/tool/printparticipant/" + site.getId();
context.put("downloadParticipantsPDF_URL", url);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import org.sakaiproject.util.ResourceLoader;
import org.sakaiproject.util.Validator;
import org.sakaiproject.util.Web;
import org.sakaiproject.util.RequestFilter;
import org.sakaiproject.vm.ActionURL;

import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -1124,7 +1125,7 @@ protected void setVmCourier(HttpServletRequest request, int refresh)
if (placement != null)
{
String userId = SessionManager.getCurrentSessionUserId();
StringBuilder url = new StringBuilder(Web.serverUrl(request));
StringBuilder url = new StringBuilder(RequestFilter.serverUrl(request));
url.append("/courier/");
url.append(placement.getId());
url.append("?userId=");
Expand Down

0 comments on commit 09de618

Please sign in to comment.