org.eclipse.jetty.webapp.WebAppContext.getTempDirectory()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(11.4k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中org.eclipse.jetty.webapp.WebAppContext.getTempDirectory()方法的一些代码示例,展示了WebAppContext.getTempDirectory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebAppContext.getTempDirectory()方法的具体详情如下:
包路径:org.eclipse.jetty.webapp.WebAppContext
类名称:WebAppContext
方法名:getTempDirectory

WebAppContext.getTempDirectory介绍

暂无

代码示例

代码示例来源:origin: apache/nifi

private File getWebApiDocsDir() {
  // load the rest documentation
  final File webApiDocsDir = new File(webApiContext.getTempDirectory(), "webapp/docs");
  if (!webApiDocsDir.exists()) {
    final boolean made = webApiDocsDir.mkdirs();
    if (!made) {
      logger.error("Failed to create " + webApiDocsDir.getAbsolutePath());
      startUpFailure(new IOException(webApiDocsDir.getAbsolutePath() + " could not be created"));
    }
  }
  return webApiDocsDir;
}

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

/**
 * @see org.eclipse.jetty.webapp.AbstractConfiguration#cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext)
 */
@Override
public void cloneConfigure(WebAppContext template, WebAppContext context) throws Exception
{
  File tmpDir=File.createTempFile(WebInfConfiguration.getCanonicalNameForWebAppTmpDir(context),"",template.getTempDirectory().getParentFile());
  if (tmpDir.exists())
  {
    IO.delete(tmpDir);
  }
  tmpDir.mkdir();
  tmpDir.deleteOnExit();
  context.setTempDirectory(tmpDir);
}

代码示例来源:origin: igniterealtime/Openfire

@Override
  public void run()
  {
    final FileTime now = FileTime.fromMillis( System.currentTimeMillis() );
    for ( final Handler handler : this.server.getChildHandlersByClass( WebAppContext.class ) )
    {
      final File tempDirectory = ((WebAppContext) handler).getTempDirectory();
      try
      {
        Log.debug( "Updating the last modified timestamp of content in Jetty's temporary storage in: {}", tempDirectory);
        Files.walk( tempDirectory.toPath() )
          .forEach( f -> {
            try
            {
              Log.trace( "Setting the last modified timestamp of file '{}' in Jetty's temporary storage to: {}", f, now);
              Files.setLastModifiedTime( f, now );
            }
            catch ( IOException e )
            {
              Log.warn( "An exception occurred while trying to update the last modified timestamp of content in Jetty's temporary storage in: {}", f, e );
            }
          } );
      }
      catch ( IOException e )
      {
        Log.warn( "An exception occurred while trying to update the last modified timestamp of content in Jetty's temporary storage in: {}", tempDirectory, e );
      }
    }
  }
}

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

File tmpDir = context.getTempDirectory();
if (tmpDir != null)

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

extractedWebAppDir= new File(context.getTempDirectory(), "webapp");
    File extractionLock = new File (context.getTempDirectory(), ".extract_lock");
File extractedWebInfDir= new File(context.getTempDirectory(), "webinf");
if (extractedWebInfDir.exists())
  IO.delete(extractedWebInfDir);

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

@Override
public void deconfigure(WebAppContext context) throws Exception
{
  //if we're not persisting the temp dir contents delete it
  if (!context.isPersistTempDirectory())
  {
    IO.delete(context.getTempDirectory());
  }
  
  //if it wasn't explicitly configured by the user, then unset it
  Boolean tmpdirConfigured = (Boolean)context.getAttribute(TEMPDIR_CONFIGURED);
  if (tmpdirConfigured != null && !tmpdirConfigured) 
    context.setTempDirectory(null);
  //reset the base resource back to what it was before we did any unpacking of resources
  if (context.getBaseResource() != null)
    context.getBaseResource().close();
  context.setBaseResource(_preUnpackBaseResource);
}

代码示例来源:origin: works.lmz.common/common-runnable-war

protected void createContextTempDirectory() {
  if (context.getTempDirectory() == null) {
    File tmpDir = new File(System.getProperty("java.io.tmpdir"));
    tmpDir.mkdirs();
    context.setTempDirectory(tmpDir);
  }
}

代码示例来源:origin: cd.connect.common/connect-runnable-war

protected void createContextTempDirectory() {
  if (context.getTempDirectory() == null) {
    File tmpDir = new File(System.getProperty("java.io.tmpdir"));
    tmpDir.mkdirs();
    context.setTempDirectory(tmpDir);
  }
}

代码示例来源:origin: jetty-project/i-jetty

public void init ()
throws IOException
{
  if (_path==null || "".equals(_path.trim()))
    _delegate = new DexClassLoader("", ((WebAppContext)getContext()).getTempDirectory().getCanonicalPath(),null,_parent);
  else
    _delegate = new DexClassLoader(_path, ((WebAppContext)getContext()).getTempDirectory().getCanonicalPath(), null, _parent);
  
  if (Log.isDebugEnabled()) Log.debug("Android webapp classloader path= "+_path+" tmpdir="+ ((WebAppContext)getContext()).getTempDirectory()+" dexloader = "+_delegate+" parentloader="+_parent);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

/**
 * @see org.eclipse.jetty.webapp.AbstractConfiguration#cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext)
 */
@Override
public void cloneConfigure(WebAppContext template, WebAppContext context) throws Exception
{
  File tmpDir=File.createTempFile(WebInfConfiguration.getCanonicalNameForWebAppTmpDir(context),"",template.getTempDirectory().getParentFile());
  if (tmpDir.exists())
  {
    IO.delete(tmpDir);
  }
  tmpDir.mkdir();
  tmpDir.deleteOnExit();
  context.setTempDirectory(tmpDir);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

/**
 * @see org.eclipse.jetty.webapp.AbstractConfiguration#cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext)
 */
@Override
public void cloneConfigure(WebAppContext template, WebAppContext context) throws Exception
{
  File tmpDir=File.createTempFile(WebInfConfiguration.getCanonicalNameForWebAppTmpDir(context),"",template.getTempDirectory().getParentFile());
  if (tmpDir.exists())
  {
    IO.delete(tmpDir);
  }
  tmpDir.mkdir();
  tmpDir.deleteOnExit();
  context.setTempDirectory(tmpDir);
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

/**
 * @see org.eclipse.jetty.webapp.AbstractConfiguration#cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext)
 */
@Override
public void cloneConfigure(WebAppContext template, WebAppContext context) throws Exception
{
  File tmpDir=File.createTempFile(WebInfConfiguration.getCanonicalNameForWebAppTmpDir(context),"",template.getTempDirectory().getParentFile());
  if (tmpDir.exists())
  {
    IO.delete(tmpDir);
  }
  tmpDir.mkdir();
  tmpDir.deleteOnExit();
  context.setTempDirectory(tmpDir);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

/**
 * @see org.eclipse.jetty.webapp.AbstractConfiguration#cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext)
 */
@Override
public void cloneConfigure(WebAppContext template, WebAppContext context) throws Exception
{
  File tmpDir=File.createTempFile(WebInfConfiguration.getCanonicalNameForWebAppTmpDir(context),"",template.getTempDirectory().getParentFile());
  if (tmpDir.exists())
  {
    IO.delete(tmpDir);
  }
  tmpDir.mkdir();
  tmpDir.deleteOnExit();
  context.setTempDirectory(tmpDir);
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

/**
 * @see org.eclipse.jetty.webapp.AbstractConfiguration#cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext)
 */
@Override
public void cloneConfigure(WebAppContext template, WebAppContext context) throws Exception
{
  File tmpDir=File.createTempFile(WebInfConfiguration.getCanonicalNameForWebAppTmpDir(context),"",template.getTempDirectory().getParentFile());
  if (tmpDir.exists())
  {
    IO.delete(tmpDir);
  }
  tmpDir.mkdir();
  tmpDir.deleteOnExit();
  context.setTempDirectory(tmpDir);
}

代码示例来源:origin: jenkinsci/winstone

/**
 * @see org.eclipse.jetty.webapp.AbstractConfiguration#cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext)
 */
@Override
public void cloneConfigure(WebAppContext template, WebAppContext context) throws Exception
{
  File tmpDir=File.createTempFile(WebInfConfiguration.getCanonicalNameForWebAppTmpDir(context),"",template.getTempDirectory().getParentFile());
  if (tmpDir.exists())
  {
    IO.delete(tmpDir);
  }
  tmpDir.mkdir();
  tmpDir.deleteOnExit();
  context.setTempDirectory(tmpDir);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

@Override
public void deconfigure(WebAppContext context) throws Exception
{
  // delete temp directory if we had to create it or if it isn't called work
  Boolean tmpdirConfigured = (Boolean)context.getAttribute(TEMPDIR_CONFIGURED);
  
  if (context.getTempDirectory()!=null && (tmpdirConfigured == null || !tmpdirConfigured.booleanValue()) && !isTempWorkDirectory(context.getTempDirectory()))
  {
    IO.delete(context.getTempDirectory());
    context.setTempDirectory(null);
    
    //clear out the context attributes for the tmp dir only if we had to
    //create the tmp dir
    context.setAttribute(TEMPDIR_CONFIGURED, null);
    context.setAttribute(WebAppContext.TEMPDIR, null);
  }
  
  //reset the base resource back to what it was before we did any unpacking of resources
  context.setBaseResource(_preUnpackBaseResource);
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

@Override
public void deconfigure(WebAppContext context) throws Exception
{
  // delete temp directory if we had to create it or if it isn't called work
  Boolean tmpdirConfigured = (Boolean)context.getAttribute(TEMPDIR_CONFIGURED);
  if (context.getTempDirectory()!=null && (tmpdirConfigured == null || !tmpdirConfigured.booleanValue()) && !isTempWorkDirectory(context.getTempDirectory()))
  {
    IO.delete(context.getTempDirectory());
    context.setTempDirectory(null);
    //clear out the context attributes for the tmp dir only if we had to
    //create the tmp dir
    context.setAttribute(TEMPDIR_CONFIGURED, null);
    context.setAttribute(WebAppContext.TEMPDIR, null);
  }
  //reset the base resource back to what it was before we did any unpacking of resources
  context.setBaseResource(_preUnpackBaseResource);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

@Override
public void deconfigure(WebAppContext context) throws Exception
{
  // delete temp directory if we had to create it or if it isn't called work
  Boolean tmpdirConfigured = (Boolean)context.getAttribute(TEMPDIR_CONFIGURED);
  
  if (context.getTempDirectory()!=null && (tmpdirConfigured == null || !tmpdirConfigured.booleanValue()) && !isTempWorkDirectory(context.getTempDirectory()))
  {
    IO.delete(context.getTempDirectory());
    context.setTempDirectory(null);
    
    //clear out the context attributes for the tmp dir only if we had to
    //create the tmp dir
    context.setAttribute(TEMPDIR_CONFIGURED, null);
    context.setAttribute(WebAppContext.TEMPDIR, null);
  }
  
  //reset the base resource back to what it was before we did any unpacking of resources
  context.setBaseResource(_preUnpackBaseResource);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

@Override
public void deconfigure(WebAppContext context) throws Exception
{
  // delete temp directory if we had to create it or if it isn't called work
  Boolean tmpdirConfigured = (Boolean)context.getAttribute(TEMPDIR_CONFIGURED);
  
  if (context.getTempDirectory()!=null && (tmpdirConfigured == null || !tmpdirConfigured.booleanValue()) && !isTempWorkDirectory(context.getTempDirectory()))
  {
    IO.delete(context.getTempDirectory());
    context.setTempDirectory(null);
    
    //clear out the context attributes for the tmp dir only if we had to
    //create the tmp dir
    context.setAttribute(TEMPDIR_CONFIGURED, null);
    context.setAttribute(WebAppContext.TEMPDIR, null);
  }
  
  //reset the base resource back to what it was before we did any unpacking of resources
  context.setBaseResource(_preUnpackBaseResource);
}

代码示例来源:origin: jenkinsci/winstone

@Override
public void deconfigure(WebAppContext context) throws Exception
{
  //if we're not persisting the temp dir contents delete it
  if (!context.isPersistTempDirectory())
  {
    IO.delete(context.getTempDirectory());
  }
  
  //if it wasn't explicitly configured by the user, then unset it
  Boolean tmpdirConfigured = (Boolean)context.getAttribute(TEMPDIR_CONFIGURED);
  if (tmpdirConfigured != null && !tmpdirConfigured) 
    context.setTempDirectory(null);
  //reset the base resource back to what it was before we did any unpacking of resources
  if (context.getBaseResource() != null)
    context.getBaseResource().close();
  context.setBaseResource(_preUnpackBaseResource);
}

相关文章

微信公众号

最新文章

更多

WebAppContext类方法