37 lines
1.5 KiB
Java
37 lines
1.5 KiB
Java
package org.gcube.data.analysis.nlphub.legacy;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
public class Constants {
|
|
//public static String DATAMINER_URL = "http://dataminer0-proto.d4science.org";
|
|
//public static String DATAMINER_URL = "http://dataminer2-proto.d4science.org";
|
|
public static String DATAMINER_URL = "http://dataminer-prototypes.d4science.org";
|
|
public static String DEFAULT_DESCRIPTION = "NlpHub upload";
|
|
public static String TOKEN_PARAMETER = "gcube-token";
|
|
public static String TEST_TOKEN = "df2cc5f5-63ee-48c1-b2a6-1210030c57b8-843339462";
|
|
public static String PUBLIC_TOKEN = "f57441ac-b361-4c2d-992a-40db034f1b8c-843339462";
|
|
public static String MIME_TEXT = "text/plain";
|
|
public static String CONTENT_TYPE = "Content-Type";
|
|
public static String UNAVAILABLE = "unavailable";
|
|
public static String ERROR_ID = "ERROR";
|
|
public static String INPUT_FILE_PARAMETER = "input";
|
|
|
|
public static String getToken(HttpServletRequest request, boolean devMode) {
|
|
String token = request.getParameter(TOKEN_PARAMETER);
|
|
if(devMode) {
|
|
if(token == null) token = TEST_TOKEN;
|
|
}
|
|
return token;
|
|
}
|
|
|
|
public static String hexDump(byte[] bytes) {
|
|
char[] hexArray = "0123456789ABCDEF".toCharArray();
|
|
char[] hexChars = new char[bytes.length * 3];
|
|
for (int j = 0; j < bytes.length; j++) {
|
|
hexChars[3*j] = hexArray[bytes[j] / 16];
|
|
hexChars[3*j+1] = hexArray[bytes[j] % 16];
|
|
hexChars[3*j+2] = ' ';
|
|
}
|
|
return new String(hexChars);
|
|
}
|
|
}
|