congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
ServletContextFactory.getServletContext
Code IndexAdd Tabnine to your IDE (free)

How to use
getServletContext
method
in
com.atlassian.plugin.servlet.ServletContextFactory

Best Java code snippets using com.atlassian.plugin.servlet.ServletContextFactory.getServletContext (Showing top 8 results out of 315)

origin: com.atlassian.jira/jira-core

private static File populatedFrameworkBundles(final ServletContextFactory servletContextFactory)
{
  final ServletContext servletContext = servletContextFactory.getServletContext();
  final String osgiJarPath = servletContext.getRealPath(FRAMEWORK_BUNDLES_LOCATION);
  // JiraWebappStartupCheck ensures that getRealPath does not return null for /
  return new File(osgiJarPath);
}
origin: com.atlassian.plugins/less-transformer-plugin

@Override
public boolean exists(URI uri) {
  try {
    return servletContextFactory.getServletContext().getResource(uri.getPath()) != null;
  } catch (MalformedURLException e) {
    return false;
  }
}
origin: com.atlassian.plugins/less-transformer-plugin

@Override
public InputStream open(URI uri) throws IOException {
  InputStream is = servletContextFactory.getServletContext().getResourceAsStream(uri.getPath());
  if (is == null) {
    throw new IOException(uri.getPath() + " does not exist in the servletContext");
  }
  return is;
}
origin: com.atlassian.plugins/less-transformer-plugin

@Override
public String encodeState(URI uri) {
  URLConnection connection = null;
  try {
    URL url = servletContextFactory.getServletContext().getResource(uri.getPath());
    connection = url.openConnection();
    return String.valueOf(connection.getLastModified());
  } catch (IOException e) {
    throw new IllegalStateException(e);
  } finally {
    if (connection != null) {
      try {
        connection.getInputStream().close();
      } catch (IOException ignored) {
      }
    }
  }
}
origin: com.atlassian.web/atlassian-servlet-plugin

  /**
   * Updates client-side location considering:
   * <ul>
   * <li>the last forwarded location</li>
   * </ul>
   *
   * @param writer writes the response to the client
   * @since 2.0.0
   */
  @Override
  public void updateLocation(final Writer writer) {
    forwarder.consumeLastLocation(lastLocation -> {
      final ServletContext context = contextFactory.getServletContext();
      final String location = context.getContextPath() + lastLocation.toASCIIString();
      renderer.render(writer, SOY_RESOURCE, SOY_TEMPLATE, singletonMap("location", location));
    });
  }
}
origin: com.atlassian.jira/jira-core

String bundledPluginPath = servletContextFactory.getServletContext().getRealPath(BUNDLED_PLUGIN_LOCATION);
origin: com.atlassian.soy/soy-template-plugin

private URL getSoyResourceURL(ModuleDescriptor moduleDescriptor, ResourceDescriptor resource) {
  final String sourceParam = resource.getParameter("source");
  if ("webContextStatic".equalsIgnoreCase(sourceParam)) {
    try {
      return servletContextFactory.getServletContext().getResource(resource.getLocation());
    } catch (MalformedURLException e) {
      log.error("Ignoring soy resource. Could not locate soy with location: " + resource.getLocation());
      return null;
    }
  }
  return moduleDescriptor.getPlugin().getResource(resource.getLocation());
}
origin: com.atlassian.plugins/atlassian-plugins-webresource

/**
 * Returns stream for file with given location for given resource.
 */
public InputStream getStreamFor(Resource resource, String path) {
  if (resource instanceof ModuleResource) {
    return getPlugin(((ModuleResource) resource).getPluginKey()).getResourceAsStream(path);
  } else {
    ResourceLocation resourceLocation = resource.getResourceLocation();
    String sourceParam = resourceLocation.getParameter(SOURCE_PARAM_NAME);
    final boolean isWebContextStatic = "webContextStatic".equalsIgnoreCase(sourceParam);
    if (isWebContextStatic) {
      // Tomcat 8 requires resource path to start with the slash.
      String pathWithSlash = path.startsWith("/") ? path : "/" + path;
      return servletContextFactory.getServletContext().getResourceAsStream(pathWithSlash);
    } else {
      return getPlugin(resource.getKey()).getResourceAsStream(path);
    }
  }
}
com.atlassian.plugin.servletServletContextFactorygetServletContext

Popular methods of ServletContextFactory

    Popular in Java

    • Start an intent from android
    • requestLocationUpdates (LocationManager)
    • runOnUiThread (Activity)
    • getSupportFragmentManager (FragmentActivity)
    • SecureRandom (java.security)
      This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
    • MessageFormat (java.text)
      Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
    • List (java.util)
      An ordered collection (also known as a sequence). The user of this interface has precise control ove
    • Cipher (javax.crypto)
      This class provides access to implementations of cryptographic ciphers for encryption and decryption
    • XPath (javax.xml.xpath)
      XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
    • Reflections (org.reflections)
      Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
    • Top 12 Jupyter Notebook Extensions
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now