mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-13 12:02:20 +00:00
rolled back rev.28991 until stapler is ready
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@29004 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
a0e9b05f78
commit
6dfd41e825
7 files changed
+3
-97
No files matched your search
@@ -4,9 +4,6 @@ import hudson.Extension;
|
||||
import hudson.util.ListBoxModel;
|
||||
import org.kohsuke.stapler.QueryParameter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,14 +5,6 @@ import hudson.ExtensionPoint;
|
||||
import hudson.model.Action;
|
||||
import hudson.model.Describable;
|
||||
import hudson.model.Hudson;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.apache.commons.io.IOUtils.copy;
|
||||
|
||||
/**
|
||||
* @author Kohsuke Kawaguchi
|
||||
@@ -33,23 +25,6 @@ public abstract class UISample implements ExtensionPoint, Action, Describable<UI
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Source files associated with this sample.
|
||||
*/
|
||||
public List<SourceFile> getSourceFiles() {
|
||||
return Arrays.asList(new SourceFile(getClass().getSimpleName()+".java"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds {@link SourceFile}s into URL.
|
||||
*/
|
||||
public SourceFile getSourceFile(String name) {
|
||||
for (SourceFile sf : getSourceFiles())
|
||||
if (sf.name.equals(name))
|
||||
return sf;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a paragraph of natural text that describes this sample.
|
||||
* Interpreted as HTML.
|
||||
@@ -67,27 +42,4 @@ public abstract class UISample implements ExtensionPoint, Action, Describable<UI
|
||||
return Hudson.getInstance().getExtensionList(UISample.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class SourceFile {
|
||||
public final String name;
|
||||
|
||||
public SourceFile(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public URL resolve() {
|
||||
return UISample.this.getClass().getResource(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serves this source file.
|
||||
*/
|
||||
public void doIndex(StaplerResponse rsp) throws IOException {
|
||||
rsp.setContentType("text/plain;charset=UTF-8");
|
||||
copy(resolve().openStream(),rsp.getOutputStream());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user