mirror of https://github.com/apache/archiva.git
[MRM-63]
- run file reading code privileged - do the applet tag convert thing git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@370755 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
abbfa168f4
commit
5db9f4bdb2
Binary file not shown.
|
@ -21,8 +21,11 @@ import java.applet.Applet;
|
|||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.AccessController;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* TODO: Description.
|
||||
|
@ -41,8 +44,14 @@ public class ChecksumApplet
|
|||
super.init();
|
||||
}
|
||||
|
||||
public String generateMd5( String file )
|
||||
public String generateMd5( final String file )
|
||||
throws IOException, NoSuchAlgorithmException
|
||||
{
|
||||
return (String) AccessController.doPrivileged( new PrivilegedAction()
|
||||
{
|
||||
public Object run()
|
||||
{
|
||||
try
|
||||
{
|
||||
MessageDigest digest = MessageDigest.getInstance( "MD5" );
|
||||
|
||||
|
@ -68,6 +77,17 @@ public class ChecksumApplet
|
|||
|
||||
return byteArrayToHexStr( digest.digest() );
|
||||
}
|
||||
catch ( NoSuchAlgorithmException e )
|
||||
{
|
||||
throw new RuntimeException( e );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new RuntimeException( e );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
private static String byteArrayToHexStr( byte[] data )
|
||||
{
|
||||
|
|
|
@ -30,10 +30,55 @@
|
|||
<input type="submit" value="Search"/>
|
||||
</form>
|
||||
|
||||
<applet name="ChecksumApplet" archive="maven-repository-artifact-applet.jar"
|
||||
width="1" height="1"
|
||||
code="org/apache/maven/repository/applet/ChecksumApplet.class">
|
||||
<!--"CONVERTED_APPLET"-->
|
||||
<!-- HTML CONVERTER -->
|
||||
<script language="JavaScript" type="text/javascript"><!--
|
||||
var _info = navigator.userAgent;
|
||||
var _ns = false;
|
||||
var _ns6 = false;
|
||||
var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
|
||||
//--></script>
|
||||
|
||||
<comment>
|
||||
<script language="JavaScript" type="text/javascript"><!--
|
||||
var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0) || (_info.indexOf("IRIX") > 0)));
|
||||
var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0));
|
||||
//--></script>
|
||||
</comment>
|
||||
|
||||
<script language="JavaScript" type="text/javascript"><!--
|
||||
if (_ie == true) document.writeln('<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = "1" HEIGHT = "1" NAME = "ChecksumApplet" codebase="http://java.sun.com/update/1.5.0/jinstall-1_5-windows-i586.cab#Version=5,0,0,5"><noembed><xmp>');
|
||||
else if (_ns == true && _ns6 == false) document.writeln('<embed ' +
|
||||
'type="application/x-java-applet;version=1.5" \
|
||||
CODE = "org/apache/maven/repository/applet/ChecksumApplet.class" \
|
||||
ARCHIVE = "maven-repository-artifact-applet.jar" \
|
||||
NAME = "ChecksumApplet" \
|
||||
WIDTH = "1" \
|
||||
HEIGHT = "1" ' +
|
||||
'scriptable=false ' +
|
||||
'pluginspage="http://java.sun.com/products/plugin/index.html#download"><noembed><xmp>');
|
||||
//--></script>
|
||||
<applet CODE = "org/apache/maven/repository/applet/ChecksumApplet.class" ARCHIVE = "maven-repository-artifact-applet.jar" WIDTH = "1" HEIGHT = "1" NAME = "ChecksumApplet"></xmp>
|
||||
<PARAM NAME = CODE VALUE = "org/apache/maven/repository/applet/ChecksumApplet.class" >
|
||||
<PARAM NAME = ARCHIVE VALUE = "maven-repository-artifact-applet.jar" >
|
||||
<PARAM NAME = NAME VALUE = "ChecksumApplet" >
|
||||
|
||||
<param name="type" value="application/x-java-applet;version=1.5">
|
||||
<param name="scriptable" value="false">
|
||||
|
||||
|
||||
</applet>
|
||||
</noembed>
|
||||
</embed>
|
||||
</object>
|
||||
|
||||
<!--
|
||||
<APPLET CODE = "org/apache/maven/repository/applet/ChecksumApplet.class" ARCHIVE = "maven-repository-artifact-applet.jar" WIDTH = "1" HEIGHT = "1" NAME = "ChecksumApplet">
|
||||
|
||||
|
||||
</APPLET>
|
||||
-->
|
||||
<!--"END_CONVERTED_APPLET"-->
|
||||
</p>
|
||||
|
||||
<p>Search by Java Package:
|
||||
|
|
Loading…
Reference in New Issue