Makefile cleanup

Signed-off-by: Luca Fulchir <luca@fulchir.it>
parent 111e9ff6
......@@ -5,22 +5,34 @@ JARDIR=${CWD}/../lib
JOLIEDIR=/opt/jolie/
PACKAGE_NAME="utils.jar"
LIBRARY="httpcore-4.2.2.jar httpclient-4.2.3.jar commons-io-2.4.jar"
SRC=${CWD}/jolie/net/
java:
all: clean java install
java: ${SRC}/utils/Hmac.java ${SRC}/utils/HTTP.java
- mkdir -p ${BUILDDIR} 2>/dev/null
${JAVAC} -cp ${JOLIEDIR}/jolie.jar -d ${BUILDDIR} jolie/net/utils/URLEncoder.java
${JAVAC} -cp ${JOLIEDIR}/jolie.jar:${JARDIR}/commons-codec-1.6.jar -d ${BUILDDIR} jolie/net/utils/Hmac.java
${JAVAC} -cp ${JOLIEDIR}/jolie.jar:${JARDIR}/httpcore-4.2.2.jar:${JARDIR}/httpclient-4.2.3.jar:${JARDIR}/commons-io-2.4.jar:${JARDIR}/commons-codec-1.6.jar:${JOLIEDIR}/extensions/http.jar:${JOLIEDIR}/lib/json_simple.jar -d ${BUILDDIR} jolie/net/utils/HTTP.java
cd ${BUILDDIR} && jar cvf ${PACKAGE_NAME} ./jolie/net/utils/*class && cd ${CWD}
clean:
- rm -rf ${BUILDDIR}
install: java
install: ${SRC}/utils/Hmac.java ${SRC}/utils/HTTP.java ${BUILDDIR}/jolie/net/utils/HTTP.class ${BUILDDIR}/jolie/net/utils/HTTP.class
cd ${BUILDDIR} && jar cvf ${PACKAGE_NAME} ./jolie/net/utils/*class && cd ${CWD}
cp ${BUILDDIR}/utils.jar ${JOLIEDIR}/javaServices/
cp ${JARDIR}/*.jar ${JOLIEDIR}/javaServices/
demo1: install
uninstall:
-rm ${JOLIEDIR}/javaServices/utils.jar
-rm ${JOLIEDIR}/javaServices/commons-codec-1.6.jar
-rm ${JOLIEDIR}/javaServices/commons-logging-1.1.1.jar
-rm ${JOLIEDIR}/javaServices/httpcore-4.2.2.jar
-rm ${JOLIEDIR}/javaServices/commons-io-2.4.jar
-rm ${JOLIEDIR}/javaServices/httpclient-4.2.3.jar
demo1: ${JOLIEDIR}/javaServices/utils.jar
jolie jolie/net/OAuth/demo1.ol
demo2: ${JOLIEDIR}/javaServices/utils.jar
jolie jolie/net/OAuth/demo2.ol
/***************************************************************************
* Copyright (C) 2013 by Luca Fulchir <luca@fulchir.it> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
* For details about the authors of this software, see the AUTHORS file. *
***************************************************************************/
type URLEncoderRequest:void {
.input :string
.encoding :string
}
interface URLEncoderInterface {
RequestResponse:
encode (URLEncoderRequest) (string) throws Encoding
}
outputPort URLEncoder {
Interfaces:
URLEncoderInterface
}
embedded {
Java:
"jolie.net.utils.URLEncoder" in URLEncoder
}
/* *************************************************************************
* Copyright (C) 2013 by Luca Fulchir <luca@fulchir.it> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
* For details about the authors of this software, see the AUTHORS file. *
***************************************************************************/
package jolie.net.utils;
import jolie.runtime.JavaService;
import jolie.runtime.Value;
import jolie.runtime.ValueVector;
import jolie.runtime.embedding.RequestResponse;
import jolie.runtime.FaultException;
public class URLEncoder extends JavaService
{
@RequestResponse
public static String encode (Value req) throws FaultException
{
String result = null;
try {
result = java.net.URLEncoder.encode(
req.getFirstChild( "input" ).strValue(),
req.getFirstChild( "encoding" ).strValue());
} catch (java.io.UnsupportedEncodingException e) {
throw new FaultException("Encoding", e);
}
return result;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment