congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
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

    • Creating JSON documents from java classes using gson
    • getSharedPreferences (Context)
    • scheduleAtFixedRate (ScheduledExecutorService)
    • onRequestPermissionsResult (Fragment)
    • Graphics2D (java.awt)
      This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
    • ConnectException (java.net)
      A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
    • URI (java.net)
      A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
    • Charset (java.nio.charset)
      A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
    • ResultSet (java.sql)
      An interface for an object which represents a database table entry, returned as the result of the qu
    • FileUtils (org.apache.commons.io)
      General file manipulation utilities. Facilities are provided in the following areas: * writing to a
    • Top 12 Jupyter Notebook extensions
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

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