Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 3236077

Browse files
committed
fix struts param issue
1 parent 8eb5a3d commit 3236077

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

src/java/main/com/topcoder/direct/services/view/action/ServiceBackendDataTablesAction.java

+18-13
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.apache.http.client.methods.HttpGet;
1717
import org.apache.http.client.utils.URIBuilder;
1818
import org.apache.http.impl.client.DefaultHttpClient;
19+
import org.apache.log4j.Logger;
1920
import org.apache.struts2.ServletActionContext;
2021
import org.codehaus.jackson.JsonNode;
2122
import org.codehaus.jackson.map.DeserializationConfig;
@@ -66,6 +67,10 @@
6667
* @version 1.2
6768
*/
6869
public abstract class ServiceBackendDataTablesAction extends AbstractAction {
70+
/**
71+
* Logger for this class
72+
*/
73+
private static final Logger logger = Logger.getLogger(ServiceBackendDataTablesAction.class);
6974

7075
/**
7176
* The display start in the request.
@@ -262,12 +267,12 @@ protected void setupFilterPanel() throws Exception {
262267
*/
263268
protected URI buildServiceEndPoint(Map<String, String> parameters) throws URISyntaxException {
264269

265-
int pageSize = getIDisplayLength() == -1 ? MAX_PAGINATION_SIZE : getIDisplayLength();
270+
int pageSize = getiDisplayLength() == -1 ? MAX_PAGINATION_SIZE : getiDisplayLength();
266271

267272

268273
URIBuilder builder = new URIBuilder();
269274
builder.setScheme("http").setHost(ServerConfiguration.DIRECT_API_SERVICE_ENDPOINT).setPath(getServiceURL())
270-
.setParameter("offset", String.valueOf(getIDisplayStart()))
275+
.setParameter("offset", String.valueOf(getiDisplayStart()))
271276
.setParameter("limit", String.valueOf(pageSize));
272277

273278
if (parameters != null) {
@@ -300,7 +305,7 @@ protected static String getErrorMessage(int httpStatusCode) {
300305
}
301306

302307
protected JsonNode getJsonResultFromAPI(URI apiEndPoint) throws Exception {
303-
308+
logger.debug("Get JSON result from API: " + apiEndPoint);
304309
DefaultHttpClient httpClient = new DefaultHttpClient();
305310
JsonNode jsonNode = null;
306311

@@ -345,7 +350,7 @@ protected JsonNode getJsonResultFromAPI(URI apiEndPoint) throws Exception {
345350
*
346351
* @return the displayStart.
347352
*/
348-
public int getIDisplayStart() {
353+
public int getiDisplayStart() {
349354
return iDisplayStart;
350355
}
351356

@@ -354,7 +359,7 @@ public int getIDisplayStart() {
354359
*
355360
* @param iDisplayStart the display start.
356361
*/
357-
public void setIDisplayStart(int iDisplayStart) {
362+
public void setiDisplayStart(int iDisplayStart) {
358363
this.iDisplayStart = iDisplayStart;
359364
}
360365

@@ -363,7 +368,7 @@ public void setIDisplayStart(int iDisplayStart) {
363368
*
364369
* @return the displayLength.
365370
*/
366-
public int getIDisplayLength() {
371+
public int getiDisplayLength() {
367372
return iDisplayLength;
368373
}
369374

@@ -372,7 +377,7 @@ public int getIDisplayLength() {
372377
*
373378
* @param iDisplayLength the displayLength.
374379
*/
375-
public void setIDisplayLength(int iDisplayLength) {
380+
public void setiDisplayLength(int iDisplayLength) {
376381
this.iDisplayLength = iDisplayLength;
377382
}
378383

@@ -381,7 +386,7 @@ public void setIDisplayLength(int iDisplayLength) {
381386
*
382387
* @return the sEcho.
383388
*/
384-
public String getSEcho() {
389+
public String getsEcho() {
385390
return sEcho;
386391
}
387392

@@ -390,7 +395,7 @@ public String getSEcho() {
390395
*
391396
* @param sEcho the sEcho.
392397
*/
393-
public void setSEcho(String sEcho) {
398+
public void setsEcho(String sEcho) {
394399
this.sEcho = sEcho;
395400
}
396401

@@ -417,7 +422,7 @@ public void setServiceURL(String serviceURL) {
417422
*
418423
* @return the sort column index.
419424
*/
420-
public int getISortCol_0() {
425+
public int getiSortCol_0() {
421426
return iSortCol_0;
422427
}
423428

@@ -426,7 +431,7 @@ public int getISortCol_0() {
426431
*
427432
* @param iSortCol_0 the sort column index.
428433
*/
429-
public void setISortCol_0(int iSortCol_0) {
434+
public void setiSortCol_0(int iSortCol_0) {
430435
this.iSortCol_0 = iSortCol_0;
431436
}
432437

@@ -435,7 +440,7 @@ public void setISortCol_0(int iSortCol_0) {
435440
*
436441
* @return the sort order.
437442
*/
438-
public String getSSortDir_0() {
443+
public String getsSortDir_0() {
439444
return sSortDir_0;
440445
}
441446

@@ -444,7 +449,7 @@ public String getSSortDir_0() {
444449
*
445450
* @param sSortDir_0 the sort order.
446451
*/
447-
public void setSSortDir_0(String sSortDir_0) {
452+
public void setsSortDir_0(String sSortDir_0) {
448453
this.sSortDir_0 = sSortDir_0;
449454
}
450455

src/java/main/com/topcoder/direct/services/view/action/my/MyChallengesAction.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ public String getMyChallenges() {
9393

9494
String sortColumn = "id";
9595
String sortOrder = " desc null last";
96-
if (getISortCol_0() >= 0 && getSSortDir_0() != null && getSSortDir_0().trim().length() > 0) {
96+
if (getiSortCol_0() >= 0 && getsSortDir_0() != null && getsSortDir_0().trim().length() > 0) {
9797
// there is sorting parameters
98-
sortColumn = SORTING_MAP.containsKey(getISortCol_0()) ? SORTING_MAP.get(getISortCol_0()) : "id";
99-
if (getSSortDir_0().trim().equalsIgnoreCase("asc")) {
98+
sortColumn = SORTING_MAP.containsKey(getiSortCol_0()) ? SORTING_MAP.get(getiSortCol_0()) : "id";
99+
if (getsSortDir_0().trim().equalsIgnoreCase("asc")) {
100100
sortOrder = " asc null first";
101101
}
102102
}
@@ -122,7 +122,7 @@ public String getMyChallenges() {
122122
// no filtering - It should be the same as iTotalRecords
123123
result.put("iTotalDisplayRecords", restResult.getMetadata().getTotalCount());
124124

125-
result.put("sEcho", getSEcho());
125+
result.put("sEcho", getsEcho());
126126

127127
List<List<String>> challengesData = new ArrayList<List<String>>();
128128

src/java/main/com/topcoder/direct/services/view/action/my/MyCreatedChallengesAction.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ public String getMyCreatedChallenges() {
102102

103103
String sortColumn = "id";
104104
String sortOrder = " desc null last";
105-
if (getISortCol_0() >= 0 && getSSortDir_0() != null && getSSortDir_0().trim().length() > 0) {
105+
if (getiSortCol_0() >= 0 && getsSortDir_0() != null && getsSortDir_0().trim().length() > 0) {
106106
// there is sorting parameters
107-
sortColumn = SORTING_MAP.containsKey(getISortCol_0()) ? SORTING_MAP.get(getISortCol_0()) : "id";
108-
if (getSSortDir_0().trim().equalsIgnoreCase("asc")) {
107+
sortColumn = SORTING_MAP.containsKey(getiSortCol_0()) ? SORTING_MAP.get(getiSortCol_0()) : "id";
108+
if (getsSortDir_0().trim().equalsIgnoreCase("asc")) {
109109
sortOrder = " asc null first";
110110
}
111111
}
@@ -134,7 +134,7 @@ public String getMyCreatedChallenges() {
134134
// no filtering - It should be the same as iTotalRecords
135135
result.put("iTotalDisplayRecords", restResult.getMetadata().getTotalCount());
136136

137-
result.put("sEcho", getSEcho());
137+
result.put("sEcho", getsEcho());
138138

139139
List<List<String>> challengesData = new ArrayList<List<String>>();
140140
challengeDateFormat.setTimeZone(TimeZone.getTimeZone(TIMEZONE));

0 commit comments

Comments
 (0)