/* (non-Javadoc)
@see org.jasig.resource.aggr.util.ResourcesElementsProvider#getResourcesParameter(javax.servlet.http.HttpServletRequest, java.lang.String, java.lang.String)
779976
@Override
    public String getResourcesParameter(HttpServletRequest request, String skinXml, String name) {
        final Resources skinResources = this.getResources(request, skinXml);
        if (skinResources == null) {
            logger.warn("Could not find skin file " + skinXml);
            return null;
        }
        
        for (final Parameter parameter : skinResources.getParameter()) {
            if (parameter.getName().equals(name)) {
                return parameter.getValue();
            }
        }
        
        return null;
    }
162149
public static Resource getConsoleResource(BeanContext context) {
        SlingHttpServletRequest request = context.getRequest();
        ResourceResolver resolver = request.getResourceResolver();
        String path = null;
        // use the resource set by a probably executed 'defineObjects' tag (supports including components)
        Resource resource = context.getAttribute("resource", Resource.class);
        if (resource == null) {
            resource = request.getResource();
        }
        if (resource != null) {
            path = resource.getPath();
        }
        // use the suffix as the resource path if the resource is not defined or references a servlet
        if (StringUtils.isBlank(path) || path.startsWith("/bin/")) {
            RequestPathInfo requestPathInfo = request.getRequestPathInfo();
            path = requestPathInfo.getSuffix();
            resource = null;
        }
        if (resource == null && StringUtils.isNotBlank(path)) {
            resource = resolver.getResource(path);
        }
        if (resource == null) {
            // fallback to the root node if the servlet request has no suffix
            resource = resolver.getResource("/");
        }
        return resource;
    }
507338
public String extractResource(XEvent event) {
		XAttribute attribute = event.getAttributes().get(KEY_RESOURCE);
		if (attribute == null) {
			return null;
		} else {
			return ((XAttributeLiteral) attribute).getValue();
		}
	}
729967
@Override
	public Reader getResourceAsReader(String resourceName) throws IOException {

		try {
			return rsHandler.getResource(null, resourceName, true);
		} catch (ResourceNotFoundException e) {
			throw new IOException("The resource '" + resourceName + "' was not found.");
		}
	}
201221
private void getJavaSource() {
		String[] resourceFiles = new String[getConfigurationFiles().length + 1];
		resourceFiles[0] = getSourceFileName();
		for (int i = 0; i < getConfigurationFiles().length; i++) {
			resourceFiles[i + 1] = getConfigurationFiles()[i];
		}

		GetResourceRequest request = new GetResourceRequest(resourceFiles);
		GwtCommand command = new GwtCommand(GetResourceRequest.COMMAND);
		command.setCommandRequest(request);
		GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<GetResourceResponse>() {

			public void execute(GetResourceResponse response) {
				if (response.getResources() == null) {
					return;
				}
				showFiles(response.getResources());
			}
		});
	}
1296828
public static Resource getResourceByType(int resourceType) {
    for (Resource resource : Resources.values()) {
      if (resource.resourceType() == resourceType) {
        return resource;
      }
    }
    return null;
  }
1271092
private ResourceType getResourceType(String resourceTag) {
        if (resourceTag == null || !resourceTag.endsWith("-resource")) {
            return ResourceType.unknown;
        }

        try {
            return ResourceType.valueOf(resourceTag.substring(0, resourceTag.length() - 9));
        } catch (Exception e) {
            return ResourceType.unknown;
        }
    }
439484
public String getResourceType() {
        if (resourceType == null) {
            resourceType = "";
            String type = resource.getResourceType();
            if (StringUtils.isBlank(type) || getPrimaryType().equals(type)) {
                Resource contentResource = getContentResource();
                if (contentResource != null) {
                    type = contentResource.getResourceType();
                    if (StringUtils.isNotBlank(type)) {
                        ResourceHandle handle = ResourceHandle.use(contentResource);
                        if (type.equals(handle.getPrimaryType())) {
                            type = null;
                        }
                    }
                }
            }
            if (StringUtils.isNotBlank(type)) {
                // check for a real existing resource type
                if (!Resource.RESOURCE_TYPE_NON_EXISTING.equals(type)) {
                    resourceType = type;
                }
            }
        }
        return resourceType;
    }
694315
public static String getParam(String name) {
		String param = getServletRequest().getParameter(name);
		if(null == param){
			MultipartFormData multipart = getMultipart();
			if(null != multipart){
				param = multipart.getParam(param);
			}
		}
		return param;
	}
1291183
@Override
    public <T> Parameter<T> getParameter(int arg0, Class<T> arg1)
    {

        return query.getParameter(arg0, arg1);
    }
1331690
@Override
    public String getParameter(String name) {
        String[] vals = getParameterMap().get(name);

        return (vals != null && vals.length > 0) ? vals[0] : null;
    }
687655
public static Resource getResource(Object adaptable) {
    if (adaptable instanceof Resource) {
      return (Resource)adaptable;
    }
    else if (adaptable instanceof SlingHttpServletRequest) {
      SlingHttpServletRequest request = (SlingHttpServletRequest)adaptable;
      return request.getResource();
    }
    return null;
  }
700054
@Override
  public URL getResource(String name) {

    URL result = null;

    if (bestCandidate != null) {
      result = bestCandidate.getResource(name);
      if (result == null) {
        bestCandidate = null;
      }
    }

    ClassLoadHelper loadHelper = null;

    Iterator<ClassLoadHelper> iter = loadHelpers.iterator();
    while (iter.hasNext()) {
      loadHelper = iter.next();

      result = loadHelper.getResource(name);
      if (result != null) {
        break;
      }
    }

    bestCandidate = loadHelper;
    return result;
  }
719960
protected CmsResource getResource(CmsObject cms, I_CmsWidgetParameter param) {

        I_CmsXmlContentValue value = (I_CmsXmlContentValue)param;
        CmsFile file = value.getDocument().getFile();
        String resourceName = cms.getSitePath(file);
        if (CmsWorkplace.isTemporaryFile(file)) {
            StringBuffer result = new StringBuffer(resourceName.length() + 2);
            result.append(CmsResource.getFolderPath(resourceName));
            result.append(CmsResource.getName(resourceName).substring(1));
            resourceName = result.toString();
        }
        try {
            List<CmsResource> listsib = cms.readSiblings(resourceName, CmsResourceFilter.ALL);
            for (int i = 0; i < listsib.size(); i++) {
                CmsResource resource = listsib.get(i);
                // get the default locale of the resource
                Locale locale = getDefaultLocale(cms, cms.getSitePath(resource));
                if (locale.equals(value.getLocale())) {
                    // get the property for the right locale
                    return resource;
                }
            }
        } catch (CmsVfsResourceNotFoundException e) {
            // may hapen if editing a new resource
            if (LOG.isDebugEnabled()) {
                LOG.debug(e.getLocalizedMessage(), e);
            }
        } catch (CmsException e) {
            if (LOG.isErrorEnabled()) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }
        return file;
    }
1103348
public static String getResourceAsString(final String resourcePath) {
        File resource = getFileForResource(resourcePath);

        if (!resource.exists() || resource.isDirectory()) {
            logger.error("Cannot read resource, does not exist"
                    + " (or is a directory).");
            return "";
        }

        try {
            return FileUtils.readFileToString(resource);
        } catch (IOException ioe) {
            logger.error(ioe.getMessage());
            return "";
        }
    }
594642
@SuppressWarnings("null")
  protected final Resource getRootResource(SlingHttpServletRequest request) {
    String path = RequestParam.get(request, RP_PATH);
    if (StringUtils.isEmpty(path) && request.getResource() != null) {
      path = request.getResource().getPath();
    }
    if (StringUtils.isNotEmpty(path)) {
      path = StringUtils.removeEnd(path, "/" + JcrConstants.JCR_CONTENT);
      return request.getResourceResolver().getResource(path);
    }
    return null;
  }
293438
@Override
    public Map<String, Object> getParameters(
            HttpServletRequest request, HttpServletResponse response) {
        final LocaleManager localeManager = this.getLocaleManager(request);

        final List<Locale> locales = localeManager.getLocales();
        if (locales != null && locales.size() > 0 && locales.get(0) != null) {
            final String locale = locales.get(0).toString();
            final String xslLocale = locale.replace('_', '-');
            this.logger.debug("Setting USER_LANG to {}", xslLocale);
            return Collections.singletonMap("USER_LANG", (Object) xslLocale);
        }

        return null;
    }