Get the path to the target servlet.
@param strServletParam The servlet type (html or xml)
@return the servlet path.
498412
public static String getServletPath(Task task, String strServletParam)
    {
        String strServletName = null;
        if (strServletParam == null)
            strServletParam = Params.SERVLET;
        if (task != null)
            strServletName = task.getProperty(strServletParam);
        if ((strServletName == null) || (strServletName.length() == 0))
        {
            strServletName = Constants.DEFAULT_SERVLET;
 //?            if (this.getTask() instanceof RemoteRecordOwner)
 //?             strServletName = strServletName + "xsl";    // Special case - if task is a session, servlet should be appxsl
            if (Params.XHTMLSERVLET.equalsIgnoreCase(strServletParam))
                strServletName = Constants.DEFAULT_XHTML_SERVLET;
        }
        return strServletName;
    }
591467
public String getRequestPath() {
        Map<String,String> requestHeaders = getRequestHeaders();
        if (requestHeaders == null)
            return null;
        String path = requestHeaders.get(Listener.METAINFO_REQUEST_PATH);
        return path.startsWith("/") ? path : "/" + path;
    }
1115886
protected String getRelativePath(final HttpServletRequest request) {
		// IMPORTANT: DefaultServlet can be mapped to '/' or '/path/*' but
		// always
		// serves resources from the web app root with context rooted paths.
		// i.e. it can not be used to mount the web app root under a sub-path
		// This method must construct a complete context rooted path, although
		// subclasses can change this behaviour.

		// Are we being processed by a RequestDispatcher.include()?
		if (request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI) != null) {
			String result = (String) request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO);
			if (result == null) {
				result = (String) request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
			} else {
				result = (String) request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH) + result;
			}
			if ((result == null) || (result.equals(""))) {
				result = "/";
			}
			return (result);
		}

		// No, extract the desired path directly from the request
		String result = request.getPathInfo();
		if (result == null) {
			result = request.getServletPath();
		} else {
			result = request.getServletPath() + result;
		}
		if ((result == null) || (result.equals(""))) {
			result = "/";
		}
		return (result);

	}
214750
static String getStringParam(HttpServletRequest req, String param, String defaultValue) {
    String value = req.getParameter(param);
    return (value == null || (value = value.trim()).isEmpty()) ? defaultValue : value;
  }
211412
public String getResourcePath(String strResourceName)
    {
        if (strResourceName == null)
            strResourceName = THIN_RES_PATH + "Menu"; // ResourceConstants.MENU_RESOURCE;
        if ((!strResourceName.endsWith(RESOURCES))
            && (!strResourceName.endsWith(BUNDLE))
                && (!strResourceName.endsWith(PROPERTIES)))
                    strResourceName = strResourceName + "Resources";
        if (strResourceName.indexOf('.') == -1)
            strResourceName = getResPackage() + strResourceName;
        if (strResourceName.indexOf('.') == 0)
            strResourceName = Constants.ROOT_PACKAGE + strResourceName.substring(1);
        return strResourceName;
    }
1180268
@Override
	public String getWServletPath() {

		final String configValue = ConfigurationProperties.getServletSupportPath();

		return configValue == null ? getPostPath() : getServletPath(configValue);
	}
412181
public static String pathParam(String param, ContainerRequestContext ctx) {
		return ctx.getUriInfo().getPathParameters().getFirst(param);
	}
1050081
public String buildRequestUrl() {
    StringBuilder sb = new StringBuilder();
    sb.append(buildServletPath());
    if (null != pathInfo) {
      sb.append(pathInfo);
    }
    if (null != queryString) {
      sb.append('?').append(queryString);
    }
    return sb.toString();
  }
544654
public ServletHolder mapPathToServlet(String pathSpec,
                                          String servletName)
    {
        ServletHolder holder =(ServletHolder)_nameMap.get(servletName);

        if (!pathSpec.startsWith("/") && !pathSpec.startsWith("*"))
        {
            log.warn("pathSpec should start with '/' or '*' : "+pathSpec);
            pathSpec="/"+pathSpec;
        }
        
        if (holder==null)
            throw new IllegalArgumentException("Unknown servlet: "+servletName);
        _servletMap.put(pathSpec,holder);
        return holder;
    }
861968
public static String getServletPath(HttpServletRequest request) {
    String servletPath = request.getServletPath();
    if (Strings.isNotEmpty(servletPath)) {
      return servletPath;
    } else {
      String uri = request.getRequestURI();
      if (uri.length() == 1) return "";
      // process context
      String context = request.getContextPath();
      int length = context.length();
      if (length > 2) {
        if ('/' == context.charAt(length - 1)) context = context.substring(0, length - 1);
        return servletPath = uri.substring(context.length());
      } else {
        return uri;
      }
    }
  }
1058997
public String mapRequestPath(HttpServletRequest request) {

        String endpointName = Path.newInstance(request).firstSegment();
        return StringUtils.lowerCase(endpointName);
    }
601497
public String getContextPath() {
        ServletRequest request = pageContext.getRequest();
        if (request instanceof HttpServletRequest) {
            return ((HttpServletRequest) request).getContextPath();
        }
        return "/";
    }
745946
static private String getPostBackUrlFromHTML(String html)
  {
    Document doc = Jsoup.parse(html);
    Elements e1 = doc.getElementsByTag("body");
    Elements e2 = e1.get(0).getElementsByTag("form");
    String postBackUrl = e2.first().attr("action");
    return postBackUrl;
  }
527288
@Override
    public String getURL() {
        ServletRESTRequestImpl ret = castRequest();
        if (ret != null)
            return ret.getURL();
        return null;
    }
1285025
@Override
    public String getServletPath() {
        try {
            collaborator.preInvoke(componentMetaData);
            return request.getServletPath();
        } finally {
            collaborator.postInvoke();
        }
    }
1163347
@OverrideOnDemand
  protected boolean linkNeedsContextPath (@Nullable final String sHref)
  {
    if (sHref == null)
      return false;

    // If prefix is defined and already present no need to change something
    // Or if the server prefix path is just "/" and the links starts with "/"
    // it's also fine
    if (sHref.startsWith (m_sServerPrefixPath))
      return false;

    // javascript: and mailto: are handled by URLProtocolRegistry
    if (URLProtocolRegistry.getInstance ().hasKnownProtocol (sHref) || sHref.startsWith ("#"))
      return false;

    // Prefix is needed
    return true;
  }
282859
@Override
	public String getApplicationPath() {
		return request.getScheme() + "://" + request.getServerName()
			+ (request.getServerPort() != 80? ":" + request.getServerPort() : "")
			+ request.getContextPath();
	}