public String getPathPrefix() { return getUrlSnippet(); }
public Long getLastModified() { if ( checkConnection() ) { return urlConnection.getLastModified(); } return null; }
protected ZipFile getZipFile() throws IOException { return getZipFile( getClass() ); }
buf.append( " * Content type \"" ).append( resource.getContentType() ); buf.append( "\", to be published at path \"" ).append( resource.getPath() ).append( "\"" ).append( LS );
try zip = getZipFile(); String path = "/" + getPluginId() + "/" + getUrlSnippet() + name; resources.add( new DefaultStaticResource( url, path, mimeSupport.guessMimeTypeFromPath( name ) ) ); logger.trace( "Discovered documentation for: {}", getPluginId() ); for ( StaticResource resource : resources ) logger.debug( "No documentation discovered for: {}", getPluginId() ); logger.error( "Error discovering plugin documentation {}", getPluginId(), e );
public StaticResourceRepresentation( StaticResource resource ) { super( MediaType.valueOf( resource.getContentType() ) ); setSize( resource.getSize() ); setModificationDate( new Date( resource.getLastModified() ) ); setAvailable( true ); this.resource = resource; }
@Override public List<StaticResource> getContributedResouces() { List<StaticResource> result = new ArrayList<StaticResource>(); result.add(new DefaultStaticResource( getClass().getResource("/static/js/nexus-artifact-usage-plugin-all.js"), "/js/repoServer/nexus-artifact-usage-plugin-all.js", "application/x-javascript")); result.add(new DefaultStaticResource( getClass().getResource("/static/icons/jar-jar.png"), "/icons/repoServer/jar-jar.png", "image/png")); return result; } }
String preHeadTemplate = bundle.getPreHeadContribution( pluginContext ); String postHeadTemplate = bundle.getPostHeadContribution( pluginContext ); String preBodyTemplate = bundle.getPreBodyContribution( pluginContext ); String postBodyTemplate = bundle.getPostBodyContribution( pluginContext );
List<StaticResource> resources = bundle.getContributedResouces(); attach( root, false, resource.getPath(), new StaticResourceFinder( getContext(), resource ) );
public StaticResourceResource( Context ctx, Request req, Response rsp, StaticResource resource ) { super( ctx, req, rsp ); setVariants( Collections.singletonList( new Variant( MediaType.valueOf( resource.getContentType() ) ) ) ); this.resource = resource; }
@Override public void write( OutputStream outputStream ) throws IOException { InputStream is = null; try { is = resource.getInputStream(); IOUtil.copy( is, outputStream ); } finally { IOUtil.close( is ); } }
buf.append( " * Content type \"" ).append( resource.getContentType() ); buf.append( "\", to be published at path \"" ).append( resource.getPath() ).append( "\"" ).append( LS );
private StaticResource newStaticResource( String path ) { return new DefaultStaticResource( getClass().getResource( "/static" + path ), path, this.mimeUtil.getMimeType( path ) ); }
public long getSize() { if ( checkConnection() ) { return urlConnection.getContentLength(); } else { return -1; } }
public String getContentType() { if ( contentType != null ) { return contentType; } else if ( checkConnection() ) { return urlConnection.getContentType(); } else { return null; } }
public InputStream getInputStream() throws IOException { if ( checkConnection() ) { InputStream is = urlConnection.getInputStream(); urlConnection = null; return is; } else { throw new IOException( "Invalid resource!" ); } }