Skip to content

Commit 597d5a5

Browse files
Merge branch 'master' into open-file
2 parents 66cb6b7 + cf6f413 commit 597d5a5

File tree

17 files changed

+409
-509
lines changed

17 files changed

+409
-509
lines changed

android/pom.xml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
<groupId>commons-io</groupId>
2424
<artifactId>commons-io</artifactId>
2525
</exclusion>
26-
<exclusion> <!-- exclude bouncycastle from android -->
27-
<groupId>org.bouncycastle</groupId>
28-
<artifactId>bcprov-jdk18on</artifactId>
29-
</exclusion>
3026
</exclusions>
3127
</dependency>
3228
<dependency>
@@ -38,10 +34,6 @@
3834
<groupId>commons-io</groupId>
3935
<artifactId>commons-io</artifactId>
4036
</exclusion>
41-
<exclusion> <!-- exclude bouncycastle from android -->
42-
<groupId>org.bouncycastle</groupId>
43-
<artifactId>bcprov-jdk18on</artifactId>
44-
</exclusion>
4537
</exclusions>
4638
</dependency>
4739
<dependency>
@@ -66,14 +58,6 @@
6658
<artifactId>commons-io</artifactId>
6759
<version>2.2</version>
6860
</dependency>
69-
<!-- add explicit bouncycastle in Android, version used in Android Flexible client -->
70-
<!-- keep in sync version here and in Android Flexible client -->
71-
<dependency>
72-
<groupId>org.bouncycastle</groupId>
73-
<artifactId>bcprov-jdk15on</artifactId>
74-
<version>1.65</version>
75-
</dependency>
76-
7761
</dependencies>
7862

7963
<build>

android/src/main/java/com/genexus/internet/HttpContext.java

Lines changed: 2 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -11,50 +11,22 @@
1111

1212
import com.artech.base.services.AndroidContext;
1313
import com.genexus.util.Codecs;
14-
import com.genexus.util.Encryption;
1514

1615
import org.json.JSONArray;
1716
import org.json.JSONException;
1817
import org.json.JSONObject;
1918

2019
public abstract class HttpContext extends HttpAjaxContext implements IHttpContext
2120
{
22-
private static String GX_AJAX_REQUEST_HEADER = "GxAjaxRequest";
23-
2421
protected boolean PortletMode = false;
25-
protected boolean AjaxCallMode = false;
26-
protected boolean AjaxEventMode = false;
27-
protected boolean FullAjaxMode = false;
2822
public boolean drawingGrid = false;
2923

3024
public void setPortletMode()
3125
{ PortletMode = true; }
3226

33-
public void setAjaxCallMode()
34-
{ AjaxCallMode = true; }
35-
36-
public void setFullAjaxMode()
37-
{ FullAjaxMode = true; }
38-
39-
public void setAjaxEventMode()
40-
{ AjaxEventMode = true; }
41-
4227
public boolean isPortletMode()
4328
{ return PortletMode; }
4429

45-
public boolean isAjaxCallMode()
46-
{ return AjaxCallMode; }
47-
48-
public boolean isAjaxEventMode()
49-
{ return AjaxEventMode; }
50-
51-
public boolean isFullAjaxMode()
52-
{ return FullAjaxMode; }
53-
54-
public boolean isAjaxRequest()
55-
{ return isAjaxCallMode() || isAjaxEventMode() || isPortletMode() || isFullAjaxMode(); }
56-
57-
5830
public byte wbGlbDoneStart = 0;
5931
//nSOAPErr
6032
public HttpResponse GX_webresponse;
@@ -385,7 +357,7 @@ public void windowClosed()
385357

386358
public void pushCurrentUrl()
387359
{
388-
if (getRequestMethod().equals("GET") && !isAjaxRequest())
360+
if (getRequestMethod().equals("GET"))
389361
{
390362
String sUrl = getRequestNavUrl().trim();
391363
String topUrl = getNavigationHelper().peekUrl(sUrl);
@@ -409,106 +381,9 @@ public void printReportAtClient(String reportFile, String printerRule)
409381
{
410382
addPrintReportCommand(getResource(reportFile), printerRule);
411383
}
412-
413-
public boolean isGxAjaxRequest()
414-
{
415-
if (this.isMultipartContent())
416-
{
417-
return true;
418-
}
419-
// String gxHeader = getRequest().getHeader(GX_AJAX_REQUEST_HEADER);
420-
// if (gxHeader != null && gxHeader.trim().length() > 0)
421-
// {
422-
// return true;
423-
// }
424-
return false;
425-
}
426-
427-
private String getAjaxEncryptionKey()
428-
{
429-
if(getSessionValue(Encryption.AJAX_ENCRYPTION_KEY) == null)
430-
{
431-
if (!recoverEncryptionKey())
432-
{
433-
webPutSessionValue(Encryption.AJAX_ENCRYPTION_KEY, Encryption.getRijndaelKey());
434-
}
435-
}
436-
return (String)getSessionValue(Encryption.AJAX_ENCRYPTION_KEY);
437-
}
438-
439-
private boolean recoverEncryptionKey()
440-
{
441-
if (getSessionValue(Encryption.AJAX_ENCRYPTION_KEY) == null)
442-
{
443-
// String clientKey = getRequest().getHeader(Encryption.AJAX_SECURITY_TOKEN);
444-
// if (clientKey != null && clientKey.trim().length() > 0)
445-
// {
446-
// boolean candecrypt[]=new boolean[1];
447-
// clientKey = Encryption.decryptRijndael(clientKey, Encryption.GX_AJAX_PRIVATE_KEY, candecrypt);
448-
// if (candecrypt[0])
449-
// {
450-
// webPutSessionValue(Encryption.AJAX_ENCRYPTION_KEY, clientKey);
451-
// return true;
452-
// }else
453-
// {
454-
// return false;
455-
// }
456-
// }
457-
}
458-
return false;
459-
}
460-
461-
public String DecryptAjaxCall(String encrypted)
462-
{
463-
validEncryptedParm = false;
464-
if (isGxAjaxRequest())
465-
{
466-
String key = getAjaxEncryptionKey();
467-
boolean candecrypt[] = new boolean[1];
468-
String decrypted = Encryption.decryptRijndael(encrypted, key, candecrypt);
469-
validEncryptedParm = candecrypt[0];
470-
if (!validEncryptedParm)
471-
{
472-
sendResponseStatus(403, "Forbidden action");
473-
return "";
474-
}
475-
if (validEncryptedParm && !getRequestMethod().equalsIgnoreCase("post"))
476-
{
477-
setQueryString(decrypted);
478-
decrypted = GetNextPar();
479-
}
480-
return decrypted;
481-
}
482-
return encrypted;
483-
}
484-
485-
public boolean IsValidAjaxCall()
486-
{
487-
return IsValidAjaxCall(true);
488-
}
489-
490-
public boolean IsValidAjaxCall(boolean insideAjaxCall)
491-
{
492-
if (insideAjaxCall && !validEncryptedParm)
493-
{
494-
sendResponseStatus(403, "Forbidden action");
495-
return false;
496-
}
497-
else if (!insideAjaxCall && isGxAjaxRequest())
498-
{
499-
sendResponseStatus(440, "Session timeout");
500-
return false;
501-
}
502-
return true;
503-
}
504384

505385
public void sendResponseStatus(int statusCode, String statusDescription)
506386
{
507-
//getResponse().setStatus(statusCode);
508-
//try { getResponse().sendError(statusCode, statusDescription); }
509-
//catch(Exception e) {}
510-
//setAjaxCallMode();
511-
//disableOutput();
512387
}
513388

514389
private void sendReferer()
@@ -578,28 +453,11 @@ public String decrypt64(String value, String key)
578453
}
579454
return sRet;
580455
}
581-
582-
public void SendAjaxEncryptionKey()
583-
{
584-
if(!encryptionKeySended)
585-
{
586-
String key = getAjaxEncryptionKey();
587-
ajax_rsp_assign_hidden(Encryption.AJAX_ENCRYPTION_KEY, key);
588-
ajax_rsp_assign_hidden(Encryption.AJAX_ENCRYPTION_IV, Encryption.GX_AJAX_PRIVATE_IV);
589-
590-
try
591-
{
592-
ajax_rsp_assign_hidden(Encryption.AJAX_SECURITY_TOKEN, Encryption.encryptRijndael(key, Encryption.GX_AJAX_PRIVATE_KEY));
593-
}
594-
catch(Exception exc) {}
595-
encryptionKeySended = true;
596-
}
597-
}
598456

599457
public void SendServerCommands()
600458
{
601459
try {
602-
if (!isAjaxRequest() && commands.getCount() > 0)
460+
if (commands.getCount() > 0)
603461
{
604462
HiddenValues.put("GX_SRV_COMMANDS", commands.getJSONArray());
605463
}

common/src/main/java/com/genexus/CommonUtil.java

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
import java.math.BigDecimal;
1010
import java.io.*;
1111
import java.net.URLEncoder;
12-
import java.nio.file.Files;
13-
import java.nio.file.Path;
14-
import java.nio.file.Paths;
1512
import java.text.*;
1613
import java.util.*;
1714

@@ -179,62 +176,6 @@ public Object initialValue()
179176
throw new ExceptionInInitializerError("GXUtil static constructor error: " + e.getMessage());
180177
}
181178
}
182-
183-
public static String getContentType(String fileName) {
184-
Path path = Paths.get(fileName);
185-
String defaultContentType = "application/octet-stream";
186-
187-
try {
188-
String probedContentType = Files.probeContentType(path);
189-
if (probedContentType == null || probedContentType.equals(defaultContentType))
190-
return findContentTypeByExtension(fileName);
191-
return probedContentType;
192-
} catch (IOException ioe) {
193-
return findContentTypeByExtension(fileName);
194-
}
195-
}
196-
197-
private static String findContentTypeByExtension(String fileName) {
198-
String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
199-
String contentType = contentTypes.get(fileExtension);
200-
return contentType != null ? contentTypes.get(fileExtension) : "application/octet-stream";
201-
}
202-
203-
private static Map<String, String> contentTypes = new HashMap<String, String>() {{
204-
put("txt" , "text/plain");
205-
put("rtx" , "text/richtext");
206-
put("htm" , "text/html");
207-
put("html" , "text/html");
208-
put("xml" , "text/xml");
209-
put("aif" , "audio/x-aiff");
210-
put("au" , "audio/basic");
211-
put("wav" , "audio/wav");
212-
put("bmp" , "image/bmp");
213-
put("gif" , "image/gif");
214-
put("jpe" , "image/jpeg");
215-
put("jpeg" , "image/jpeg");
216-
put("jpg" , "image/jpeg");
217-
put("jfif" , "image/pjpeg");
218-
put("tif" , "image/tiff");
219-
put("tiff" , "image/tiff");
220-
put("png" , "image/x-png");
221-
put("3gp" , "video/3gpp");
222-
put("3g2" , "video/3gpp2");
223-
put("mpg" , "video/mpeg");
224-
put("mpeg" , "video/mpeg");
225-
put("mov" , "video/quicktime");
226-
put("qt" , "video/quicktime");
227-
put("avi" , "video/x-msvideo");
228-
put("exe" , "application/octet-stream");
229-
put("dll" , "application/x-msdownload");
230-
put("ps" , "application/postscript");
231-
put("pdf" , "application/pdf");
232-
put("svg" , "image/svg+xml");
233-
put("tgz" , "application/x-compressed");
234-
put("zip" , "application/x-zip-compressed");
235-
put("gz" , "application/x-gzip");
236-
put("json" , "application/json");
237-
}};
238179

239180
public static String removeAllQuotes(String fileName)
240181
{

common/src/main/java/com/genexus/URLRouter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private static String convertParmsToQueryString(boolean useNamedParameters, Stri
115115
for (int i = 0; i < parms.length; i++)
116116
{
117117
if (!useNamedParameters || parms.length != parmsName.length)
118-
queryString = queryString + parms[i] + ((i < parms.length -1)? "," : "");
118+
queryString = queryString + parms[i] + ((i < parms.length -1 || (i == parms.length -1 && parms[i].isEmpty()) ) ? "," : "");
119119
else
120120
queryString = queryString + parmsName[i] + "=" + parms[i] + ((i < parms.length -1)? "&" : "");
121121
}

0 commit comments

Comments
 (0)