Tabnine Logo
ServletContextFactory
Code IndexAdd Tabnine to your IDE (free)

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

Best Java code snippets using com.atlassian.plugin.servlet.ServletContextFactory (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.servletServletContextFactory

Javadoc

A factory for providing access to a ServletContext.

Most used methods

  • getServletContext

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (Timer)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSharedPreferences (Context)
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Top Sublime Text plugins
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