<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Shephertz Community - Recent questions in Java</title>
<link>http://forum.shephertz.com/?qa=questions/products/app42-cloud-api-baas/java</link>
<description>Powered by Question2Answer</description>
<item>
<title>'peer not authenticated' exception?</title>
<link>http://forum.shephertz.com/?qa=11411/peer-not-authenticated-exception</link>
<description>&lt;p&gt;
	This is the first time I am using app42. I have downloaded java SDK and opened through STS(IDE). Replaced the keys in UserServiceSample&amp;nbsp;(from com.shephertz.app42.sdk.test) with mine and I&amp;nbsp;debugged it as a java application then I came up with &quot;&amp;nbsp;&lt;strong&gt;com.shephertz.app42.paas.sdk.java.App42Exception: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated&lt;/strong&gt; &quot; Can anyone help me on this, please.&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=11411/peer-not-authenticated-exception</guid>
<pubDate>Thu, 21 Feb 2019 06:51:06 +0000</pubDate>
</item>
<item>
<title>Logging storage size</title>
<link>http://forum.shephertz.com/?qa=11257/logging-storage-size</link>
<description>How big is the logging storage? And what will happen if I exceed the limit? And is there a way to dynamically delete logs?</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=11257/logging-storage-size</guid>
<pubDate>Mon, 06 Aug 2018 22:49:30 +0000</pubDate>
</item>
<item>
<title>Why does leaderboard only save increasing scores??</title>
<link>http://forum.shephertz.com/?qa=11231/why-does-leaderboard-only-save-increasing-scores</link>
<description>&lt;p&gt;
	I use&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;span style=&quot;caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Menlo; font-size: 9pt;&quot;&gt;scoreBoardService.addJSONObject(&lt;/span&gt;&lt;span style=&quot;caret-color: rgb(0, 0, 0); font-family: Menlo; font-size: 9pt; color: rgb(102, 14, 122); font-weight: bold;&quot;&gt;leaderBoardCollection&lt;/span&gt;&lt;span style=&quot;caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Menlo; font-size: 9pt;&quot;&gt;, jsonDoc);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;span style=&quot;font-size: 9pt; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Menlo;&quot;&gt;scoreBoardService.saveUserScore(&lt;/span&gt;&lt;span style=&quot;font-size: 9pt; caret-color: rgb(0, 0, 0); font-family: Menlo; color: rgb(102, 14, 122); font-weight: bold;&quot;&gt;gameName&lt;/span&gt;&lt;span style=&quot;font-size: 9pt; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Menlo;&quot;&gt;,userName,gameScore);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	to update the score of a user, but if the users game score decreases the new score value is not stored in the leaderboard, the old (bigger) score remains. What is the reason for this behavior? I use ELO as scores.&lt;/p&gt;
&lt;p&gt;
	Strange is that I get a success callback.&lt;/p&gt;
&lt;p&gt;
	onSuccess: {&quot;app42&quot;:{&quot;response&quot;:{&quot;success&quot;:true,&quot;games&quot;:{&quot;game&quot;:{&quot;name&quot;:&quot;xxxx&quot;,&quot;scores&quot;:{&quot;score&quot;:{&quot;userName&quot;:&quot;debug1&quot;,&quot;value&quot;:986,&quot;createdOn&quot;:&quot;2018-07-23T00:02:59.661Z&quot;,&quot;scoreId&quot;:&quot;_v3NLPf3WvvvNMuof5c0phreZ56wM=&quot;,&quot;jsonDoc&quot;:{&quot;statData&quot;:&quot;{name:Desktop,rank:1,elo:986,playedGames:4,wonGames:1}&quot;,&quot;_id&quot;:{&quot;$oid&quot;:&quot;5b551b33e4b03d3f87a8b930&quot;},&quot;_$scoreId&quot;:&quot;_v3NLPf3WvvvNMuof5c0phreZ56wM=&quot;,&quot;name&quot;:&quot;Desktop&quot;,&quot;_$owner&quot;:{&quot;owner&quot;:&quot;debug1&quot;},&quot;_$createdAt&quot;:&quot;2018-07-23T00:02:59.667Z&quot;,&quot;&lt;/p&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=11231/why-does-leaderboard-only-save-increasing-scores</guid>
<pubDate>Sun, 22 Jul 2018 22:50:33 +0000</pubDate>
</item>
<item>
<title>How to remove apps in my account ?</title>
<link>http://forum.shephertz.com/?qa=11194/how-to-remove-apps-in-my-account</link>
<description>I am currently having 2 apps in my dashboard, I want to remove one but I can't find any buttons to do this.

So how can I remove one of my apps from my account ?</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=11194/how-to-remove-apps-in-my-account</guid>
<pubDate>Tue, 26 Jun 2018 03:32:40 +0000</pubDate>
</item>
<item>
<title>getTopNRankers is not working right ?</title>
<link>http://forum.shephertz.com/?qa=11183/gettopnrankers-is-not-working-right</link>
<description>&lt;p&gt;
	Hello shephertz expert,&lt;/p&gt;
&lt;p&gt;
	I am trying to implement a top ranking event, the issue is when I try to test a demo how to use function &lt;strong&gt;&lt;span&gt;getTopNRankers&lt;/span&gt;&lt;/strong&gt; in Java.&lt;/p&gt;
&lt;p&gt;
	For example, I start an event in 30 seconds (just for testing) with&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		start time : Tue Jun 19 09:&lt;strong&gt;54&lt;/strong&gt;:&lt;strong&gt;32&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;
		end time : Tue Jun 19 09:&lt;strong&gt;55&lt;/strong&gt;:&lt;strong&gt;02&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	then I save a user &lt;strong&gt;Apple&lt;/strong&gt; score at the time Tue Jun 19 09:&lt;strong&gt;54&lt;/strong&gt;:&lt;strong&gt;45. &lt;/strong&gt;In theory, when I implement &lt;strong&gt;&lt;span&gt;getTopNRankers &lt;/span&gt;&lt;/strong&gt;&lt;span&gt;it must return user &lt;strong&gt;Apple, &lt;/strong&gt;however it returned nothing (data doesn't exist ) &lt;span&gt;in my demo.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
	Please let me know if I was wrong at somewhere else ?&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	Thanks,&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=11183/gettopnrankers-is-not-working-right</guid>
<pubDate>Tue, 19 Jun 2018 10:09:21 +0000</pubDate>
</item>
<item>
<title>get top N rankings + their additional data</title>
<link>http://forum.shephertz.com/?qa=11149/get-top-n-rankings-their-additional-data</link>
<description>&lt;p&gt;
	How can I fetch all N top rankings plus their additinal data?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	For every user my leaderboard should include the following information :&lt;/p&gt;
&lt;p&gt;
	UserName; DisplayName; Age; Score;&lt;/p&gt;
&lt;p&gt;
	for example:&lt;/p&gt;
&lt;p&gt;
	wieuzwquehqwuzegh; Nick; 28; 10023&lt;/p&gt;
&lt;p&gt;
	I want to get all the top 100 Players and their information in a hopefully simple api-call,&amp;nbsp;should be a basic usecase.&lt;/p&gt;
&lt;p&gt;
	Thank you&lt;/p&gt;
&lt;ol class=&quot;dp-j&quot; style=&quot;padding-right: 0px; padding-left: 0px; border: none; list-style-position: initial; list-style-image: initial; color: rgb(92, 92, 92); font-family: droid_sansregular; font-size: 13px; margin: 0px 0px 1px !important;&quot;&gt;
&lt;/ol&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=11149/get-top-n-rankings-their-additional-data</guid>
<pubDate>Mon, 11 Jun 2018 21:46:30 +0000</pubDate>
</item>
<item>
<title>Override certain API calls on server-side</title>
<link>http://forum.shephertz.com/?qa=11067/override-certain-api-calls-on-server-side</link>
<description>I would like to override certain API calls, such as UpdateRoomProperties or SendUpdate, and possibly others, so that I can manage some of the game process on the server.  It's unclear to me if I can just upload some override code, or if I need to create an appwarp server instance (and run it myself) and customize it, or...?</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=11067/override-certain-api-calls-on-server-side</guid>
<pubDate>Mon, 16 Apr 2018 23:15:59 +0000</pubDate>
</item>
<item>
<title>[CRITICAL SDK BUG] App42 J2ME 2.1 Returning &quot;0&quot; errorcode with Null exception message</title>
<link>http://forum.shephertz.com/?qa=10993/critical-app42-j2me-returning-errorcode-exception-message</link>
<description>&lt;p&gt;
	&lt;span style=&quot;font-family: arial, sans-serif; font-size: small;&quot;&gt;I have started using App42 J2ME SDK 2.1 for my mobile game using Libgdx, and for the IOS part, I am using the J2ME SDK.&lt;/span&gt;&lt;/p&gt;
&lt;div style=&quot;font-family: arial, sans-serif; font-size: small;&quot;&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial, sans-serif; font-size: small;&quot;&gt;
	The problem is, when I try to register or login a user using UserService, it returns error codes &quot;0&quot; for both http and app errorcodes and the exception message is Null. For the Android and Desktop versions which are using the Android&amp;nbsp; SDK and Java SDK, it works fine.&lt;/div&gt;
&lt;div style=&quot;font-family: arial, sans-serif; font-size: small;&quot;&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial, sans-serif; font-size: small;&quot;&gt;
	I tried Java SDK instead of J2ME SDK for the IOS part, but it did not work and&amp;nbsp; I got the same error as this post (&lt;a href=&quot;http://forum.shephertz.com/?qa=4921/leaderboards-with-libgdx-robovm)&quot; rel=&quot;nofollow&quot;&gt;http://forum.shephertz.com/?qa=4921/leaderboards-with-libgdx-robovm)&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial, sans-serif; font-size: small;&quot;&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial, sans-serif; font-size: small;&quot;&gt;
	Many Thanks in advance.&lt;/div&gt;
&lt;div style=&quot;font-family: arial, sans-serif; font-size: small;&quot;&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial, sans-serif; font-size: small;&quot;&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial, sans-serif; font-size: small;&quot;&gt;
	P.S.&lt;/div&gt;
&lt;div style=&quot;font-family: arial, sans-serif; font-size: small;&quot;&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial, sans-serif; font-size: small;&quot;&gt;
	Here is the App42Log for the failure with J2ME: (censored some private information)&lt;/div&gt;
&lt;div style=&quot;font-family: arial, sans-serif; font-size: small;&quot;&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial, sans-serif; font-size: small;&quot;&gt;
	&lt;div&gt;
		UTC Date : 2018-02-26T05:52:11.711Z&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;Json String : {&quot;app42&quot;:{&quot;user&quot;:{&quot;password&quot;:&quot;xxxxxx&quot;,&quot;userName&quot;:&quot;sim&quot;}}}&lt;/div&gt;
	&lt;div&gt;
		mac alg: SHA-1/HMAC&lt;/div&gt;
	&lt;div&gt;
		dig alg: SHA-1&lt;/div&gt;
	&lt;div&gt;
		key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;/div&gt;
	&lt;div&gt;
		message: apiKeyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbody{&quot;app42&quot;:{&quot;user&quot;:{&quot;password&quot;:&quot;xxxxxx&quot;,&quot;userName&quot;:&quot;sim&quot;}}}timeStamp2018-02-26T05:52:11.711Zversion1.0&lt;/div&gt;
	&lt;div&gt;
		unencoded: ��c$�Yj2xܐ�ɖ'�&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;F&lt;/div&gt;
	&lt;div&gt;
		sig: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;Setting value :version : 1.0&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;QueryString is ?version=1.0&amp;amp;&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;Requested URL is &lt;a href=&quot;https://api.shephertz.com/cloud/1.0/user/authenticate?version=1.0&amp;amp;&quot; rel=&quot;nofollow&quot;&gt;https://api.shephertz.com/cloud/1.0/user/authenticate?version=1.0&amp;amp;&lt;/a&gt;&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;QueryString is ?version=1.0&amp;amp;&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;Requested URL is &lt;a href=&quot;https://api.shephertz.com/cloud/1.0/user/authenticate?version=1.0&amp;amp;&quot; rel=&quot;nofollow&quot;&gt;https://api.shephertz.com/cloud/1.0/user/authenticate?version=1.0&amp;amp;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=10993/critical-app42-j2me-returning-errorcode-exception-message</guid>
<pubDate>Mon, 26 Feb 2018 06:08:19 +0000</pubDate>
</item>
<item>
<title>Json Storage does not allow null</title>
<link>http://forum.shephertz.com/?qa=10826/json-storage-does-not-allow-null</link>
<description>&lt;div&gt;
	When storing any document which contains nulls using the StorageService the server returns the error code 500 and an error that the json string was invalid.&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	This behaviour should be possible, as stated on Json.org &quot;A value can be a string in double quotes, or a number, or true or false or null, or an object or an array. These structures can be nested.&quot;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	An example of a json document with nulls would be:&lt;/div&gt;
&lt;div&gt;
	&lt;pre class=&quot;brush:java;&quot;&gt;
{
    &quot;requiredField&quot;:&quot;Some value must be here&quot;,
    &quot;someOptionalField&quot;:null
}&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
	Or in an array:&lt;/div&gt;
&lt;div&gt;
	&lt;pre class=&quot;brush:java;&quot;&gt;
{
    &quot;sampleArray&quot;:[&quot;test&quot;,null,&quot;hello&quot;,&quot;world&quot;,null]
}&lt;/pre&gt;
	&lt;p&gt;
		&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;
	The problem occurs when trying to insert a document or update/save it when it has any &lt;span style=&quot;font-family:courier new,courier,monospace;&quot;&gt;JSONObject.NULL&lt;/span&gt; value stored.&lt;/div&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=10826/json-storage-does-not-allow-null</guid>
<pubDate>Thu, 23 Nov 2017 16:49:53 +0000</pubDate>
</item>
<item>
<title>How to receive an image on the custom code server</title>
<link>http://forum.shephertz.com/?qa=10804/how-to-receive-an-image-on-the-custom-code-server</link>
<description>I want to send an image to the custom code for the purpose of doing specific rendering on this image. To send the image it is possible to use the upload service, right? But how can I get this image in my server code? What function can I call to receive this image file?</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=10804/how-to-receive-an-image-on-the-custom-code-server</guid>
<pubDate>Fri, 27 Oct 2017 05:11:40 +0000</pubDate>
</item>
<item>
<title>Can custom code support some java.io package classes?</title>
<link>http://forum.shephertz.com/?qa=10802/can-custom-code-support-some-java-io-package-classes</link>
<description>I have seen that there are some restrictions for using some Java APIs such as System, File and ByteCode. Can custom code support some java.io package classes?
And how could I get around this problem with these APIs that are not supported?</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=10802/can-custom-code-support-some-java-io-package-classes</guid>
<pubDate>Wed, 25 Oct 2017 20:36:49 +0000</pubDate>
</item>
<item>
<title>Email can be sent from AppHQ Console but not from API</title>
<link>http://forum.shephertz.com/?qa=10728/email-can-be-sent-from-apphq-console-but-not-from-api</link>
<description>&lt;p&gt;
	&lt;span style=&quot;font-size:14px;&quot;&gt;I have an email configuration setup for the mail &quot;&lt;strong&gt;noreply@12b3.games&lt;/strong&gt;&quot;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;span style=&quot;font-size:14px;&quot;&gt;I tried the following things to send an email with it:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		&lt;span style=&quot;font-size:14px;&quot;&gt;Send an email using the AppHQ Console (Worked)&lt;/span&gt;&lt;/li&gt;
	&lt;li&gt;
		&lt;span style=&quot;font-size:14px;&quot;&gt;Send an email using custom code (Returns a successful response, but I dont receive any mail)&lt;/span&gt;&lt;/li&gt;
	&lt;li&gt;
		&lt;span style=&quot;font-size:14px;&quot;&gt;Send an email using client-side App42 API (Also returns successful response, but no mail is received)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&lt;span style=&quot;font-size: 14px;&quot;&gt;Could it be an error from the API I am using or could it be a lingering issue of the .games top-level-domain?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;span style=&quot;font-size: 14px;&quot;&gt;I do the following to send the mail from code:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
	&lt;pre class=&quot;brush:java;&quot;&gt;
ServiceAPI serviceApi = new ServiceAPI(&amp;lt;API_KEY&amp;gt;, &amp;lt;SECRET_KEY&amp;gt;);
EmailService emailService = serviceApi.buildEmailService();
emailService.sendMail(&quot;redmatters@live.at&quot;, &quot;Test Mail&quot;, &quot;Hello, this is a test!&quot;, &quot;noreply@12b3.games&quot;, EmailMIME.PLAIN_TEXT_MIME_TYPE);&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
	As stated before, the above snippet returns a successful response without any errors.&lt;/p&gt;
&lt;p&gt;
	&lt;span style=&quot;font-size:14px;&quot;&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: Helvetica, Arial, Sens-serif; background-color: rgb(250, 250, 250);&quot;&gt;My Application name is &quot;EndCycleOnline&quot;, I added the shephertz team as a collaborator.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=10728/email-can-be-sent-from-apphq-console-but-not-from-api</guid>
<pubDate>Mon, 04 Sep 2017 08:45:33 +0000</pubDate>
</item>
<item>
<title>Send Push Fail depends on text</title>
<link>http://forum.shephertz.com/?qa=10699/send-push-fail-depends-on-text</link>
<description>&lt;p&gt;
	Hello,&lt;/p&gt;
&lt;p&gt;
	I develop a program to send push notification in Java, but I have a problem if I send this text &quot;Questa è una prova&quot; notification start correctly.&lt;/p&gt;
&lt;p&gt;
	If I send the text &quot;Questa è una prova&quot; I get an exception : {&quot;app42Fault&quot;:{&quot;httpErrorCode&quot;:401,&quot;appErrorCode&quot;:1401,&quot;message&quot;:&quot;UnAuthorized Access&quot;,&quot;details&quot;:&quot;Client is not authorized&quot;}}&lt;/p&gt;
&lt;p&gt;
	I make a lot of test and if i write chararacts like &quot;è,ì,à&quot; in the message text I get the excption Client is not authorized, but this only with java, with PHP all work fine.&lt;/p&gt;
&lt;p&gt;
	This is the code:&lt;/p&gt;
&lt;pre class=&quot;brush:java;&quot;&gt;
//userList is a ArrayList of String
//msgJS is the text of message like {&quot;idmsg&quot;:&quot;11253&quot;,&quot;badge&quot;:1,&quot;alert&quot;:&quot;Questa è una prova&quot;,&quot;sound&quot;:&quot;default&quot;,&quot;sendingFrom&quot;:&quot;serverSide&quot;,&quot;title&quot;:&quot;OpenDartFics&quot;}

PushNotificationService pushService = App42API.buildPushNotificationService();
HashMap&amp;lt;String, String&amp;gt; otherMetaHeaders = new HashMap&amp;lt;&amp;gt;();  
otherMetaHeaders.put(&quot;dataEncoding&quot;, &quot;true&quot;);  
pushService.setOtherMetaHeaders(otherMetaHeaders);  
pushService.sendPushMessageToGroup(msgJS, userList);&lt;/pre&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=10699/send-push-fail-depends-on-text</guid>
<pubDate>Fri, 25 Aug 2017 14:51:18 +0000</pubDate>
</item>
<item>
<title>Custom Code compile exception</title>
<link>http://forum.shephertz.com/?qa=10653/custom-code-compile-exception</link>
<description>&lt;p&gt;
	Hi,&lt;/p&gt;
&lt;p&gt;
	I've downloaded the custom code sample and imported it into Eclipse.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	Since the code may not have copiled with Java 8, I also added the 7 JDK and selected it as my default java version.&lt;/p&gt;
&lt;p&gt;
	Now the issue is when I try to compile and run the sample code (no additions done), I get the error &quot;Exception in thread &quot;main&quot; java.lang.Exception: Please provide required arguments...apikey, secretkey, name, action at com.myapp.helper.AntHelper.main(AntHelper.java:27)&quot;&lt;/p&gt;
&lt;p&gt;
	All these parameters exist in the build.proprties file, so why does it still not compile? Is it the Java version?&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=10653/custom-code-compile-exception</guid>
<pubDate>Fri, 21 Jul 2017 18:33:27 +0000</pubDate>
</item>
<item>
<title>How to set Game leaderboard score to zero for each user using cutom code?</title>
<link>http://forum.shephertz.com/?qa=10593/how-set-game-leaderboard-score-zero-each-user-using-cutom-code</link>
<description>ScoreBoardService scoreBoardService = sp.buildScoreBoardService();
        GameService gameService = sp.buildGameService();   
        ArrayList games = gameService.getAllGames();
        for(int i=0;i&amp;lt;games.size();i++)  
        {  
            Game game = games.get(i);
            for(int j = 0;j&amp;lt;game.getScoreList().size();j++)  
            {
                String userName = game.getScoreList().get(j).getUserName();
                scoreBoardService.saveUserScore(game.getName(),userName,0);  
            }
        }</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=10593/how-set-game-leaderboard-score-zero-each-user-using-cutom-code</guid>
<pubDate>Mon, 03 Jul 2017 14:39:35 +0000</pubDate>
</item>
<item>
<title>SendPushToUser Client not authorized</title>
<link>http://forum.shephertz.com/?qa=10442/sendpushtouser-client-not-authorized</link>
<description>&lt;p&gt;
	Hello,&lt;/p&gt;
&lt;p&gt;
	I write a servlet to send push when requested.&lt;/p&gt;
&lt;p&gt;
	I use this code :&lt;/p&gt;
&lt;pre class=&quot;brush:java;&quot;&gt;
            App42API.initialize(ConfigValues.APP42_API, ConfigValues.APP42_KEY);            
            App42API.setLoggedInUser(&quot;XXX&quot;);
            PushNotificationService pushService = App42API.buildPushNotificationService();
            LogService lgs = App42API.buildLogService();
            lgs.debug(&quot;Start sending Message to user :&quot; + user, &quot;PushServlet&quot;);
            PushNotification pushNotificationObj = pushService.sendPushMessageToUser(user, msg);&lt;/pre&gt;
&lt;p&gt;
	But I ALWAY RECEIVE the error&lt;/p&gt;
&lt;p&gt;
	{&quot;app42Fault&quot;:{&quot;httpErrorCode&quot;:401,&quot;appErrorCode&quot;:1401,&quot;message&quot;:&quot;UnAuthorized Access&quot;,&quot;details&quot;:&quot;Client is not authorized&quot;}}&lt;/p&gt;
&lt;p&gt;
	What is Wrong ?&lt;/p&gt;
&lt;p&gt;
	The Api and key are constant and I use it and the user autentication and work.&lt;/p&gt;
&lt;p&gt;
	I need to wait after APP42Api.Initialize ?&lt;/p&gt;
&lt;p&gt;
	I Disable the &quot;Replay Attack&quot; for prevent time errors but never change, alway get the same error.&lt;/p&gt;
&lt;p&gt;
	I see you examples but look like this.&lt;/p&gt;
&lt;p&gt;
	Can you help me ?&lt;/p&gt;
&lt;p&gt;
	Best regards&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=10442/sendpushtouser-client-not-authorized</guid>
<pubDate>Wed, 26 Apr 2017 16:48:15 +0000</pubDate>
</item>
<item>
<title>Issue with http utils classes in android</title>
<link>http://forum.shephertz.com/?qa=10227/issue-with-http-utils-classes-in-android</link>
<description>&lt;p&gt;
	I am having difficulty http utils classes when I am running my app on android phone. I guess it must be encountered by many prople who are using app42 for android. Any help on how to overcome this issue will be much appreciated.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;span style=&quot;color: rgb(51, 51, 51); font-family: Helvetica, Arial, Sens-serif; background-color: rgb(250, 250, 250);&quot;&gt;java.lang.NoSuchMethodError: No static method consume(Lorg/apache/http/HttpEntity;)V in class Lorg/apache/http/util/EntityUtils; or its super classes (declaration of 'org.apache.http.util.EntityUtils' appears in /system/framework/org.apache.http.legacy.boot.jar)&lt;/span&gt;&lt;br style=&quot;color: rgb(51, 51, 51); font-family: Helvetica, Arial, Sens-serif; background-color: rgb(250, 250, 250);&quot;&gt;
	&lt;span style=&quot;color: rgb(51, 51, 51); font-family: Helvetica, Arial, Sens-serif; background-color: rgb(250, 250, 250);&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;at com.shephertz.app42.paas.sdk.java.connection.RESTConnectorAsync.executePost(RESTConnectorAsync.java:134)&lt;/span&gt;&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=10227/issue-with-http-utils-classes-in-android</guid>
<pubDate>Tue, 21 Feb 2017 11:23:25 +0000</pubDate>
</item>
<item>
<title>Custom Code Execution Error</title>
<link>http://forum.shephertz.com/?qa=9895/custom-code-execution-error</link>
<description>Hi, Is there any recent changes on the custom code API? My custom codes are not working which had been OK until a few days ago. Is there any recent SDK upgrade, etc?&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
On local tests, code executes OK with no problem but if I upload it to apphq and run it, I am getting &amp;quot;Something went wrong&amp;quot; error. Also in client side I get &amp;quot;Error:0 Unexpected end of input&amp;quot; problem.</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=9895/custom-code-execution-error</guid>
<pubDate>Thu, 24 Nov 2016 23:22:09 +0000</pubDate>
</item>
<item>
<title>CustomCode Owner Of the Inserted JSON</title>
<link>http://forum.shephertz.com/?qa=9806/customcode-owner-of-the-inserted-json</link>
<description>Hi,

When I insert a json on customCode service running on cloud, everything works OK except ownerID seems null on dashboard. How can I change ownerID of the JSON object inserted? In client side, it can be done via App42.setLoggedInUser(userName), but customCodeService doesnt allow that.

Thanks</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=9806/customcode-owner-of-the-inserted-json</guid>
<pubDate>Mon, 24 Oct 2016 12:58:32 +0000</pubDate>
</item>
<item>
<title>Rename a collection</title>
<link>http://forum.shephertz.com/?qa=9558/rename-a-collection</link>
<description>Hello,

 

Is there a way to rename a collection since I have many data in it and I dont want to lose them by deleting and adding?

 

Thanks</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=9558/rename-a-collection</guid>
<pubDate>Mon, 05 Sep 2016 06:14:38 +0000</pubDate>
</item>
<item>
<title>Inserting Json to collection is successfull but it is still empty in the dashboard</title>
<link>http://forum.shephertz.com/?qa=9556/inserting-json-collection-successfull-still-empty-dashboard</link>
<description>&lt;p&gt;
	Hello,&lt;/p&gt;
&lt;p&gt;
	I am trying to populate a storage through Java. I can update and do all that no issues.&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	However When I tried to add new docs to new storage, the output shows that everything is succesfull. Even when &amp;nbsp;I fetch all documents, it get returned. But if I fetch by key or I even view in the dashboard, it is empyt Collection. Infact, when I delete that specific collection from the dashboard it stays visible in the list and empty.&lt;/p&gt;
&lt;blockquote&gt;
	&lt;div&gt;
		StorageService storageService = serviceAPI.buildStorageService(); &amp;nbsp;&lt;/div&gt;
	&lt;div&gt;
		for(int i =1; i &amp;lt;= 10; i++){&lt;/div&gt;
	&lt;div&gt;
		JSONObject jsonDoc = new JSONObject();&lt;/div&gt;
	&lt;div&gt;
		JSONArray jsonArr = new JSONArray(); // empty array&lt;/div&gt;
	&lt;div&gt;
		String teamName = &quot;Team&quot;+i;&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;try {&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;jsonDoc.put(&quot;TeamName&quot;, teamName);&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;jsonDoc.put(&quot;Members&quot;, jsonArr);&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	&lt;div&gt;
		} catch (JSONException e) {&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	&lt;div&gt;
		e.printStackTrace();&lt;/div&gt;
	&lt;div&gt;
		continue;&lt;/div&gt;
	&lt;div&gt;
		}&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	&lt;div&gt;
		Storage storage = storageService.insertJSONDocument(dbName, collectionName_teams, jsonDoc);&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	&lt;div&gt;
		System.out.println(&quot;dbName is &quot; + storage.getDbName());&lt;/div&gt;
	&lt;div&gt;
		System.out.println(&quot;collection Name is &quot; + storage.getCollectionName());&lt;/div&gt;
	&lt;div&gt;
		ArrayList&amp;lt;Storage.JSONDocument&amp;gt; jsonDocList = storage.getJsonDocList();&lt;/div&gt;
	&lt;div&gt;
		for (int j = 0; j &amp;lt; jsonDocList.size(); j++) {&lt;/div&gt;
	&lt;div&gt;
		System.out.println(&quot;objectId is &quot; + jsonDocList.get(j).getDocId());&lt;/div&gt;
	&lt;div&gt;
		System.out.println(&quot;CreatedAt is &quot; + jsonDocList.get(j).getCreatedAt());&lt;/div&gt;
	&lt;div&gt;
		System.out.println(&quot;UpdatedAtis &quot; + jsonDocList.get(j).getUpdatedAt());&lt;/div&gt;
	&lt;div&gt;
		System.out.println(&quot;Jsondoc is &quot; + jsonDocList.get(j).getJsonDoc());&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	&lt;div&gt;
		}&lt;/div&gt;
	&lt;div&gt;
		}&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;
	What could be wrong here? I can email you specific details if needed&lt;/p&gt;
&lt;p&gt;
	Thanks&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=9556/inserting-json-collection-successfull-still-empty-dashboard</guid>
<pubDate>Mon, 05 Sep 2016 05:01:31 +0000</pubDate>
</item>
<item>
<title>&quot;deletePermanent&quot; doesn't delete the user permanently</title>
<link>http://forum.shephertz.com/?qa=9484/deletepermanent-doesnt-delete-the-user-permanently</link>
<description>&lt;p&gt;
	Hi,&lt;/p&gt;
&lt;p&gt;
	Even after providing &quot;deletePermanent&quot; flag &quot;true&quot; in other metadata headers, the user is not getting deleting user permanently. It is only doing a Soft delete.&lt;/p&gt;
&lt;p&gt;
	I am referring to the documentation here -&amp;nbsp;&lt;a href=&quot;http://api.shephertz.com/app42-docs/user-management-service/#delete-user&quot; rel=&quot;nofollow&quot;&gt;http://api.shephertz.com/app42-docs/user-management-service/#delete-user&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
	Here's the code,&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	HashMap&amp;lt;String, String&amp;gt; &lt;span class=&quot;s1&quot;&gt;otherMetaHeaders&lt;/span&gt; = &lt;span class=&quot;s2&quot;&gt;new&lt;/span&gt; HashMap&amp;lt;String, String&amp;gt;();&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;otherMetaHeaders&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt;.put(&lt;/span&gt;&quot;deletePermanent&quot;&lt;span class=&quot;s3&quot;&gt;, &lt;/span&gt;&quot;true&quot;&lt;span class=&quot;s3&quot;&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;response&lt;/span&gt; = &lt;span class=&quot;s4&quot;&gt;userService&lt;/span&gt;.deleteUser(&lt;span class=&quot;s1&quot;&gt;userName&lt;/span&gt;);&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	regards,&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	Roopesh&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=9484/deletepermanent-doesnt-delete-the-user-permanently</guid>
<pubDate>Wed, 17 Aug 2016 13:17:03 +0000</pubDate>
</item>
<item>
<title>How to use REST?</title>
<link>http://forum.shephertz.com/?qa=9072/how-to-use-rest</link>
<description>I've been researching for a while and cannot find anything on how to use REST with custom code. I'm not sure how to make requests or build the custom code. I don't see any tutorials on it for creating it with App42. Does anyone have any link to any tutorials, or possibly provide help with this?</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=9072/how-to-use-rest</guid>
<pubDate>Thu, 16 Jun 2016 18:38:43 +0000</pubDate>
</item>
<item>
<title>Client is not authorized while inserting objects into collection in a loop</title>
<link>http://forum.shephertz.com/?qa=8424/client-authorized-while-inserting-objects-collection-loop</link>
<description>&lt;p&gt;
	Hi,&lt;/p&gt;
&lt;p&gt;
	We are getting an error randomly saying &quot;Client is not authorized&quot;. Below is what we are doing:&lt;/p&gt;
&lt;p&gt;
	1. Getting the json objects from one app in a jsonArray&lt;/p&gt;
&lt;p&gt;
	2. Initialize app42 wtih other app using the correct apiKey and secreKey.&lt;/p&gt;
&lt;p&gt;
	3. Then we have a loop that inserts objects from the jsonArray into a collection.&lt;/p&gt;
&lt;p&gt;
	It works fine for some of the objects so apikey and secretkey are correct, then it randomly gives the exception as given below:&lt;/p&gt;
&lt;p&gt;
	&lt;span style=&quot;text-decoration: underline;&quot;&gt;&lt;em&gt;&lt;span style=&quot;background-color:#ffff00;&quot;&gt;{&quot;app42Fault&quot;:{&quot;httpErrorCode&quot;:401,&quot;appErrorCode&quot;:1401,&quot;message&quot;:&quot;UnAuthorized Access&quot;,&quot;details&quot;:&quot;Client is not authorized&quot;}}&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
	Note : We have replay attack protect as &lt;strong&gt;DISABLED, &lt;/strong&gt;still we have the issue. Please help.&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=8424/client-authorized-while-inserting-objects-collection-loop</guid>
<pubDate>Fri, 25 Mar 2016 19:11:47 +0000</pubDate>
</item>
<item>
<title>LIKE Operator doesn't search in between the string</title>
<link>http://forum.shephertz.com/?qa=8322/like-operator-doesnt-search-in-between-the-string</link>
<description>&lt;p&gt;
	Hi,&lt;/p&gt;
&lt;p&gt;
	We are trying to do a search using LIKE operator, but it only searches the string at the start and not anywhere in between. Below is the query:&lt;/p&gt;
&lt;pre class=&quot;brush:java;&quot;&gt;
Query query = QueryBuilder.build(Constants.MOVIE_TITLE, searchString, Operator.LIKE);&lt;/pre&gt;
&lt;p&gt;
	Following are the logs printed using App42Log.setDebug(true):&lt;/p&gt;
&lt;blockquote&gt;
	&lt;div&gt;
		Request :: {&quot;maxRecords&quot;:100,&quot;searchString&quot;:&quot;Potter&quot;,&quot;requestCode&quot;:&quot;33&quot;,&quot;offset&quot;:0}&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;Setting value :jsonQuery : [{&quot;value&quot;:&quot;Potter&quot;,&quot;operator&quot;:&quot;$lk&quot;,&quot;key&quot;:&quot;title&quot;}]&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;QueryString is ?jsonQuery=%5B%7B%22value%22%3A%22Potter%22%2C%22operator%22%3A%22%24lk%22%2C%22key%22%3A%22title%22%7D%5D&amp;amp;&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;Requested URL is &lt;a href=&quot;https://api.shephertz.com/cloud/1.0/storage/findDocsByQuery/dbName/ONFRIDAY/collectionName/MOVIES/100/0?jsonQuery=%5B%7B%22value%22%3A%22Potter%22%2C%22operator%22%3A%22%24lk%22%2C%22key%22%3A%22title%22%7D%5D&amp;amp;&quot; rel=&quot;nofollow&quot;&gt;https://api.shephertz.com/cloud/1.0/storage/findDocsByQuery/dbName/ONFRIDAY/collectionName/MOVIES/100/0?jsonQuery=%5B%7B%22value%22%3A%22Potter%22%2C%22operator%22%3A%22%24lk%22%2C%22key%22%3A%22title%22%7D%5D&amp;amp;&lt;/a&gt;&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;Setting Header value : signature : yZNwCzsH0ELXRvTg%2Frc41nE0EEY%3D&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;Setting Header value : version : 1.0&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;Setting Header value : SDKName : Java&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;Setting Header value : timeStamp : 2016-03-08T20:28:18.205Z&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;Setting Header value : apiKey : bdd80d43a10e63f9977032785de20f0f6cb7087e487e56e0c2d8f7ae086cbced&lt;/div&gt;
	&lt;div&gt;
		App42Exception : {&quot;app42Fault&quot;:{&quot;httpErrorCode&quot;:404,&quot;appErrorCode&quot;:2608,&quot;message&quot;:&quot;Not Found&quot;,&quot;details&quot;:&quot;No document in the collection 'MOVIES' exists for given query&quot;}}&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div&gt;
	For Eg. if movie title is &quot;Harry Potter&quot;, we get the results when searching with &quot;Harry&quot; but not with &quot;Potter&quot;. Please let us know if anything is incorrect. It doesn't work on App42 HQ Management dashboard as well. We tried &quot;%Potter%&quot; as well, it doesn't work either.&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	Also, is there a way to do case-insensitive search?&lt;/div&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=8322/like-operator-doesnt-search-in-between-the-string</guid>
<pubDate>Tue, 08 Mar 2016 20:35:36 +0000</pubDate>
</item>
<item>
<title>Not able to send push notifications using Java SDK</title>
<link>http://forum.shephertz.com/?qa=8290/not-able-to-send-push-notifications-using-java-sdk</link>
<description>&lt;p&gt;
	Hi,&lt;/p&gt;
&lt;p&gt;
	We are trying to send push notifications to iOS device using the java SDK 2.6. The response comes as success, but it is not received at the iOS client. Please help us figure out the issue, below is code:&lt;/p&gt;
&lt;pre class=&quot;brush:java;&quot;&gt;
App42API.initialize(API_KEY,SECRET_KEY);  
pushService = App42API.buildPushNotificationService();
PushNotification pushNotification = pushService.sendPushMessageToUser(userName, message);
System.out.println(&quot;userName is &quot; + pushNotification.getUserName());    
System.out.println(&quot;Message is &quot; + pushNotification.getMessage());   
System.out.println(&quot;Expiry is&quot;+pushNotification.getExpiry());  
String jsonResponse = pushNotification.toString();   
System.out.println(jsonResponse);&lt;/pre&gt;
&lt;p&gt;
	Below is the output:&lt;/p&gt;
&lt;blockquote&gt;
	&lt;div&gt;
		userName is abc@gmail.com&lt;/div&gt;
	&lt;div&gt;
		Message is {&quot;message&quot;:&quot;Test Message&quot;}&lt;/div&gt;
	&lt;div&gt;
		Expiry is2016-03-03T00:10:07.793Z&lt;/div&gt;
	&lt;div&gt;
		{&quot;app42&quot;:{&quot;response&quot;:{&quot;success&quot;:true,&quot;push&quot;:{&quot;userName&quot;:&quot;abc@gmail.com&quot;,&quot;message&quot;:{&quot;message&quot;:&quot;Test Message&quot;},&quot;expiry&quot;:&quot;2016-03-03T00:10:07.793Z&quot;}}}}&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div&gt;
	The user has a registered device and the manual push notifications from AppHQ management console work fine.&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	Do we need to configure the certificate or some keys in the code?&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	Thanks&lt;/div&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=8290/not-able-to-send-push-notifications-using-java-sdk</guid>
<pubDate>Thu, 03 Mar 2016 00:12:36 +0000</pubDate>
</item>
<item>
<title>Is it possible to store a date field using no sql and then retreive the results sorted on that field?</title>
<link>http://forum.shephertz.com/?qa=8259/possible-store-date-field-using-retreive-results-sorted-field</link>
<description>Hi,

We want to store a date field in a json using no sql in the format as &quot;MM/dd/yyyy&quot;, and then retreive the results sorted on this field using otherMetaHeaders hashmap.

The problem is even if we store the date object, it is probably still stored and treated as string by app42.

Could you please tell us how to achieve this?</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=8259/possible-store-date-field-using-retreive-results-sorted-field</guid>
<pubDate>Sun, 28 Feb 2016 00:51:00 +0000</pubDate>
</item>
<item>
<title>Custom Code with elaborate API</title>
<link>http://forum.shephertz.com/?qa=8233/custom-code-with-elaborate-api</link>
<description>Hi,&lt;br /&gt;
&lt;br /&gt;
Couple of things about custom code.&lt;br /&gt;
&lt;br /&gt;
1. Is it possible to have Custom Code architected exactly like any other App42 service? Currently we have just a single execute() method which we override. Would like to have multiple methods (aka APIs) returning http response execution of which is controlled through routing scheme. Like a typical REST web service.&lt;br /&gt;
&lt;br /&gt;
2. Currently, we are managing multiple methods (aka APIs) through different request codes being sent to mean different methods using a switch() in a single monolithic custom code which is not intuitive. What is the recommendation for custom code executor? Should it be an executor for each method OR executor for &amp;quot;few&amp;quot; logical group methods OR monolithic custom code executor?&lt;br /&gt;
&lt;br /&gt;
3. I suspect that having a large executor class would affect performance as class loader would take that much time whenever it has to be loaded? Also does Executor class really get loaded every time a request arrives? Which recommendation is performance efficient?</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=8233/custom-code-with-elaborate-api</guid>
<pubDate>Wed, 24 Feb 2016 13:13:58 +0000</pubDate>
</item>
<item>
<title>Single custom code for multiple operations</title>
<link>http://forum.shephertz.com/?qa=8196/single-custom-code-for-multiple-operations</link>
<description>Hi,

We wanted to confirm if its okay to user a single custom code jar to accomplish multiple operations like add, fetch, update, delete.

We have about 30-35 different operations to be performed for our app and below is what we are doing:

We have a single custom code jar deployed which takes a request JSON that will have a key with name &quot;requestCode&quot;, this will identify the operation to be performed. For eg, requestCode = 1 to get the data, requestCode = 2 to add the data, and so on.

Then we have a switch statement on the requestCode which calls the appropriate method depending on the requestCode.

Is this approach okay considering the concurrency of operations in production environment?</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=8196/single-custom-code-for-multiple-operations</guid>
<pubDate>Sat, 20 Feb 2016 19:03:54 +0000</pubDate>
</item>
<item>
<title>Internal Server Error when upload .jar to Custom code</title>
<link>http://forum.shephertz.com/?qa=8192/internal-server-error-when-upload-jar-to-custom-code</link>
<description>&lt;p&gt;
	Hi!&lt;/p&gt;
&lt;p&gt;
	I write code on java for sending push notifications&amp;nbsp;to users who did not go to the game more than a day. I worked in Eclipse Mars, OSX 10.11.2. &amp;nbsp;Here is code (without libs):&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;brush:java;&quot;&gt;
public class Main {
	
	/**
	 * Main Method Send Push Notification from Cloud
	 * @param args
	 */
	public static final void main(String[] args) {
		getRecipients();
	}
	
	static final void getRecipients() {
		long currentTimeInMinutes = Clock.systemUTC().millis()/60000;
		String dbName = &quot;...&quot;;  
		String collectionName = &quot;...&quot;; 
		App42API.initialize(&quot;...&quot;,&quot;...&quot;);  
		StorageService storageService = App42API.buildStorageService();
		Storage storage = storageService.findAllDocuments(dbName,collectionName);    

		ArrayList&amp;lt;Storage.JSONDocument&amp;gt; jsonDocList = storage.getJsonDocList();  
		for(int i=0;i&amp;lt;jsonDocList.size();i++)  
		{  
		    String jsonString = jsonDocList.get(i).getJsonDoc();
		    String docID = jsonDocList.get(i).getDocId();
		    JSONObject jobj = null;
			try {
				jobj = new JSONObject(jsonString);
			} catch (JSONException e) {
				e.printStackTrace();
			}
		    long lastLoadedTime = 0;
			try {
				lastLoadedTime = jobj.getLong(&quot;lastLoadedTime&quot;);
			} catch (JSONException e) {
				e.printStackTrace();
			}
		    if(currentTimeInMinutes - lastLoadedTime &amp;gt; 1440)
				try {
					sendPN(jobj.getString(&quot;userName&quot;));
					
					jobj.put(&quot;lastLoadedTime&quot;,currentTimeInMinutes);
					storage = storageService.addOrUpdateKeys(dbName,collectionName,docID,jobj);
				} catch (JSONException e) {
					e.printStackTrace();
				}
		} 

	}
	
	static final void sendPN(String userName) {
		String message = &quot;Get free BribeMe, extra points or double time for bonuses!&quot;;
		
		PushNotificationService pushNotificationService = App42API.buildPushNotificationService();
		pushNotificationService.sendPushMessageToUser(userName, message);
	}

};&lt;/pre&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	I checked with the local computer everything works well. But I can't upload this to Custom code. If I make .jar using Eclipse, I get the message &quot;Package can not be used in custom code deployment Main : in source Main&quot;. If I make .jar using&lt;/p&gt;
&lt;p&gt;
	jar cf App42ServerPN.jar *&lt;/p&gt;
&lt;p&gt;
	I get the message &quot;Internal Server Error&quot;. What I'm doing wrong?&lt;/p&gt;
&lt;p&gt;
	P.S. Also I can't increment the badge using java code. Becouse &quot;Send Custom Push Message To User In Key Value Or JSON Format&quot; option is unavailable in java. Is there any way to push notification from Custom code and increase badge counter on the iOS devices?&lt;/p&gt;
&lt;p&gt;
	Thank you in advance.&lt;/p&gt;
&lt;p&gt;
	P.P.S. I get Error in both cases. Using AppHQ I get this:&lt;/p&gt;
&lt;p&gt;
	&lt;img alt=&quot;&quot; src=&quot;http://forum.shephertz.com/?qa=blob&amp;amp;qa_blobid=17616596957636533514&quot; style=&quot;width: 561px; height: 370px;&quot;&gt;&lt;/p&gt;
&lt;p&gt;
	When I run the deploy code from Eclipse, I get this message:&lt;/p&gt;
&lt;pre class=&quot;brush:java;&quot;&gt;
Exception in thread &quot;main&quot; com.shephertz.app42.paas.sdk.java.App42Exception: {&quot;app42Fault&quot;:{&quot;httpErrorCode&quot;:500,&quot;appErrorCode&quot;:1500,&quot;message&quot;:&quot;Internal Server Error&quot;,&quot;details&quot;:&quot;Internal Server Error. Please try again&quot;}}

at com.shephertz.app42.paas.sdk.java.util.Util.multiPartRequest(Util.java:358)

at com.shephertz.app42.paas.sdk.java.customcode.CustomCodeService.deployJarFile(CustomCodeService.java:82)

at Main.main(Main.java:21)
&lt;/pre&gt;
&lt;p class=&quot;p1&quot;&gt;
	Thank you for response!&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=8192/internal-server-error-when-upload-jar-to-custom-code</guid>
<pubDate>Thu, 18 Feb 2016 12:27:10 +0000</pubDate>
</item>
<item>
<title>my custom code &quot;app42Fault&quot;:{&quot;httpErrorCode&quot;:400,&quot;appErrorCode&quot;:1903,&quot;message&quot;:&quot;Bad Request&quot;,&quot;details&quot;:&quot; occurred!</title>
<link>http://forum.shephertz.com/?qa=8183/app42fault-httperrorcode-apperrorcode-details-occurred</link>
<description>&lt;p&gt;
	this is my exception message&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	Exception :com.shephertz.app42.paas.sdk.android.App42BadParameterException: {&quot;app42Fault&quot;:{&quot;httpErrorCode&quot;:400,&quot;appErrorCode&quot;:1903,&quot;message&quot;:&quot;Bad Request&quot;,&quot;details&quot;:&quot; Application Exception : com.shephertz.app42.paas.customcode.sample.MyCustomCode&quot;}}&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	Exception Message{&quot;app42Fault&quot;:{&quot;httpErrorCode&quot;:400,&quot;appErrorCode&quot;:1903,&quot;message&quot;:&quot;Bad Request&quot;,&quot;details&quot;:&quot; Application Exception : com.shephertz.app42.paas.customcode.sample.MyCustomCode&quot;}} requestJSON {&quot;GameMsg&quot;:17,&quot;UID&quot;:&quot;zet353&quot;,&quot;username&quot;:&quot;xery&quot;}&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	---&amp;gt; this is my request&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;App42API.initialize( &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt; ,&lt;/span&gt;&quot;xxxxxxxxx&quot;&lt;span class=&quot;s1&quot;&gt;,&lt;/span&gt;&quot;xxxxxxxxxxxxxxxx&quot;&lt;span class=&quot;s1&quot;&gt;); &amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&lt;span class=&quot;s3&quot;&gt;storageService&lt;/span&gt; = App42API.buildStorageService();&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&lt;span class=&quot;s3&quot;&gt;customCodeService&lt;/span&gt; = App42API.buildCustomCodeService(); &amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;void&lt;/span&gt; SendJSON( &lt;span class=&quot;s1&quot;&gt;final&lt;/span&gt; JSONObject requestJSON, &lt;span class=&quot;s1&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;int&lt;/span&gt; nMSG ){&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&lt;span class=&quot;s2&quot;&gt;Log.d(&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt;TAG&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;, &lt;/span&gt;&quot; SendJSON() call nMSG : &quot;&lt;span class=&quot;s2&quot;&gt; + nMSG&amp;nbsp; );&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&lt;span class=&quot;s2&quot;&gt;System.&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.println(&lt;/span&gt;&quot; SendJSON() CALL !!! requestJSON is &quot;&lt;span class=&quot;s2&quot;&gt; + requestJSON + &lt;/span&gt;&quot; nMSG : &quot;&lt;span class=&quot;s2&quot;&gt; + nMSG) ;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s3&quot;&gt;customCodeService&lt;/span&gt;.runJavaCode(&lt;span class=&quot;s3&quot;&gt;CustomCodeServerName&lt;/span&gt;, requestJSON, &lt;span class=&quot;s1&quot;&gt;new&lt;/span&gt; App42CallBack() { &amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;void&lt;/span&gt; onSuccess(Object response)&amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	{ &amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	}&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	---&amp;gt; this is my excute&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;class&lt;/span&gt; MyCustomCode &lt;span class=&quot;s1&quot;&gt;implements&lt;/span&gt; Executor {&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;private&lt;/span&gt; ServiceAPI &lt;span class=&quot;s2&quot;&gt;sp&lt;/span&gt; = &lt;span class=&quot;s1&quot;&gt;new&lt;/span&gt; ServiceAPI(&lt;span class=&quot;Apple-tab-span&quot;&gt; &lt;/span&gt; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	&quot;xxxxxxxxxxx9&quot;&lt;span class=&quot;s3&quot;&gt;,&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	&lt;span class=&quot;s3&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&quot;8xxxxxxxxxxxxxxb&quot;&lt;span class=&quot;s3&quot;&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	&lt;span class=&quot;s3&quot;&gt;ServiceAPI &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;app42ServiceAPI&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt; = &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt; ServiceAPI(&lt;/span&gt;&quot;xxxxxxxxx&quot;&lt;span class=&quot;s3&quot;&gt;,&lt;/span&gt;&quot;xxxxxxxxxxxxxx&quot;&lt;span class=&quot;s3&quot;&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	StorageService &lt;span class=&quot;s2&quot;&gt;storageService&lt;/span&gt; = &lt;span class=&quot;s2&quot;&gt;app42ServiceAPI&lt;/span&gt;.buildStorageService();&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p4&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;final&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt; &lt;/span&gt;HTTP_STATUS_SUCCESS&lt;span class=&quot;s3&quot;&gt; = 200;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt; String &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;dbName&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt; = &lt;/span&gt;&quot;xxxxxxxxxx&quot;&lt;span class=&quot;s3&quot;&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt; String &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;moduleName&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt; = &lt;/span&gt;&quot;xxxxxxxxxxx&quot;&lt;span class=&quot;s3&quot;&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p5&quot;&gt;
	boolean&lt;span class=&quot;s3&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;bEtherItem&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt; = &lt;/span&gt;false&lt;span class=&quot;s3&quot;&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	LogService &lt;span class=&quot;s2&quot;&gt;logger&lt;/span&gt; = &lt;span class=&quot;s2&quot;&gt;sp&lt;/span&gt;.buildLogService();&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;public&lt;/span&gt; HttpResponseObject execute(HttpRequestObject request) {&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	JSONObject body = request.getBody();&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	// Build Log Service For logging in Your Code&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s3&quot;&gt;logger&lt;/span&gt;.debug(&lt;span class=&quot;s4&quot;&gt;&quot; Recieved Request Body : :&quot;&lt;/span&gt; + body.toString(), &lt;span class=&quot;s3&quot;&gt;moduleName&lt;/span&gt;);&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	// Write Your Custom Code Here&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	// ......//&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	JSONObject jsonResponse = &lt;span class=&quot;s1&quot;&gt;null&lt;/span&gt;;&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;try&lt;/span&gt; {&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;s5&quot;&gt;GameMsg&lt;/span&gt; = body.getInt(&lt;span class=&quot;s4&quot;&gt;&quot;GameMsg&quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	String strUserName = body.getString(&lt;span class=&quot;s4&quot;&gt;&quot;username&quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s5&quot;&gt;jsonResponse&lt;/span&gt;.put(&lt;span class=&quot;s4&quot;&gt;&quot;username&quot;&lt;/span&gt;, strUserName);&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	} &lt;span class=&quot;s1&quot;&gt;catch&lt;/span&gt; (JSONException e) {&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	// &lt;span class=&quot;s7&quot;&gt;TODO&lt;/span&gt; Auto-generated catch block&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	//&lt;span class=&quot;Apple-tab-span&quot;&gt; &lt;/span&gt;e.printStackTrace();&lt;/p&gt;
&lt;p class=&quot;p5&quot;&gt;
	&lt;span class=&quot;s3&quot;&gt;logger&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.debug(&lt;/span&gt;&quot; HttpResponseObject JSONObject body JSONException e: :&quot;&lt;span class=&quot;s2&quot;&gt; + e.toString(), &lt;/span&gt;&lt;span class=&quot;s3&quot;&gt;moduleName&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	}&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	//System.out.println(&quot;MyCustomCode JSONObject SummonHero call requestJSON : &quot; + requestJSON ); &amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	//logger.info(&quot;Running Custom Code Hello World&amp;nbsp; &quot;, moduleName);&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	// Create JSON Response Based on Your business logic&lt;/p&gt;
&lt;p class=&quot;p5&quot;&gt;
	&lt;span class=&quot;s3&quot;&gt;logger&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.debug(&lt;/span&gt;&quot; !!!!!!!HttpResponseObject execute(HttpRequestObject request) call return new HttpResponseObject jsonResponse : :&quot;&lt;span class=&quot;s2&quot;&gt; + jsonResponse.toString(), &lt;/span&gt;&lt;span class=&quot;s3&quot;&gt;moduleName&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;new&lt;/span&gt; HttpResponseObject(&lt;span class=&quot;s3&quot;&gt;HTTP_STATUS_SUCCESS&lt;/span&gt;, jsonResponse);&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	}&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	until last day code work but today i deploy new customcode suddenly error occured!!! what problem?&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	give me answer please!&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	&amp;nbsp;&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=8183/app42fault-httperrorcode-apperrorcode-details-occurred</guid>
<pubDate>Thu, 18 Feb 2016 03:23:49 +0000</pubDate>
</item>
<item>
<title>how to return HttpResponseObject execute(HttpRequestObject request) after return App42CallBack function?</title>
<link>http://forum.shephertz.com/?qa=8153/httpresponseobject-httprequestobject-app42callback-function</link>
<description>&lt;p&gt;
	this is mycunstom code ....&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;public&lt;/span&gt; HttpResponseObject execute(HttpRequestObject request) {&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	JSONObject body = request.getBody();&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	JSONObject jsonResponse = &lt;span class=&quot;s1&quot;&gt;null&lt;/span&gt;;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;try&lt;/span&gt; {&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	jsonResponse = SummonHero(GameMsg,strUserName);&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	} &lt;span class=&quot;s1&quot;&gt;catch&lt;/span&gt; (JSONException e) {&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	}&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;new&lt;/span&gt; HttpResponseObject(&lt;span class=&quot;s2&quot;&gt;HTTP_STATUS_SUCCESS&lt;/span&gt;, jsonResponse);&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	---&amp;gt; this is my callback function()&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;public&lt;/span&gt; JSONObject SummonHero( &lt;span class=&quot;s1&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;int&lt;/span&gt; GameMsg, &lt;span class=&quot;s1&quot;&gt;final&lt;/span&gt; String strUserName )&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	{&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;final&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; JSONObject responseJSON = &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; JSONObject();&lt;/span&gt;//create response summonhero json by zet 160205&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	Query q1 = QueryBuilder.build(&lt;span class=&quot;s3&quot;&gt;&quot;name&quot;&lt;/span&gt;, strUserName, Operator.&lt;span class=&quot;s4&quot;&gt;EQUALS&lt;/span&gt;);&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	&lt;span class=&quot;s4&quot;&gt;storageService&lt;/span&gt;.findDocumentsByQuery(&lt;span class=&quot;s4&quot;&gt;dbName&lt;/span&gt;,&lt;span class=&quot;s3&quot;&gt;&quot;BattleInfo&quot;&lt;/span&gt;,q1, &lt;span class=&quot;s1&quot;&gt;new&lt;/span&gt; App42CallBack()&amp;nbsp; {&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&lt;span class=&quot;s1&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;void&lt;/span&gt; onSuccess(Object response){&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&amp;nbsp;---&amp;gt; this is my callback ok&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	}&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	i want to control data inside App42CallBack after &amp;nbsp;&lt;span class=&quot;s1&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;s1&quot;&gt;new&lt;/span&gt;&amp;nbsp;HttpResponseObject(&lt;span class=&quot;s2&quot;&gt;HTTP_STATUS_SUCCESS&lt;/span&gt;, jsonResponse); function.....&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	but &amp;nbsp;&amp;nbsp;&lt;span class=&quot;s1&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;s1&quot;&gt;new&lt;/span&gt;&amp;nbsp;HttpResponseObject(&lt;span class=&quot;s2&quot;&gt;HTTP_STATUS_SUCCESS&lt;/span&gt;, jsonResponse) call !!!! &amp;nbsp;before &amp;nbsp;App42CallBack() &amp;nbsp;onSuccess() function call !!!!!&lt;/p&gt;
&lt;p class=&quot;p3&quot;&gt;
	how can i controll callback function before &amp;nbsp;&lt;span class=&quot;s1&quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;s1&quot;&gt;new&lt;/span&gt;&amp;nbsp;HttpResponseObject(&lt;span class=&quot;s2&quot;&gt;HTTP_STATUS_SUCCESS&lt;/span&gt;, jsonResponse); &amp;nbsp;call?&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p2&quot;&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;p1&quot;&gt;
	&amp;nbsp;&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=8153/httpresponseobject-httprequestobject-app42callback-function</guid>
<pubDate>Sat, 13 Feb 2016 12:05:12 +0000</pubDate>
</item>
<item>
<title>custom code error  int size = games.size();</title>
<link>http://forum.shephertz.com/?qa=8048/custom-code-error-int-size-games-size</link>
<description>&lt;div&gt;
	Hi,&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	GameService gameService = sp.buildGameService();&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	// 200 max create game&lt;/div&gt;
&lt;div&gt;
	game = gameService.createGame( &quot;testgame&quot;, &quot;des: &quot; + &quot;testgame&quot; );&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	List&amp;lt;Game&amp;gt; games = gameService.getAllGames();&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	// 100 size&lt;/div&gt;
&lt;div&gt;
	// Why?&lt;/div&gt;
&lt;div&gt;
	int size = games.size();&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	Import games count?&lt;/div&gt;
&lt;div&gt;
	&lt;div&gt;
		App42Response app42Response gameService.getAllGamesCount ();&lt;/div&gt;
	&lt;div&gt;
		Please tell us the examples.&lt;/div&gt;
	&lt;div&gt;
		&amp;nbsp;&lt;/div&gt;
	&lt;div&gt;
		Thank you.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=8048/custom-code-error-int-size-games-size</guid>
<pubDate>Fri, 22 Jan 2016 05:26:02 +0000</pubDate>
</item>
<item>
<title>How to set dbname when using custom code. App42API is not allowed.</title>
<link>http://forum.shephertz.com/?qa=8036/how-to-set-dbname-when-using-custom-code-app42api-not-allowed</link>
<description>&lt;p&gt;
	Hi,&lt;/p&gt;
&lt;p&gt;
	We need to use userService in custom code and we need to fetch additional data for user and that requires dbname to be set as :&lt;/p&gt;
&lt;pre class=&quot;brush:java;&quot;&gt;
App42API.setDbName(&quot;&amp;lt;DB_NAME&amp;gt;&quot;);&lt;/pre&gt;
&lt;p&gt;
	But we cannot deploy this custom code, below is the error:&lt;/p&gt;
&lt;blockquote&gt;
	&lt;div&gt;
		&quot;message&quot;:&quot;Bad Request&quot;,&quot;details&quot;:&quot;Class can not be used in custom code deployment c&lt;/div&gt;
	&lt;div&gt;
		om.shephertz.app42.paas.sdk.java.App42API : in source com.shephertz.app42.paas.customcode.commons.App42Utilities&quot;}}&lt;/div&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
	&lt;pre class=&quot;brush:java;&quot;&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;
	Please help.&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">http://forum.shephertz.com/?qa=8036/how-to-set-dbname-when-using-custom-code-app42api-not-allowed</guid>
<pubDate>Tue, 19 Jan 2016 22:21:29 +0000</pubDate>
</item>
</channel>
</rss>