the content resource type (sling:resourceType) declared for the current resource
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;
    }
779232
public void selectResource(String resourcePath, CmsUUID structureId, String title, String resourceType) {

        String provider = getProviderName(resourceType);
        if (provider == null) {
            // use {@link org.opencms.ade.galleries.client.preview.CmsBinaryPreviewProvider} as default to select a resource
            provider = I_CmsBinaryPreviewProvider.PREVIEW_NAME;
        }
        if (m_previewFactoryRegistration.containsKey(provider)) {
            m_previewFactoryRegistration.get(provider).getPreview(m_handler.m_galleryDialog).selectResource(
                resourcePath,
                structureId,
                title);

        } else {
            CmsDebugLog.getInstance().printLine("No provider available");
        }
    }
763818
private static MimeType getContentMimeType(Resource resource) {
        MimeType result = null;
        if (resource != null && (resource = resource.getChild(ResourceUtil.CONTENT_NODE)) != null) {
            ResourceHandle handle = ResourceHandle.use(resource);
            result = getMimeType(handle.getProperty(ResourceUtil.PROP_MIME_TYPE, ""));
        }
        return result;
    }
760149
public static Resource resolveUrl(SlingHttpServletRequest request, String url) {
        return request.getResourceResolver().getResource(url);
    }
595305
def load_collection_from_stream(resource, stream, content_type):
    
    coll = create_staging_collection(resource)
    load_into_collection_from_stream(coll, stream, content_type)
    return coll
422971
public void getNewElement(final String resourceType, final I_CmsSimpleCallback<CmsContainerElementData> callback) {

        CmsRpcAction<CmsContainerElementData> action = new CmsRpcAction<CmsContainerElementData>() {

            @Override
            public void execute() {

                getContainerpageService().getNewElementData(
                    getData().getRpcContext(),
                    getData().getDetailId(),
                    getRequestParams(),
                    resourceType,
                    getPageState(),
                    getLocale(),
                    this);
            }

            @Override
            protected void onResponse(CmsContainerElementData result) {

                m_elements.put(result.getClientId(), result);
                callback.execute(result);
            }
        };
        action.execute();
    }
1009068
public static IResourceStream getResourceStream(final WebApplication application,
		final String path, final String contentType) throws IOException
	{
		return new ByteArrayResourceStreamWriter()
		{
			private static final long serialVersionUID = 1L;

			@Override
			public String getContentType()
			{
				return contentType;
			}

			@Override
			protected byte[] load() throws IOException
			{
				final String realPath = ApplicationExtensions.getRealPath(application, path);
				final File file = new File(realPath);
				final byte[] data = Files.readBytes(file);
				return data;
			}
		};
	}
789432
public static @Nullable Resource getContentResource(@NotNull HttpServletRequest request) {

    String contentPath = getContentPath(request);

    if (StringUtils.isNotEmpty(contentPath)) {
      SlingHttpServletRequest slingRequest = (SlingHttpServletRequest)request;
      return slingRequest.getResourceResolver().getResource(contentPath);
    }
    return null;
  }
1060680
private void checkResourceURI(String resourceURI, String relName)
            throws SAXException {

        URI uri;
        try {
            uri = new URI(resourceURI);
        } catch (Exception e) {
            throw new SAXException("RelsExtValidator:"
                    + "Error in relationship '" + relName + "'."
                    + " The RDF 'resource' is not a valid URI.");
        }

        if (!uri.isAbsolute()) {
            throw new SAXException("RelsValidator:" + "Error in relationship '"
                    + relName + "'."
                    + " The specified RDF 'resource' is not an absolute URI.");
        }
    }
469501
def update_resource(uri, r, content_type)
      clear
      uri = URI.parse(uri)
      @req = Net::HTTP::Put.new uri.request_uri
      @req['Content-Type'] = content_type
      cache = @cache.get(uri.to_s)
      unless cache.nil?
        @req['If-Not-Modified-Since'] = cache.last_modofied unless cache.last_modified.nil?
        @req['If-Match'] = cache.etag unless cache.etag.nil?
      end
      set_common_info(@req)
      @req.body = r
      @http_class.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
        @res = http.request(@req)
        case @res
          when Net::HTTPSuccess
            #warn "Bad Status Code: #{@res.code}" unless @res.class == Net::HTTPOK || @res.class == Net::HTTPNoContent
            unless @res.body.nil?
              @rc = Atom::MediaType::ENTRY.is_a?(@res['Content-Type']) ? Atom::Entry.new(:stream => @res.body) : @res.body
              @cache.put uri.to_s, {
                :rc            => @rc,
                :etag          => @res['ETag'],
                :last_modified => @res['Last-Modified'] }
            end
          else
            raise RequestError, "Failed to update resource. #{@res.code}"
        end
      end
    end
1049033
private String getContentType(HttpServletRequest pRequest) {
        if (responseMessageTypes != null) {
            String accept = pRequest.getHeader("Accept");

            for (String type : responseMessageTypes) {
                // Note: This is not 100% correct way of doing content negotiation
                // But we just want a compatible result, quick, so this is okay
                if (StringUtil.contains(accept, type)) {
                    return type;
                }
            }
        }

        // If none found, return default
        return DEFAULT_TYPE;
    }
310873
function addContentType(req) {
    var httpRequest = req.httpRequest;
    if (httpRequest.method === 'GET' || httpRequest.method === 'HEAD') {
      // Content-Type is not set in GET/HEAD requests
      delete httpRequest.headers['Content-Type'];
      return;
    }

    if (!httpRequest.headers['Content-Type']) { // always have a Content-Type
      httpRequest.headers['Content-Type'] = 'application/octet-stream';
    }

    var contentType = httpRequest.headers['Content-Type'];
    if (AWS.util.isBrowser()) {
      if (typeof httpRequest.body === 'string' && !contentType.match(/;\s*charset=/)) {
        var charset = '; charset=UTF-8';
        httpRequest.headers['Content-Type'] += charset;
      } else {
        var replaceFn = function(_, prefix, charsetName) {
          return prefix + charsetName.toUpperCase();
        };

        httpRequest.headers['Content-Type'] =
          contentType.replace(/(;\s*charset=)(.+)$/, replaceFn);
      }
    }
  }
49337
def add_resource_attrs_from_type(type_id, resource_type, resource_id,**kwargs):
    
    type_i = _get_templatetype(type_id)

    resource_i = _get_resource(resource_type, resource_id)

    resourceattr_qry = db.DBSession.query(ResourceAttr).filter(ResourceAttr.ref_key==resource_type)

    if resource_type == 'NETWORK':
        resourceattr_qry.filter(ResourceAttr.network_id==resource_id)
    elif resource_type == 'NODE':
        resourceattr_qry.filter(ResourceAttr.node_id==resource_id)
    elif resource_type == 'LINK':
        resourceattr_qry.filter(ResourceAttr.link_id==resource_id)
    elif resource_type == 'GROUP':
        resourceattr_qry.filter(ResourceAttr.group_id==resource_id)
    elif resource_type == 'PROJECT':
        resourceattr_qry.filter(ResourceAttr.project_id==resource_id)

    resource_attrs = resourceattr_qry.all()

    attrs = {}
    for res_attr in resource_attrs:
        attrs[res_attr.attr_id] = res_attr

    new_resource_attrs = []
    for item in type_i.typeattrs:
        if attrs.get(item.attr_id) is None:
            ra = resource_i.add_attribute(item.attr_id)
            new_resource_attrs.append(ra)

    db.DBSession.flush()

    return new_resource_attrs
1189270
private void setResourceInformation() {

        String sitePath = m_cms.getSitePath(m_resource);
        int pathEnd = sitePath.lastIndexOf('/') + 1;
        String baseName = sitePath.substring(pathEnd);
        m_sitepath = sitePath.substring(0, pathEnd);
        switch (CmsMessageBundleEditorTypes.BundleType.toBundleType(
            OpenCms.getResourceManager().getResourceType(m_resource).getTypeName())) {
            case PROPERTY:
                String localeSuffix = CmsStringUtil.getLocaleSuffixForName(baseName);
                if ((null != localeSuffix) && !localeSuffix.isEmpty()) {
                    baseName = baseName.substring(
                        0,
                        baseName.lastIndexOf(localeSuffix) - (1 /* cut off trailing underscore, too*/));
                    m_locale = CmsLocaleManager.getLocale(localeSuffix);
                }
                if ((null == m_locale) || !m_locales.contains(m_locale)) {
                    m_switchedLocaleOnOpening = true;
                    m_locale = m_locales.iterator().next();
                }
                break;
            case XML:
                m_locale = OpenCms.getLocaleManager().getBestAvailableLocaleForXmlContent(
                    m_cms,
                    m_resource,
                    m_xmlBundle);
                break;
            case DESCRIPTOR:
                m_basename = baseName.substring(
                    0,
                    baseName.length() - CmsMessageBundleEditorTypes.Descriptor.POSTFIX.length());
                m_locale = new Locale("en");
                break;
            default:
                throw new IllegalArgumentException(
                    Messages.get().container(
                        Messages.ERR_UNSUPPORTED_BUNDLE_TYPE_1,
                        CmsMessageBundleEditorTypes.BundleType.toBundleType(
                            OpenCms.getResourceManager().getResourceType(m_resource).getTypeName())).toString());
        }
        m_basename = baseName;

    }
102253
public void setResourceAdaptorContext(ResourceAdaptorContext arg0) {
        resourceAdaptorContext = arg0;
        tracer = resourceAdaptorContext.getTracer(HttpClientNIOResourceAdaptor.class.getSimpleName());
        try {
            fireableEventType = resourceAdaptorContext.getEventLookupFacility().getFireableEventType(
                    HttpClientNIOEventTypes.HTTP_CLIENT_NIO_RESPONSE_EVENT_TYPE_ID);
        } catch (Throwable e) {
            throw new RuntimeException(e.getMessage(), e);
        }
        sbbInterface = new HttpClientNIOResourceAdaptorSbbInterfaceImpl(this);
    }
246279
def _generate_custom_type(self, resource_type):
        
        if not resource_type.startswith("Custom::"):
            raise TypeError("Custom types must start with Custom::")
        custom_type = type(
            str(resource_type.replace("::", "")),
            (self.inspect_resources['AWS::CloudFormation::CustomResource'],),
            {'resource_type': resource_type})
        self.inspect_members.add(custom_type)
        self.inspect_resources[resource_type] = custom_type
        return custom_type
1050397
def resolve_resource_type(self, resource_dict):
        
        if not self.can_resolve(resource_dict):
            raise TypeError("Resource dict has missing or invalid value for key Type. Event Type is: {}.".format(
                    resource_dict.get('Type')))
        if resource_dict['Type'] not in self.resource_types:
            raise TypeError("Invalid resource type {resource_type}".format(resource_type=resource_dict['Type']))
        return self.resource_types[resource_dict['Type']]