Codota Logo
Resource.getPath
Code IndexAdd Codota to your IDE (free)

How to use
getPath
method
in
com.google.gwt.dev.resource.Resource

Best Java code snippets using com.google.gwt.dev.resource.Resource.getPath (Showing top 17 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: playn/playn

private static String getContentType(TreeLogger logger, Resource resource) {
 String name = resource.getPath().toLowerCase();
 int pos = name.lastIndexOf('.');
 String extension = pos == -1 ? "" : name.substring(pos);
 String contentType = EXTENSION_MAP.get(extension);
 if (contentType == null) {
  logger.log(
    TreeLogger.WARN,
    "No Content Type mapping for files with '" + extension
      + "' extension. Please add a mapping to the "
      + AutoClientBundleGenerator.class.getCanonicalName() + " class.");
  contentType = "application/octet-stream";
 }
 return contentType;
}
origin: threerings/playn

private static String getContentType(TreeLogger logger, Resource resource) {
 String name = resource.getPath().toLowerCase();
 int pos = name.lastIndexOf('.');
 String extension = pos == -1 ? "" : name.substring(pos);
 String contentType = EXTENSION_MAP.get(extension);
 if (contentType == null) {
  logger.log(
    TreeLogger.WARN,
    "No Content Type mapping for files with '" + extension
      + "' extension. Please add a mapping to the "
      + AutoClientBundleGenerator.class.getCanonicalName() + " class.");
  contentType = "application/octet-stream";
 }
 return contentType;
}
origin: io.playn/playn-html

private static String getContentType(TreeLogger logger, Resource resource) {
 String name = resource.getPath().toLowerCase();
 int pos = name.lastIndexOf('.');
 String extension = pos == -1 ? "" : name.substring(pos);
 String contentType = EXTENSION_MAP.get(extension);
 if (contentType == null) {
  logger.log(
    TreeLogger.WARN,
    "No Content Type mapping for files with '" + extension
      + "' extension. Please add a mapping to the "
      + AutoClientBundleGenerator.class.getCanonicalName() + " class.");
  contentType = "application/octet-stream";
 }
 return contentType;
}
origin: io.playn/playn-html

/**
 * Filter file set, preferring *.mp3 files where alternatives exist.
 */
private HashSet<Resource> preferMp3(HashSet<Resource> files) {
 HashMap<String, Resource> map = new HashMap<String, Resource>();
 for (Resource file : files) {
  String path = stripExtension(file.getPath());
  if (file.getPath().endsWith(".mp3") || !map.containsKey(path)) {
   map.put(path, file);
  }
 }
 return new HashSet<Resource>(map.values());
}
origin: threerings/playn

/**
 * Filter file set, preferring *.mp3 files where alternatives exist.
 */
private HashSet<Resource> preferMp3(HashSet<Resource> files) {
 HashMap<String, Resource> map = new HashMap<String, Resource>();
 for (Resource file : files) {
  String path = stripExtension(file.getPath());
  if (file.getPath().endsWith(".mp3") || !map.containsKey(path)) {
   map.put(path, file);
  }
 }
 return new HashSet<Resource>(map.values());
}
origin: playn/playn

/**
 * Filter file set, preferring *.mp3 files where alternatives exist.
 */
private HashSet<Resource> preferMp3(HashSet<Resource> files) {
 HashMap<String, Resource> map = new HashMap<String, Resource>();
 for (Resource file : files) {
  String path = stripExtension(file.getPath());
  if (file.getPath().endsWith(".mp3") || !map.containsKey(path)) {
   map.put(path, file);
  }
 }
 return new HashSet<Resource>(map.values());
}
origin: fr.putnami.pwt/pwt

private Resource getTemplateResource(GeneratorContext context) {
  String packageResourcePath = this.targetType.getPackage().getName().replace('.', '/') + "/";
  ResourceOracle resourceOracle = context.getResourcesOracle();
  Map<String, Resource> reourceMap = new HashMap<>();
  for (Resource resource : resourceOracle.getResources()) {
    reourceMap.put(resource.getPath(), resource);
  }
  String templatePath =
    packageResourcePath + this.templateName + "_" + this.locale + UiBinderLocalizedCreator.TEMPLATE_SUFFIX;
  Resource templateResource = reourceMap.get(templatePath);
  if (templateResource == null) {
    this.locale = null;
    templatePath = packageResourcePath + this.templateName + UiBinderLocalizedCreator.TEMPLATE_SUFFIX;
    templateResource = reourceMap.get(templatePath);
  }
  if (templateResource != null) {
    this.templateName = templatePath.replace(packageResourcePath, "");
  }
  return templateResource;
}
origin: Putnami/putnami-web-toolkit

private Resource getTemplateResource(GeneratorContext context) {
  String packageResourcePath = this.targetType.getPackage().getName().replace('.', '/') + "/";
  ResourceOracle resourceOracle = context.getResourcesOracle();
  Map<String, Resource> reourceMap = new HashMap<>();
  for (Resource resource : resourceOracle.getResources()) {
    reourceMap.put(resource.getPath(), resource);
  }
  String templatePath =
    packageResourcePath + this.templateName + "_" + this.locale + UiBinderLocalizedCreator.TEMPLATE_SUFFIX;
  Resource templateResource = reourceMap.get(templatePath);
  if (templateResource == null) {
    this.locale = null;
    templatePath = packageResourcePath + this.templateName + UiBinderLocalizedCreator.TEMPLATE_SUFFIX;
    templateResource = reourceMap.get(templatePath);
  }
  if (templateResource != null) {
    this.templateName = templatePath.replace(packageResourcePath, "");
  }
  return templateResource;
}
origin: seanchenxi/gwt-storage

private StorageSerialization parseXmlResource(Resource resource) throws UnableToCompleteException {
 InputStream input = null;
 try{
  JAXBContext jaxbContext = JAXBContext.newInstance(StorageSerialization.class);
  Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
  Source source = createSAXSource(input = resource.openContents());
  StorageSerialization storageSerialization = (StorageSerialization)unmarshaller.unmarshal(source);
  storageSerialization.setPath(resource.getPath());
  return storageSerialization;
 }catch(Exception e){
  logger.branch(TreeLogger.Type.WARN, "Error while parsing xml resource at " + resource.getPath(), e);
  throw new UnableToCompleteException();
 } finally{
  try{
   if(input != null) input.close();
  }catch(Exception e){
   //To ignore
  }
 }
}
origin: com.vaadin.external.gwt/gwt-user

@Override
public InputSource resolveEntity(String publicId, String systemId) {
 String matchingPrefix = findMatchingPrefix(systemId);
 Resource resource = null;
 if (matchingPrefix != null) {
  resource =
    resourceOracle.getResource(RESOURCES + systemId.substring(matchingPrefix.length()));
 }
 if (resource == null) {
  resource = resourceOracle.getResource(pathBase + systemId);
 }
 if (resource != null) {
  String content;
  try {
   InputStream resourceStream = resource.openContents();
   content = Util.readStreamAsString(resourceStream);
  } catch (IOException ex) {
   logger.log(TreeLogger.ERROR, "Error reading resource: " + resource.getLocation());
   throw new RuntimeException(ex);
  }
  InputSource inputSource = new InputSource(new StringReader(content));
  inputSource.setPublicId(publicId);
  inputSource.setSystemId(resource.getPath());
  return inputSource;
 }
 /*
  * Let Sax find it on the interweb.
  */
 return null;
}
origin: net.wetheinter/gwt-user

@Override
public InputSource resolveEntity(String publicId, String systemId) {
 String matchingPrefix = findMatchingPrefix(systemId);
 Resource resource = null;
 if (matchingPrefix != null) {
  resource =
    resourceOracle.getResource(RESOURCES + systemId.substring(matchingPrefix.length()));
 }
 if (resource == null) {
  resource = resourceOracle.getResource(pathBase + systemId);
 }
 if (resource != null) {
  String content;
  try {
   InputStream resourceStream = resource.openContents();
   content = Util.readStreamAsString(resourceStream);
  } catch (IOException ex) {
   logger.log(TreeLogger.ERROR, "Error reading resource: " + resource.getLocation());
   throw new RuntimeException(ex);
  }
  InputSource inputSource = new InputSource(new StringReader(content));
  inputSource.setPublicId(publicId);
  inputSource.setSystemId(resource.getPath());
  return inputSource;
 }
 /*
  * Let Sax find it on the interweb.
  */
 return null;
}
origin: com.jhickman/gwt-customuibinder

private Document getW3cDoc(MortalLogger logger, DesignTimeUtils designTime,
  ResourceOracle resourceOracle, String templatePath)
  throws UnableToCompleteException {
 Resource resource = resourceOracle.getResourceMap().get(templatePath);
 if (null == resource) {
  logger.die("Unable to find resource: " + templatePath);
 }
 Document doc = null;
 try {
  String content = designTime.getTemplateContent(templatePath);
  if (content == null) {
   content = Util.readStreamAsString(resource.openContents());
  }
  doc = new W3cDomHelper(logger.getTreeLogger(), resourceOracle).documentFor(
    content, resource.getPath());
 } catch (SAXParseException e) {
  logger.die(
    "Error parsing XML (line " + e.getLineNumber() + "): "
      + e.getMessage(), e);
 }
 return doc;
}
origin: com.vaadin.external.gwt/gwt-user

private Document getW3cDoc(MortalLogger logger, DesignTimeUtils designTime,
  ResourceOracle resourceOracle, String templatePath, Resource resource)
  throws UnableToCompleteException {
 Document doc = null;
 try {
  String content = designTime.getTemplateContent(templatePath);
  if (content == null) {
   content = Util.readStreamAsString(resource.openContents());
  }
  doc = new W3cDomHelper(logger.getTreeLogger(), resourceOracle).documentFor(
    content, resource.getPath());
 } catch (IOException iex) {
  logger.die("Error opening resource:" + resource.getLocation(), iex);
 } catch (SAXParseException e) {
  logger.die(
    "Error parsing XML (line " + e.getLineNumber() + "): "
      + e.getMessage(), e);
 }
 return doc;
}
origin: net.wetheinter/gwt-user

private Document getW3cDoc(MortalLogger logger, DesignTimeUtils designTime,
  ResourceOracle resourceOracle, String templatePath, Resource resource)
  throws UnableToCompleteException {
 Document doc = null;
 try {
  String content = designTime.getTemplateContent(templatePath);
  if (content == null) {
   content = Util.readStreamAsString(resource.openContents());
  }
  doc = new W3cDomHelper(logger.getTreeLogger(), resourceOracle).documentFor(
    content, resource.getPath());
 } catch (IOException iex) {
  logger.die("Error opening resource:" + resource.getLocation(), iex);
 } catch (SAXParseException e) {
  logger.die(
    "Error parsing XML (line " + e.getLineNumber() + "): "
      + e.getMessage(), e);
 }
 return doc;
}
origin: io.playn/playn-html

String relativePath = resource.getPath();
String filename = resource.getPath().substring(resource.getPath().lastIndexOf('/') + 1);
String contentType = getContentType(logger, resource);
String methodName = stripExtension(filename);
origin: playn/playn

String relativePath = resource.getPath();
String filename = resource.getPath().substring(resource.getPath().lastIndexOf('/') + 1);
String contentType = getContentType(logger, resource);
String methodName = stripExtension(filename);
origin: threerings/playn

String relativePath = resource.getPath();
String filename = resource.getPath().substring(resource.getPath().lastIndexOf('/') + 1);
String contentType = getContentType(logger, resource);
String methodName = stripExtension(filename);
com.google.gwt.dev.resourceResourcegetPath

Popular methods of Resource

  • openContents
  • getLastModified
  • getLocation

Popular in Java

  • Reading from database using SQL prepared statement
  • startActivity (Activity)
  • onRequestPermissionsResult (Fragment)
  • notifyDataSetChanged (ArrayAdapter)
  • ObjectMapper (com.fasterxml.jackson.databind)
    This mapper (or, data binder, or codec) provides functionality for converting between Java objects (
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Kernel (java.awt.image)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now