* minor development configuration and build changes.

* reduce the usage of non official sun api.
* fixed web.xml element ordering.
This commit is contained in:
Heng Sin Low 2010-07-15 03:09:32 +08:00
parent e326a4e445
commit 7490371cdd
11 changed files with 67 additions and 78 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="output" path="build"/>
</classpath>

View File

@ -5,8 +5,24 @@
<projects>
</projects>
<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>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View File

@ -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

View File

@ -2,12 +2,11 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: org.adempiere.JasperReports.webapp
Bundle-SymbolicName: org.adempiere.JasperReports.webapp;singleton:=true
Bundle-Version: 0.0.0.1
Require-Bundle: org.eclipse.osgi.services;bundle-version="3.1.100",
org.eclipse.core.runtime;bundle-version="3.5.0",
com.springsource.javax.servlet;bundle-version="2.5.0",
Bundle-Version: 1.0.0.qualifier
Require-Bundle: com.springsource.javax.servlet;bundle-version="2.5.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
Web-ContextPath: jasperreports
Web-ContextPath: webApp
Bundle-ClassPath: .

View File

@ -3,27 +3,17 @@
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
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">
<distributable />
<!--
To use non XDoclet filters, create a filters.xml file that
contains the additional filters (eg Sitemesh) and place it in your
project's merge dir. Don't include filter-mappings in this file,
include them in a file called filter-mappings.xml and put that in
the same directory.
-->
<!--
To use non XDoclet filter-mappings, create a filter-mappings.xml file that
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.
-->
<filter>
<filter-name>MD5Filter</filter-name>
<filter-class>
org.compiere.web.MD5Filter
</filter-class>
</filter>
<filter-mapping>
<filter-name>MD5Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>GetMD5File</servlet-name>
@ -32,29 +22,10 @@
</servlet-class>
</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-name>GetMD5File</servlet-name>
<url-pattern>/GetMD5File</url-pattern>
</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.
Organize mime-mappings.xml following this DTD slice:

View File

@ -1,6 +1,7 @@
bin.includes = META-INF/,\
.,\
standalone.jrxml
standalone.jrxml,\
WEB-INF/
bin.excludes = src/**,\
.settings/**,\
.classpath,\
@ -8,3 +9,4 @@ bin.excludes = src/**,\
build.properties,\
build.xml
source.. = src/
output.. = build/

View File

@ -1,11 +1,9 @@
package org.compiere.utils;
import java.security.*;
import sun.security.provider.Sun;
import java.io.*;
import sun.misc.*;
import org.apache.commons.codec.binary.Base64;
/**
* @author rlemeill
@ -14,12 +12,12 @@ import sun.misc.*;
public class DigestOfFile
{
/**
* @param mode ie MD5
* @param algorithm ie MD5
* @throws Exception
*/
public DigestOfFile(String mode) throws Exception
public DigestOfFile(String algorithm) throws Exception
{
digestAgent = MessageDigest.getInstance(mode, "SUN");
digestAgent = MessageDigest.getInstance(algorithm);
}
/**
@ -49,7 +47,8 @@ public class DigestOfFile
synchronized public String digestAsBase64(File file) throws Exception
{
byte[] digest = digestAsByteArray(file);
String digestAsBase64 = base64Encoder.encode(digest);
Base64 base64 = new Base64();
String digestAsBase64 = new String(base64.encode(digest));
return digestAsBase64;
}
@ -58,7 +57,6 @@ public class DigestOfFile
//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 BASE64Encoder base64Encoder = new BASE64Encoder();
private byte[] buffer = new byte[4096];
/**
@ -69,8 +67,6 @@ public class DigestOfFile
{
try
{
java.security.Security.addProvider(new Sun());
DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
for (int argIndex = 0; argIndex < args.length; argIndex++)
@ -98,7 +94,6 @@ public class DigestOfFile
//compute Hash of exisiting and downloaded
String hashFile1;
String hashFile2;
java.security.Security.addProvider(new Sun());
try{
DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
hashFile1 = md5DigestAgent.digestAsBase64(file1);
@ -117,7 +112,6 @@ public class DigestOfFile
public static String GetLocalMD5Hash(File file)
{
String hash;
java.security.Security.addProvider(new Sun());
try{
DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
hash = md5DigestAgent.digestAsBase64(file);

View File

@ -8,6 +8,7 @@ package org.compiere.utils;
import java.net.URL;
import org.compiere.util.CLogger;
import org.compiere.utils.DigestOfFile;
public class MD5Impl {

View File

@ -15,7 +15,6 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.compiere.interfaces.MD5;
import org.compiere.util.Util;
import org.compiere.utils.MD5Impl;
@ -37,7 +36,6 @@ public class GetMD5FileServlet extends HttpServlet {
public GetMD5FileServlet() {
super();
// TODO Raccord de constructeur auto-généré
}
public void init(ServletConfig config) throws ServletException {
@ -53,7 +51,7 @@ public class GetMD5FileServlet extends HttpServlet {
String output = req.getParameter("output");
if ("text".equalsIgnoreCase(output))
{
resp.setContextType("text/plain");
resp.setContentType("text/plain");
PrintWriter out = resp.getWriter();
out.print(md5.getFileMD5(file));
}

View File

@ -71,7 +71,7 @@ public class MD5Filter implements Filter{
if (request instanceof HttpServletRequest) {
// is md5 request
String s = (String) ((HttpServletRequest)request).getParameter("md5");
String s = ((HttpServletRequest)request).getParameter("md5");
if (!"true".equals(s)) {
chain.doFilter(request, response);
return;

View File

@ -10,7 +10,7 @@ import java.security.NoSuchProviderException;
import javax.servlet.ServletOutputStream;
import sun.misc.BASE64Encoder;
import org.apache.commons.codec.binary.Base64;
/**
* @author hengsin
@ -46,8 +46,8 @@ public class MD5OutputStream extends ServletOutputStream {
*/
public String getMD5Hash() {
byte[] digest = digestAgent.digest();
BASE64Encoder base64Encoder = new BASE64Encoder();
String digestAsBase64 = base64Encoder.encode(digest);
Base64 base64 = new Base64();
String digestAsBase64 = new String(base64.encode(digest));
return digestAsBase64;
}
}