* minor development configuration and build changes.
* reduce the usage of non official sun api. * fixed web.xml element ordering.
This commit is contained in:
parent
e326a4e445
commit
7490371cdd
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||||
<classpathentry kind="output" path="build"/>
|
<classpathentry kind="output" path="build"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -5,8 +5,24 @@
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
<buildSpec>
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#Wed Jul 14 15:44:46 MYT 2010
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -2,12 +2,11 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: org.adempiere.JasperReports.webapp
|
Bundle-Name: org.adempiere.JasperReports.webapp
|
||||||
Bundle-SymbolicName: org.adempiere.JasperReports.webapp;singleton:=true
|
Bundle-SymbolicName: org.adempiere.JasperReports.webapp;singleton:=true
|
||||||
Bundle-Version: 0.0.0.1
|
Bundle-Version: 1.0.0.qualifier
|
||||||
Require-Bundle: org.eclipse.osgi.services;bundle-version="3.1.100",
|
Require-Bundle: com.springsource.javax.servlet;bundle-version="2.5.0",
|
||||||
org.eclipse.core.runtime;bundle-version="3.5.0",
|
|
||||||
com.springsource.javax.servlet;bundle-version="2.5.0",
|
|
||||||
com.springsource.javax.servlet.jsp;bundle-version="2.1.0",
|
com.springsource.javax.servlet.jsp;bundle-version="2.1.0",
|
||||||
org.adempiere.base;bundle-version="0.0.0"
|
org.adempiere.base;bundle-version="1.0.0",
|
||||||
|
org.adempiere.tools;bundle-version="1.0.0"
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||||
Web-ContextPath: jasperreports
|
Web-ContextPath: webApp
|
||||||
Bundle-ClassPath: .
|
Bundle-ClassPath: .
|
||||||
|
|
|
@ -3,27 +3,17 @@
|
||||||
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
|
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
|
||||||
<distributable />
|
|
||||||
|
|
||||||
<!--
|
<filter>
|
||||||
To use non XDoclet filters, create a filters.xml file that
|
<filter-name>MD5Filter</filter-name>
|
||||||
contains the additional filters (eg Sitemesh) and place it in your
|
<filter-class>
|
||||||
project's merge dir. Don't include filter-mappings in this file,
|
org.compiere.web.MD5Filter
|
||||||
include them in a file called filter-mappings.xml and put that in
|
</filter-class>
|
||||||
the same directory.
|
</filter>
|
||||||
-->
|
<filter-mapping>
|
||||||
|
<filter-name>MD5Filter</filter-name>
|
||||||
<!--
|
<url-pattern>/*</url-pattern>
|
||||||
To use non XDoclet filter-mappings, create a filter-mappings.xml file that
|
</filter-mapping>
|
||||||
contains the additional filter-mappings and place it in your
|
|
||||||
project's merge dir.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
|
||||||
To use non XDoclet listeners, create a listeners.xml file that
|
|
||||||
contains the additional listeners and place it in your
|
|
||||||
project's merge dir.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>GetMD5File</servlet-name>
|
<servlet-name>GetMD5File</servlet-name>
|
||||||
|
@ -32,29 +22,10 @@
|
||||||
</servlet-class>
|
</servlet-class>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
<filter>
|
|
||||||
<filter-name>MD5Filter</filter-name>
|
|
||||||
<filter-class>
|
|
||||||
org.compiere.web.MD5Filter
|
|
||||||
</filter-class>
|
|
||||||
</filter>
|
|
||||||
<!--
|
|
||||||
To use non XDoclet servlets, create a servlets.xml file that
|
|
||||||
contains the additional servlets (eg Struts) and place it in your
|
|
||||||
project's merge dir. Don't include servlet-mappings in this file,
|
|
||||||
include them in a file called servlet-mappings.xml and put that in
|
|
||||||
the same directory.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>GetMD5File</servlet-name>
|
<servlet-name>GetMD5File</servlet-name>
|
||||||
<url-pattern>/GetMD5File</url-pattern>
|
<url-pattern>/GetMD5File</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<filter-mapping>
|
|
||||||
<filter-name>MD5Filter</filter-name>
|
|
||||||
<url-pattern>/*</url-pattern>
|
|
||||||
</filter-mapping>
|
|
||||||
<!--
|
<!--
|
||||||
To specify mime mappings, create a file named mime-mappings.xml, put it in your project's mergedir.
|
To specify mime mappings, create a file named mime-mappings.xml, put it in your project's mergedir.
|
||||||
Organize mime-mappings.xml following this DTD slice:
|
Organize mime-mappings.xml following this DTD slice:
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
bin.includes = META-INF/,\
|
bin.includes = META-INF/,\
|
||||||
.,\
|
.,\
|
||||||
standalone.jrxml
|
standalone.jrxml,\
|
||||||
|
WEB-INF/
|
||||||
bin.excludes = src/**,\
|
bin.excludes = src/**,\
|
||||||
.settings/**,\
|
.settings/**,\
|
||||||
.classpath,\
|
.classpath,\
|
||||||
|
@ -8,3 +9,4 @@ bin.excludes = src/**,\
|
||||||
build.properties,\
|
build.properties,\
|
||||||
build.xml
|
build.xml
|
||||||
source.. = src/
|
source.. = src/
|
||||||
|
output.. = build/
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
package org.compiere.utils;
|
package org.compiere.utils;
|
||||||
|
|
||||||
import java.security.*;
|
import java.security.*;
|
||||||
import sun.security.provider.Sun;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
import sun.misc.*;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author rlemeill
|
* @author rlemeill
|
||||||
|
@ -14,14 +12,14 @@ import sun.misc.*;
|
||||||
public class DigestOfFile
|
public class DigestOfFile
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param mode ie MD5
|
* @param algorithm ie MD5
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public DigestOfFile(String mode) throws Exception
|
public DigestOfFile(String algorithm) throws Exception
|
||||||
{
|
{
|
||||||
digestAgent = MessageDigest.getInstance(mode, "SUN");
|
digestAgent = MessageDigest.getInstance(algorithm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param file to hash
|
* @param file to hash
|
||||||
* @return hash
|
* @return hash
|
||||||
|
@ -39,7 +37,7 @@ public class DigestOfFile
|
||||||
byte[] digest = digestAgent.digest();
|
byte[] digest = digestAgent.digest();
|
||||||
return digest;
|
return digest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author rlemeill
|
* @author rlemeill
|
||||||
* @param file
|
* @param file
|
||||||
|
@ -49,18 +47,18 @@ public class DigestOfFile
|
||||||
synchronized public String digestAsBase64(File file) throws Exception
|
synchronized public String digestAsBase64(File file) throws Exception
|
||||||
{
|
{
|
||||||
byte[] digest = digestAsByteArray(file);
|
byte[] digest = digestAsByteArray(file);
|
||||||
String digestAsBase64 = base64Encoder.encode(digest);
|
Base64 base64 = new Base64();
|
||||||
|
String digestAsBase64 = new String(base64.encode(digest));
|
||||||
return digestAsBase64;
|
return digestAsBase64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//private static final char[] HEX_CHARS = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
|
//private static final char[] HEX_CHARS = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
|
||||||
|
|
||||||
private MessageDigest digestAgent;
|
private MessageDigest digestAgent;
|
||||||
private BASE64Encoder base64Encoder = new BASE64Encoder();
|
|
||||||
private byte[] buffer = new byte[4096];
|
private byte[] buffer = new byte[4096];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author rlemeill
|
* @author rlemeill
|
||||||
* @param args file
|
* @param args file
|
||||||
|
@ -69,10 +67,8 @@ public class DigestOfFile
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
java.security.Security.addProvider(new Sun());
|
|
||||||
|
|
||||||
DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
|
DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
|
||||||
|
|
||||||
for (int argIndex = 0; argIndex < args.length; argIndex++)
|
for (int argIndex = 0; argIndex < args.length; argIndex++)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
@ -86,8 +82,8 @@ public class DigestOfFile
|
||||||
e.printStackTrace(System.out);
|
e.printStackTrace(System.out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param file1 first file to compare
|
* @param file1 first file to compare
|
||||||
* @param file2 second file to compare
|
* @param file2 second file to compare
|
||||||
|
@ -98,7 +94,6 @@ public class DigestOfFile
|
||||||
//compute Hash of exisiting and downloaded
|
//compute Hash of exisiting and downloaded
|
||||||
String hashFile1;
|
String hashFile1;
|
||||||
String hashFile2;
|
String hashFile2;
|
||||||
java.security.Security.addProvider(new Sun());
|
|
||||||
try{
|
try{
|
||||||
DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
|
DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
|
||||||
hashFile1 = md5DigestAgent.digestAsBase64(file1);
|
hashFile1 = md5DigestAgent.digestAsBase64(file1);
|
||||||
|
@ -108,8 +103,8 @@ public class DigestOfFile
|
||||||
{
|
{
|
||||||
return false; //if there is an error during comparison return files are difs
|
return false; //if there is an error during comparison return files are difs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param file
|
* @param file
|
||||||
* @return md5 hash null if file is not found or other error
|
* @return md5 hash null if file is not found or other error
|
||||||
|
@ -117,7 +112,6 @@ public class DigestOfFile
|
||||||
public static String GetLocalMD5Hash(File file)
|
public static String GetLocalMD5Hash(File file)
|
||||||
{
|
{
|
||||||
String hash;
|
String hash;
|
||||||
java.security.Security.addProvider(new Sun());
|
|
||||||
try{
|
try{
|
||||||
DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
|
DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
|
||||||
hash = md5DigestAgent.digestAsBase64(file);
|
hash = md5DigestAgent.digestAsBase64(file);
|
||||||
|
|
|
@ -8,6 +8,7 @@ package org.compiere.utils;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.utils.DigestOfFile;
|
import org.compiere.utils.DigestOfFile;
|
||||||
|
|
||||||
public class MD5Impl {
|
public class MD5Impl {
|
||||||
|
|
|
@ -15,7 +15,6 @@ import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.compiere.interfaces.MD5;
|
|
||||||
import org.compiere.util.Util;
|
import org.compiere.util.Util;
|
||||||
import org.compiere.utils.MD5Impl;
|
import org.compiere.utils.MD5Impl;
|
||||||
|
|
||||||
|
@ -37,7 +36,6 @@ public class GetMD5FileServlet extends HttpServlet {
|
||||||
|
|
||||||
public GetMD5FileServlet() {
|
public GetMD5FileServlet() {
|
||||||
super();
|
super();
|
||||||
// TODO Raccord de constructeur auto-généré
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(ServletConfig config) throws ServletException {
|
public void init(ServletConfig config) throws ServletException {
|
||||||
|
@ -53,7 +51,7 @@ public class GetMD5FileServlet extends HttpServlet {
|
||||||
String output = req.getParameter("output");
|
String output = req.getParameter("output");
|
||||||
if ("text".equalsIgnoreCase(output))
|
if ("text".equalsIgnoreCase(output))
|
||||||
{
|
{
|
||||||
resp.setContextType("text/plain");
|
resp.setContentType("text/plain");
|
||||||
PrintWriter out = resp.getWriter();
|
PrintWriter out = resp.getWriter();
|
||||||
out.print(md5.getFileMD5(file));
|
out.print(md5.getFileMD5(file));
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class MD5Filter implements Filter{
|
||||||
|
|
||||||
if (request instanceof HttpServletRequest) {
|
if (request instanceof HttpServletRequest) {
|
||||||
// is md5 request
|
// is md5 request
|
||||||
String s = (String) ((HttpServletRequest)request).getParameter("md5");
|
String s = ((HttpServletRequest)request).getParameter("md5");
|
||||||
if (!"true".equals(s)) {
|
if (!"true".equals(s)) {
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.security.NoSuchProviderException;
|
||||||
|
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
|
|
||||||
import sun.misc.BASE64Encoder;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
|
@ -46,8 +46,8 @@ public class MD5OutputStream extends ServletOutputStream {
|
||||||
*/
|
*/
|
||||||
public String getMD5Hash() {
|
public String getMD5Hash() {
|
||||||
byte[] digest = digestAgent.digest();
|
byte[] digest = digestAgent.digest();
|
||||||
BASE64Encoder base64Encoder = new BASE64Encoder();
|
Base64 base64 = new Base64();
|
||||||
String digestAsBase64 = base64Encoder.encode(digest);
|
String digestAsBase64 = new String(base64.encode(digest));
|
||||||
return digestAsBase64;
|
return digestAsBase64;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue