/** * Get the proxied path for an application. * * @param id the application id to use * @return the base path to that application through the proxy */ public static String getPath(ApplicationId id) { return getPath(id, false); }
/** * Get the proxied path for an application. * * @param id the application id to use * @param path the rest of the path to the application * @return the base path to that application through the proxy */ public static String getPath(ApplicationId id, String path) { return getPath(id, path, false); }
/** * Get the proxied path for an application. * @param id the application id to use. * @param path the rest of the path to the application. * @return the base path to that application through the proxy. */ public static String getPath(ApplicationId id, String path) { if(path == null) { return getPath(id); } else { return ujoin(getPath(id), path); } }
/** * Get the proxied path for an application. * @param id the application id to use. * @param path the rest of the path to the application. * @return the base path to that application through the proxy. */ public static String getPath(ApplicationId id, String path) { if(path == null) { return getPath(id); } else { return ujoin(getPath(id), path); } }
/** * Get the proxied path for an application. * @param id the application id to use. * @param path the rest of the path to the application. * @return the base path to that application through the proxy. */ public static String getPath(ApplicationId id, String path) { if(path == null) { return getPath(id); } else { return ujoin(getPath(id), path); } }
/** * Get the proxied path for an application. * * @param id the application id to use * @param path the rest of the path to the application * @param redirected whether the path should contain the redirect component * @return the base path to that application through the proxy */ public static String getPath(ApplicationId id, String path, boolean redirected) { if (path == null) { return getPath(id, redirected); } else { return ujoin(getPath(id, redirected), path); } }
private static Cookie makeCheckCookie(ApplicationId id, boolean isSet) { Cookie c = new Cookie(getCheckCookieName(id),String.valueOf(isSet)); c.setPath(ProxyUriUtils.getPath(id)); c.setMaxAge(60 * 60 * 2); //2 hours in seconds return c; }
@Override public String getWebProxyBase() { this.readLock.lock(); try { return ProxyUriUtils.getPath(applicationAttemptId.getApplicationId()); } finally { this.readLock.unlock(); } }
private static Cookie makeCheckCookie(ApplicationId id, boolean isSet) { Cookie c = new Cookie(getCheckCookieName(id),String.valueOf(isSet)); c.setPath(ProxyUriUtils.getPath(id)); c.setMaxAge(60 * 60 * 2); //2 hours in seconds return c; }
private static Cookie makeCheckCookie(ApplicationId id, boolean isSet) { Cookie c = new Cookie(getCheckCookieName(id),String.valueOf(isSet)); c.setPath(ProxyUriUtils.getPath(id)); c.setMaxAge(60 * 60 * 2); //2 hours in seconds return c; }
private static Cookie makeCheckCookie(ApplicationId id, boolean isSet) { Cookie c = new Cookie(getCheckCookieName(id),String.valueOf(isSet)); c.setPath(ProxyUriUtils.getPath(id)); c.setMaxAge(60 * 60 * 2); //2 hours in seconds return c; }
@Override public String getWebProxyBase() { this.readLock.lock(); try { return ProxyUriUtils.getPath(applicationAttemptId.getApplicationId()); } finally { this.readLock.unlock(); } }
@Override public String getWebProxyBase() { this.readLock.lock(); try { return ProxyUriUtils.getPath(applicationAttemptId.getApplicationId()); } finally { this.readLock.unlock(); } }
/** * Get the proxied path for an application * @param id the id of the application * @param path the path of the application. * @param query the query parameters * @param approved true if the user has approved accessing this app. * @return the proxied path for this app. */ public static String getPathAndQuery(ApplicationId id, String path, String query, boolean approved) { StringBuilder newp = new StringBuilder(); newp.append(getPath(id, path)); boolean first = appendQuery(newp, query, true); if(approved) { appendQuery(newp, PROXY_APPROVAL_PARAM+"=true", first); } return newp.toString(); }
@Test(expected = IllegalArgumentException.class) public void testGetPathApplicationIdBad() { ProxyUriUtils.getPath(null); }
@Test(expected = IllegalArgumentException.class) public void testGetPathApplicationIdBad() { ProxyUriUtils.getPath(null); }
@Test public void testGetPathApplicationIdString() { assertEquals("/proxy/application_6384623_0005", ProxyUriUtils.getPath(BuilderUtils.newApplicationId(6384623l, 5), null)); assertEquals("/proxy/application_6384623_0005/static/app", ProxyUriUtils.getPath(BuilderUtils.newApplicationId(6384623l, 5), "/static/app")); assertEquals("/proxy/application_6384623_0005/", ProxyUriUtils.getPath(BuilderUtils.newApplicationId(6384623l, 5), "/")); assertEquals("/proxy/application_6384623_0005/some/path", ProxyUriUtils.getPath(BuilderUtils.newApplicationId(6384623l, 5), "some/path")); }
@Test public void testGetPathApplicationIdString() { assertEquals("/proxy/application_6384623_0005", ProxyUriUtils.getPath(BuilderUtils.newApplicationId(6384623l, 5), null)); assertEquals("/proxy/application_6384623_0005/static/app", ProxyUriUtils.getPath(BuilderUtils.newApplicationId(6384623l, 5), "/static/app")); assertEquals("/proxy/application_6384623_0005/", ProxyUriUtils.getPath(BuilderUtils.newApplicationId(6384623l, 5), "/")); assertEquals("/proxy/application_6384623_0005/some/path", ProxyUriUtils.getPath(BuilderUtils.newApplicationId(6384623l, 5), "some/path")); }