Skip to content

Commit c0e7c2c

Browse files
committed
Added new getFormat() and getCount() protected methods to the ServiceRequest class
1 parent 34113fa commit c0e7c2c

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

src/javaxt/express/ServiceRequest.java

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,12 @@ public class ServiceRequest {
5656
Map.entry("limit", "limit"),
5757
Map.entry("offset", "offset"),
5858

59+
//Used by the list method in the WebService class
60+
Map.entry("format", "format"),
61+
Map.entry("count", "count"),
62+
5963
//Legacy - may be removed in the future
6064
Map.entry("filter", "filter"),
61-
Map.entry("count", "count"),
6265
Map.entry("where", "where"),
6366
Map.entry("page", "page")
6467
);
@@ -422,7 +425,9 @@ public void setParameter(String key, String val){
422425

423426
//Update offset and limit as needed
424427
String k = key.toLowerCase();
425-
if (k.equals("offset") || k.equals("limit") || k.equals("page")){
428+
if (k.equals(getKeyword("offset")) ||
429+
k.equals(getKeyword("limit")) ||
430+
k.equals(getKeyword("page"))){
426431
updateOffsetLimit();
427432
}
428433
}
@@ -501,6 +506,30 @@ public Long getLimit(){
501506
}
502507

503508

509+
//**************************************************************************
510+
//** getFormat
511+
//**************************************************************************
512+
/** Returns the value of the "format" parameter in the request.
513+
*/
514+
protected String getFormat(){
515+
String format = getParameter(getKeyword("format")).toString();
516+
if (format==null) return "";
517+
else return format.toLowerCase();
518+
}
519+
520+
521+
//**************************************************************************
522+
//** getCount
523+
//**************************************************************************
524+
/** Returns the value of the "count" parameter in the request.
525+
*/
526+
protected boolean getCount(){
527+
Boolean count = getParameter(getKeyword("count")).toBoolean();
528+
if (count==null) return false;
529+
else return count;
530+
}
531+
532+
504533
//**************************************************************************
505534
//** getRequest
506535
//**************************************************************************

0 commit comments

Comments
 (0)