-
-
- Build the UI subproject within the Compiere project.
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
- ------ Compiling webApp
-
-
-
-
+
+
-
- ------ packaging
-
-
-
-
- ------ deploying interfaces to JasperReports
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/JasperReportsWebApp/deploy/WebApp.ear/META-INF/application.xml b/JasperReportsWebApp/deploy/WebApp.ear/META-INF/application.xml
deleted file mode 100644
index fba4920ffc..0000000000
--- a/JasperReportsWebApp/deploy/WebApp.ear/META-INF/application.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
- Web App
-
- webAppEJB.jar
-
-
-
- webApp.war
- /webApp
-
-
-
diff --git a/JasperReportsWebApp/deploy/WebApp.ear/META-INF/jboss.xml b/JasperReportsWebApp/deploy/WebApp.ear/META-INF/jboss.xml
deleted file mode 100644
index 832ffa1842..0000000000
--- a/JasperReportsWebApp/deploy/WebApp.ear/META-INF/jboss.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
- compiereMD5
- ejb/compiere/MD5
-
-
-
-
-
-
-
-
diff --git a/JasperReportsWebApp/deploy/WebApp.ear/webApp.war/WEB-INF/jboss-web.xml b/JasperReportsWebApp/deploy/WebApp.ear/webApp.war/WEB-INF/jboss-web.xml
deleted file mode 100644
index 32155d3c44..0000000000
--- a/JasperReportsWebApp/deploy/WebApp.ear/webApp.war/WEB-INF/jboss-web.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ejb/compiere/MD5
- ejb/compiere/MD5
-
-
-
-
-
-
diff --git a/JasperReportsWebApp/deploy/WebApp.ear/webApp.war/WEB-INF/web.xml b/JasperReportsWebApp/deploy/WebApp.ear/webApp.war/WEB-INF/web.xml
deleted file mode 100644
index a1ab00da09..0000000000
--- a/JasperReportsWebApp/deploy/WebApp.ear/webApp.war/WEB-INF/web.xml
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- GetMD5File
- Name for GetMD5File
-
- org.compiere.web.GetMD5FileServlet
-
-
- A parameter
- A value
-
-
-
-
-
- GetMD5File
- /GetMD5File
-
-
-
-
-
-
-
-
-
-
-
- ejb/compiere/MD5
- Session
- org.compiere.interfaces.MD5
-
-
-
diff --git a/JasperReportsWebApp/deploy/WebApp.ear/webApp.war/index.html b/JasperReportsWebApp/deploy/WebApp.ear/webApp.war/index.html
deleted file mode 100644
index 971dec5b01..0000000000
--- a/JasperReportsWebApp/deploy/WebApp.ear/webApp.war/index.html
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
- Compiere Jasper integration
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Compiere Jasper Integration
-under construction
web designer wanted!
-Please visite the sourceforge project page here
-If you want to join the project don't hesitate to contact
Developers, web designer and testers are welcomed
-Access directly to latest files here
and the documentation here
-Browse the JavaDoc here
Don't hesitate to use the forums it is the best place for any help
-
-License information: the Open software presented here is under GPL license, but you must agree each license of each specific part included (ie: Compiere,jasperreports,iText, ant,..) each Trademark is propritary of its owner
-
-
-
-
diff --git a/JasperReportsWebApp/src/META-INF/application.xml b/JasperReportsWebApp/src/META-INF/application.xml
deleted file mode 100644
index 43753dbb75..0000000000
--- a/JasperReportsWebApp/src/META-INF/application.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
- JasperReport Web App
-
- webAppEJB.jar
-
-
-
- webApp.war
- /webApp
-
-
-
diff --git a/JasperReportsWebApp/src/META-INF/jboss.xml b/JasperReportsWebApp/src/META-INF/jboss.xml
deleted file mode 100644
index 870e8150ee..0000000000
--- a/JasperReportsWebApp/src/META-INF/jboss.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
- compiereMD5
- ejb/compiere/MD5
-
-
-
-
-
-
-
-
diff --git a/JasperReportsWebApp/src/org/compiere/interfaces/MD5.java b/JasperReportsWebApp/src/org/compiere/interfaces/MD5.java
deleted file mode 100644
index 59a068ae39..0000000000
--- a/JasperReportsWebApp/src/org/compiere/interfaces/MD5.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Generated file - Do not edit!
- */
-package org.compiere.interfaces;
-
-import javax.ejb.Remote;
-
-/**
- * Remote interface for compiere/MD5.
- */
-@Remote
-public interface MD5
-{
- public final static String JNDI_NAME = "ejb/compiere/MD5";
-
- public final static String EJB_NAME = "compiereMD5";
-
- /**
- * Business method
- * @param Filename
- * @return AbsolutePath on server */
- public java.lang.String getFileAsolutePath( java.lang.String Filename );
-
- /**
- * Business method
- * @param FileName
- * @return hash base64 encoded */
- public java.lang.String getFileMD5( java.lang.String FileName );
-
-}
diff --git a/JasperReportsWebApp/src/org/compiere/utils/MD5EjbTest.java b/JasperReportsWebApp/src/org/compiere/utils/MD5EjbTest.java
deleted file mode 100644
index bd5262b1f9..0000000000
--- a/JasperReportsWebApp/src/org/compiere/utils/MD5EjbTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Créé le 26 mars 2005
- *
- * TODO Pour changer le modčle de ce fichier généré, allez ŕ :
- * Fenętre - Préférences - Java - Style de code - Modčles de code
- */
-package org.compiere.utils;
-
-import java.net.InetAddress;
-import java.util.Hashtable;
-
-import javax.naming.InitialContext;
-
-import org.compiere.interfaces.MD5;
-/**
- * @author rlemeill
- */
-
-public class MD5EjbTest {
-
- /**************************************************************************
- * constructor
- * @param serverName
- * @param context
- * @param Filename
- */
- public MD5EjbTest (String serverName,String Filename)
- {
- Hashtable env = new Hashtable();
- env.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
- env.put(InitialContext.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
- env.put(InitialContext.PROVIDER_URL, serverName);
- System.out.println ("Creating context ...");
- System.out.println (" " + env);
- InitialContext context = null;
- try
- {
- context = new InitialContext(env);
- }
- catch (Exception e)
- {
- System.err.println("ERROR: Could not create context: " + e);
- return;
- }
- testEjb(serverName,context,Filename);
- }
-
-
- /**************************************************************************
- * testing entry point
- * @param serverName
- * @param context
- * @param Filename
- */
- public static void testEjb(String serverName, InitialContext context, String Filename)
- {
- try{
- System.out.println("MD5 Creation at: "+MD5.JNDI_NAME);
- MD5 md5 = (MD5) context.lookup(MD5.JNDI_NAME);
- System.out.println("Creation OK");
- System.out.println("MD5 for " + Filename + " is " +md5.getFileMD5(Filename));
- }
- catch(Exception e)
- {
-
- }
- }
-
- /**************************************************************************
- * Start Method
- * @param args serverName Filename
- */
- public static void main(String[] args)
- {
- String serverName = null;
- String Filename = null;
- if (args.length > 0)
- serverName = args[0];
- if (args.length > 1)
- Filename = args[1];
- if (serverName == null || serverName.length() == 0)
- {
- try
- {
- serverName = InetAddress.getLocalHost().getHostName();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- MD5EjbTest myMD5EjbTest = new MD5EjbTest(serverName,Filename);
-
- }
-}
diff --git a/JasperReportsWebApp/src/org/compiere/ejb/MD5Bean.java b/JasperReportsWebApp/src/org/compiere/utils/MD5Impl.java
similarity index 77%
rename from JasperReportsWebApp/src/org/compiere/ejb/MD5Bean.java
rename to JasperReportsWebApp/src/org/compiere/utils/MD5Impl.java
index a1b24b2362..03676efc88 100644
--- a/JasperReportsWebApp/src/org/compiere/ejb/MD5Bean.java
+++ b/JasperReportsWebApp/src/org/compiere/utils/MD5Impl.java
@@ -4,30 +4,21 @@
* TODO Pour changer le modčle de ce fichier généré, allez ŕ :
* Fenętre - Préférences - Java - Style de code - Modčles de code
*/
-package org.compiere.ejb;
+package org.compiere.utils;
import java.net.URL;
-import javax.ejb.Stateless;
-
-import org.compiere.interfaces.MD5;
-import org.compiere.util.CLogger;
import org.compiere.utils.DigestOfFile;
-/**
- * @ejb:ejb-ref ejb-name="compiere/MD5"
- * ref-name="compiere/MD5"
- */
-@Stateless(mappedName=MD5.JNDI_NAME, name=MD5.EJB_NAME)
-public class MD5Bean implements MD5 {
+public class MD5Impl {
/**
- *
+ *
*/
private CLogger log = null;
-
- public MD5Bean() {
+
+ public MD5Impl() {
super();
- log = CLogger.getCLogger(MD5Bean.class);
+ log = CLogger.getCLogger(MD5Impl.class);
}
/**
@@ -56,23 +47,23 @@ public class MD5Bean implements MD5 {
{
absoluteFilename = FileName;
}
-
+
if (absoluteFilename != null)
{
DigestOfFile md5DigestAgent = new DigestOfFile("MD5");
- hash = md5DigestAgent.digestAsBase64(new java.io.File(absoluteFilename));
+ hash = md5DigestAgent.digestAsBase64(new java.io.File(absoluteFilename));
}
-
+
}
catch(Exception e)
{
log.severe(e.getMessage());
return null;
}
-
+
return hash;
}
-
+
/**
* Business method
* @param Filename
diff --git a/JasperReportsWebApp/src/org/compiere/web/GetMD5FileServlet.java b/JasperReportsWebApp/src/org/compiere/web/GetMD5FileServlet.java
index b18e8103db..4cd8075ff7 100644
--- a/JasperReportsWebApp/src/org/compiere/web/GetMD5FileServlet.java
+++ b/JasperReportsWebApp/src/org/compiere/web/GetMD5FileServlet.java
@@ -9,8 +9,6 @@ package org.compiere.web;
import java.io.IOException;
import java.io.PrintWriter;
-import javax.naming.Context;
-import javax.naming.InitialContext;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@@ -19,39 +17,32 @@ import javax.servlet.http.HttpServletResponse;
import org.compiere.interfaces.MD5;
import org.compiere.util.Util;
+import org.compiere.utils.MD5Impl;
/**
* Servlet Class
- *
+ *
* @author Michael Judd BF [2728388] - fix potential CSS vulnerability
*/
public class GetMD5FileServlet extends HttpServlet {
/**
- *
+ *
*/
private static final long serialVersionUID = -2625917637549702574L;
/**
- *
+ *
*/
- private MD5 md5;
-
+ private MD5Impl md5;
+
public GetMD5FileServlet() {
super();
- // TODO Raccord de constructeur auto-généré
+ // TODO Raccord de constructeur auto-généré
}
public void init(ServletConfig config) throws ServletException {
super.init(config);
- try
- {
- Context context = new InitialContext();
- md5 = (MD5) context.lookup("java:/comp/env/ejb/compiere/MD5");
- }
- catch(Exception e)
- {
- throw new ServletException("Error getting EJB: java:/comp/env/ejb/compiere/MD5");
- }
+ md5 = new MD5Impl();
}
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
@@ -59,11 +50,21 @@ public class GetMD5FileServlet extends HttpServlet {
IOException {
// TODO Auto-generated method stub
String file = Util.maskHTML(req.getParameter("File"));
- PrintWriter out = resp.getWriter();
- out.println("MD5 Hash");
- out.println("File is: "+ file + "
MD5 : "+ md5.getFileMD5(file)+"
");
- //out.println(md5.getFileAsolutePath(file));
- out.println("");
+ String output = req.getParameter("output");
+ if ("text".equalsIgnoreCase(output))
+ {
+ resp.setContextType("text/plain");
+ PrintWriter out = resp.getWriter();
+ out.print(md5.getFileMD5(file));
+ }
+ else
+ {
+ PrintWriter out = resp.getWriter();
+ out.println("MD5 Hash");
+ out.println("File is: "+ file + "
MD5 : "+ md5.getFileMD5(file)+"
");
+ //out.println(md5.getFileAsolutePath(file));
+ out.println("");
+ }
}
}
\ No newline at end of file
diff --git a/JasperReportsWebApp/src/org/compiere/web/MD5Filter.java b/JasperReportsWebApp/src/org/compiere/web/MD5Filter.java
new file mode 100644
index 0000000000..a7592aa538
--- /dev/null
+++ b/JasperReportsWebApp/src/org/compiere/web/MD5Filter.java
@@ -0,0 +1,111 @@
+package org.compiere.web;
+
+import java.io.IOException;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+/**
+ * Implementation of javax.servlet.Filter
used to compress
+ * the ServletResponse if it is bigger than a threshold.
+ *
+ * @author Amy Roh
+ * @author Dmitri Valdin
+ * @version $Revision: 1.2 $, $Date: 2004/03/18 16:40:33 $
+ */
+
+public class MD5Filter implements Filter{
+
+ /**
+ * The filter configuration object we are associated with. If this value
+ * is null, this filter instance is not currently configured.
+ */
+ private FilterConfig config = null;
+
+ /**
+ /**
+ * Place this filter into service.
+ *
+ * @param filterConfig The filter configuration object
+ */
+
+ public void init(FilterConfig filterConfig) {
+
+ config = filterConfig;
+ }
+
+ /**
+ * Take this filter out of service.
+ */
+ public void destroy() {
+
+ this.config = null;
+
+ }
+
+ /**
+ * The doFilter
method of the Filter is called by the container
+ * each time a request/response pair is passed through the chain due
+ * to a client request for a resource at the end of the chain.
+ * The FilterChain passed into this method allows the Filter to pass on the
+ * request and response to the next entity in the chain.
+ * This method first examines the request to check whether the client support
+ * compression.
+ * It simply just pass the request and response if there is no support for
+ * compression.
+ * If the compression support is available, it creates a
+ * CompressionServletResponseWrapper object which compresses the content and
+ * modifies the header if the content length is big enough.
+ * It then invokes the next entity in the chain using the FilterChain object
+ * (chain.doFilter()
),
+ **/
+
+ public void doFilter ( ServletRequest request, ServletResponse response,
+ FilterChain chain ) throws IOException, ServletException {
+
+ if (request instanceof HttpServletRequest) {
+ // is md5 request
+ String s = (String) ((HttpServletRequest)request).getParameter("md5");
+ if (!"true".equals(s)) {
+ chain.doFilter(request, response);
+ return;
+ }
+ }
+
+ if (response instanceof HttpServletResponse) {
+ MD5ResponseWrapper wrappedResponse =
+ new MD5ResponseWrapper((HttpServletResponse)response);
+ try {
+ chain.doFilter(request, wrappedResponse);
+ } finally {
+ wrappedResponse.finishResponse();
+ }
+ return;
+ }
+ }
+
+ /**
+ * Set filter config
+ * This function is equivalent to init. Required by Weblogic 6.1
+ *
+ * @param filterConfig The filter configuration object
+ */
+ public void setFilterConfig(FilterConfig filterConfig) {
+ init(filterConfig);
+ }
+
+ /**
+ * Return filter config
+ * Required by Weblogic 6.1
+ */
+ public FilterConfig getFilterConfig() {
+ return config;
+ }
+
+}
diff --git a/JasperReportsWebApp/src/org/compiere/web/MD5OutputStream.java b/JasperReportsWebApp/src/org/compiere/web/MD5OutputStream.java
new file mode 100644
index 0000000000..20524fdb5a
--- /dev/null
+++ b/JasperReportsWebApp/src/org/compiere/web/MD5OutputStream.java
@@ -0,0 +1,53 @@
+/**
+ *
+ */
+package org.compiere.web;
+
+import java.io.IOException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+
+import javax.servlet.ServletOutputStream;
+
+import sun.misc.BASE64Encoder;
+
+/**
+ * @author hengsin
+ *
+ */
+public class MD5OutputStream extends ServletOutputStream {
+
+ private MessageDigest digestAgent;
+
+ /**
+ *
+ */
+ public MD5OutputStream() {
+ try {
+ digestAgent = MessageDigest.getInstance("MD5", "SUN");
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ } catch (NoSuchProviderException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @see java.io.OutputStream#write(int)
+ */
+ @Override
+ public void write(int b) throws IOException {
+ digestAgent.update((byte) b);
+ }
+
+ /**
+ * @return md5 hash
+ */
+ public String getMD5Hash() {
+ byte[] digest = digestAgent.digest();
+ BASE64Encoder base64Encoder = new BASE64Encoder();
+ String digestAsBase64 = base64Encoder.encode(digest);
+ return digestAsBase64;
+ }
+}
diff --git a/JasperReportsWebApp/src/org/compiere/web/MD5ResponseWrapper.java b/JasperReportsWebApp/src/org/compiere/web/MD5ResponseWrapper.java
new file mode 100644
index 0000000000..2f5bb1e0c3
--- /dev/null
+++ b/JasperReportsWebApp/src/org/compiere/web/MD5ResponseWrapper.java
@@ -0,0 +1,75 @@
+/**
+ *
+ */
+package org.compiere.web;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+/**
+ * @author hengsin
+ *
+ */
+public class MD5ResponseWrapper extends HttpServletResponseWrapper {
+
+ private ServletOutputStream stream = null;
+ private PrintWriter writer = null;
+ private HttpServletResponse origResponse;
+
+ /**
+ * @param response
+ */
+ public MD5ResponseWrapper(HttpServletResponse response) {
+ super(response);
+ origResponse = response;
+ }
+
+ public void finishResponse() {
+ if (stream != null) {
+ String digest = ((MD5OutputStream)stream).getMD5Hash();
+ origResponse.setContentType("text/plain");
+ origResponse.setContentLength(digest.getBytes().length);
+ try {
+ origResponse.getOutputStream().write(digest.getBytes());
+ origResponse.getOutputStream().flush();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @Override
+ public ServletOutputStream getOutputStream() throws IOException {
+ if (writer != null)
+ throw new IllegalStateException("getWriter() has already been called for this response");
+
+ if (stream == null)
+ stream = createOutputStream();
+
+ return (stream);
+ }
+
+ @Override
+ public PrintWriter getWriter() throws IOException {
+ if (writer != null)
+ return (writer);
+
+ if (stream != null)
+ throw new IllegalStateException("getOutputStream() has already been called for this response");
+
+ stream = createOutputStream();
+
+ writer = new PrintWriter(stream);
+ return writer;
+ }
+
+ private ServletOutputStream createOutputStream() {
+ stream = new MD5OutputStream();
+ return stream;
+ }
+
+}
diff --git a/JasperReportsWebApp/deploy/WebApp.ear/webApp.war/standalone.jrxml b/JasperReportsWebApp/standalone.jrxml
similarity index 100%
rename from JasperReportsWebApp/deploy/WebApp.ear/webApp.war/standalone.jrxml
rename to JasperReportsWebApp/standalone.jrxml
diff --git a/JasperReportsWebApp/webroot/index.html b/JasperReportsWebApp/webroot/index.html
deleted file mode 100644
index 971dec5b01..0000000000
--- a/JasperReportsWebApp/webroot/index.html
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
- Compiere Jasper integration
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Compiere Jasper Integration
-under construction
web designer wanted!
-Please visite the sourceforge project page here
-If you want to join the project don't hesitate to contact
Developers, web designer and testers are welcomed
-Access directly to latest files here
and the documentation here
-Browse the JavaDoc here
Don't hesitate to use the forums it is the best place for any help
-
-License information: the Open software presented here is under GPL license, but you must agree each license of each specific part included (ie: Compiere,jasperreports,iText, ant,..) each Trademark is propritary of its owner
-
-
-
-
diff --git a/JasperReportsWebApp/webroot/standalone.jrxml b/JasperReportsWebApp/webroot/standalone.jrxml
deleted file mode 100644
index 04400fb026..0000000000
--- a/JasperReportsWebApp/webroot/standalone.jrxml
+++ /dev/null
@@ -1,152 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- The quick brown fox jumps over the lazy dog.]]>
-
-
-
-
-
-
-
-
-
-
-
- The quick brown fox jumps over the lazy dog.]]>
-
-
-
-
-
-
-
-
-
-
-
- The quick brown fox jumps over the lazy dog.]]>
-
-
-
-
-
-
-
-
-
-
-
- The quick brown fox jumps over the lazy dog.]]>
-
-
-
-
-
-
-
-
-
-
-
- The quick brown fox jumps over the lazy dog.]]>
-
-
-
-
-
-
-
-
-
-
-
- The quick brown fox jumps over the lazy dog.]]>
-
-
-
-
-
-
-
-
-
-
-
- The quick brown fox jumps over the lazy dog.]]>
-
-
-
-
-
-
-
-
-
-
-
- The quick brown fox jumps over the lazy dog.]]>
-
-
-
-
-
-
-
-
-
-
-
- The quick brown fox jumps over the lazy dog.]]>
-
-
-
-
-
-
-
-
-
-
-
- The quick brown fox jumps over the lazy dog.]]>
-
-
-
-
-
-
-
-
-
-
-
- The quick brown fox jumps over the lazy dog.]]>
-
-
-
-
-
-
-
-
-
-
-
- The quick brown fox jumps over the lazy dog.]]>
-
-
-
-