private String appendParam(String url, String name, Object value) { // TODO: Check the object type to do the appropriate cast or conversion // This currently assumes the value is a string if (name == null || value == null) { return url; } if (!(value instanceof String)) { return url; } String param = name + "=" + NetUtil.encode((String) value); return appendParams(url, param); }
public ServletLogInfo(HttpServletRequest request, String path, boolean pathIsJobID) { super(); this.method = request.getMethod().toUpperCase(); this.from = NetUtil.getClientIP(request); if (pathIsJobID) { this.jobID = parseJobID(path); } else { this.path = path; } Enumeration<String> paramNames = request.getParameterNames(); while (paramNames.hasMoreElements()) { String nextName = paramNames.nextElement(); if (nextName.equalsIgnoreCase("runid")) { runID = request.getParameter(nextName); break; } } }
/** * Obtain the Domain Name from the given URL. An inappropriate URL will * throw an Exception. * * @param url The URL string to parse from. * @return String domain name. * @throws IOException If anything goes awry during URL handling. */ public static String getDomainName(final URL url) throws IOException { final InetAddress address = InetAddress.getByName(url.getHost()); final String fqdn = address.getHostName(); return getDomainName(fqdn); }
private void setRegistryClientProps(HttpServletRequest request) { String local = System.getProperty(RegistryClient.class.getName() + ".local"); String host = System.getProperty(RegistryClient.class.getName() + ".host"); if (local != null && "true".equals(local)) { host = NetUtil.getServerName(JavaWebStartServlet.class); } if (host != null) { request.setAttribute("targetHost", host); } }
public static File getFileFromURL(final URL url) { log.debug("getFileFromURL: " + url); final String path = url.getPath(); final File found = new File(URI.create(url.toExternalForm())); final File f; if (found.exists()) { f = found; } else { f = new File(NetUtil.decode(path)); } return f; } }
qp.append(NetUtil.getServerName(null)); qp.append(job.getRequestPath()); qp.append("?");
Constructor constructor = c.getDeclaredConstructor(args); String name = NetUtil .decode(s.substring(nameStart + 1, nameEnd)); Principal principal = (Principal) constructor.newInstance(name); if (subject == null)
public static String encodeSubject(Subject subject) { if (subject == null) { return null; } StringBuilder sb = new StringBuilder(); for (final Principal principal : subject.getPrincipals()) { sb.append(principal.getClass().getName()); sb.append("["); sb.append(NetUtil.encode(principal.getName())); sb.append("]"); } return sb.toString(); }
publicCred.add(new SSOCookieCredential( cookieCredential.getSsoCookieValue(), NetUtil.getDomainName(serverName))); publicCred.add(AuthMethod.COOKIE);
job.setRemoteIP(NetUtil.getClientIP(request)); return job;
NetUtil.getDomainName(request.getServerName()));
availability.setClientIP(NetUtil.getClientIP(request));
this.cutout = "CIRCLE=" + NetUtil.encode(daf.format(dvals.iterator())); } else if (dvals.size() >= 6) { this.cutout = "POLYGON=" + NetUtil.encode(daf.format(dvals.iterator())); } else if ("spectralinterval".equalsIgnoreCase(tokens[0])) { this.cutout = "BAND=" + NetUtil.encode(daf.format(dvals.iterator())); } else { this.requestFail = "invalid parameter: cutout=" + str;
NetUtil.getDomainName(getRequest().getResourceRef().toUrl())); } catch (InvalidDelegationTokenException | IOException e) { log.debug("Cannot use SSO Cookie. Reason: "
path.append("/dn/").append(NetUtil.encode(dn));
String path = "/" + NetUtil.encode(userID) + "?idType=" + this .getIdType(principal) + "&detail=identity";