Skip to content

Commit 610b00d

Browse files
committed
Issue-108639-WEB-request-tabId
1 parent ff52c89 commit 610b00d

File tree

3 files changed

+36
-9
lines changed

3 files changed

+36
-9
lines changed

common/src/main/java/com/genexus/internet/GXNavigationHelper.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public class GXNavigationHelper implements Serializable
1212
private static final long serialVersionUID = 2608956804836620190L;
1313

1414
public static String POPUP_LEVEL = "gxPopupLevel";
15+
public static String TAB_ID = "gxTabId";
16+
public static String TAB_ID_HEADER = "X-Gx-Tabid";
1517
public static String CALLED_AS_POPUP = "gxCalledAsPopup";
1618

1719
private Hashtable<String, Stack<String>> referers;
@@ -114,13 +116,12 @@ public void deleteStack(String popupLevel)
114116
referers.remove(popupLevel);
115117
}
116118

117-
public String getUrlPopupLevel(String url)
118-
{
119+
static public String getUrlComponent(String url, String key) {
119120
url = SpecificImplementation.GXutil.URLDecode(url);
120-
String popupLevel = "-1";
121+
String result = "";
121122
if (url != null)
122123
{
123-
int pIdx = url.indexOf(POPUP_LEVEL);
124+
int pIdx = url.indexOf(key);
124125
if (pIdx != -1)
125126
{
126127
int eqIdx = url.indexOf("=", pIdx);
@@ -131,16 +132,20 @@ public String getUrlPopupLevel(String url)
131132
{
132133
try
133134
{
134-
popupLevel = url.substring(eqIdx+1, cIdx);
135+
result = url.substring(eqIdx+1, cIdx);
135136
}
136137
catch(Exception e)
137138
{
138-
popupLevel = "-1";
139139
}
140140
}
141141
}
142142
}
143143
}
144-
return popupLevel;
144+
return result;
145+
}
146+
147+
public String getUrlPopupLevel(String url)
148+
{
149+
return getUrlComponent( url, POPUP_LEVEL);
145150
}
146151
}

java/src/main/java/com/genexus/internet/HttpRequest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public abstract class HttpRequest implements IHttpRequest
2121
private int errCode;
2222
private String errDescription;
2323
private String Referrer = "";
24+
private String tabId = "";
2425
protected HttpContext httpContext;
2526

2627
public HttpRequest(HttpContext httpContext)
@@ -259,4 +260,19 @@ public void setErrCode(int errCode){
259260
public void setErrDescription(String errDsc){
260261
this.errDescription = errDsc;
261262
}
263+
264+
public String getTabId()
265+
{
266+
String sUrl = httpContext.getRequestNavUrl().trim();
267+
268+
if ( tabId.isEmpty())
269+
{
270+
tabId = GXNavigationHelper.getUrlComponent(sUrl, GXNavigationHelper.TAB_ID);
271+
}
272+
if ( tabId.isEmpty())
273+
{
274+
tabId = getHeader(GXNavigationHelper.TAB_ID_HEADER);
275+
}
276+
return tabId;
277+
}
262278
}

java/src/main/java/com/genexus/webpanels/HttpContextWeb.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,9 +1062,10 @@ public void setQueryString(String qs) {
10621062
loadParameters(qs);
10631063
}
10641064

1065-
private String removeInternalParms(String query) {
1065+
private String removeInternalParm(String query, String parm)
1066+
{
10661067
query = removeEventPrefix(query);
1067-
int idx = query.indexOf(GXNavigationHelper.POPUP_LEVEL);
1068+
int idx = query.indexOf(parm);
10681069
if (idx == 1)
10691070
return "";
10701071
if (idx > 1)
@@ -1077,6 +1078,11 @@ private String removeInternalParms(String query) {
10771078
return query;
10781079
}
10791080

1081+
private String removeInternalParms(String query) {
1082+
query = removeInternalParm( query, GXNavigationHelper.POPUP_LEVEL);
1083+
return removeInternalParm( query, GXNavigationHelper.TAB_ID);
1084+
}
1085+
10801086
public String getQueryString() {
10811087
try {
10821088
String query = request.getQueryString();

0 commit comments

Comments
 (0)