Re: [appengine-java] Re: how to get session id under a Class which doesn't extend HttpServlet?

2010-01-09 Thread Prashant Gupta
I tried following code, getting null all the time.

public static HttpSession getSession(){
return new ThreadLocalHttpServletRequest().get().getSession();
}


2010/1/9 Elias Mårtenson loke...@gmail.com

 On 9 Jan, 01:27, Prashant Gupta nextprash...@gmail.com wrote:

  I am trying to implement my own user management system, for that I need
 some
  way to make session id available to all classes independent of whether it
  extends HttpServlet or not. I know there is some way to do that but I am
 not
  able to find it. Any kind of help would be appreciated.

 One way to do it is to use a servlet filter to make the user
 information available through a ThreadLocal instance. That way you can
 have a single static method that returns the user wherever you are.

 --
 You received this message because you are subscribed to the Google Groups
 Google App Engine for Java group.
 To post to this group, send email to
 google-appengine-j...@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.




-- 

You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group.

To post to this group, send email to google-appengine-j...@googlegroups.com.

To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.



Re: [appengine-java] Re: custom vs. generated keys / storage?

2010-01-09 Thread Jeff Schnitzer
You have a mistaken understanding of what a Key is.  Both values
displayed on the Datastore Viewer
(aghtb2JjYS1zdHIOCxIHQ2hlY2tpbhjiQww and YourEntityKind: id=12345)
are merely alternative visual representations.  The actual value
stored in BigTable is a binary representation of this data.  It may or
may not be more compact than either of these two visual
representations, but you can be assured that there is only one stored
version of it (not counting foreign key references or replication, of
course).

I don't work for Google, but I watched the Google I/O video on
BigTable.  You should too.

Jeff

On Fri, Jan 8, 2010 at 11:07 PM, phraktle phrak...@gmail.com wrote:

 could someone from Google weigh in on this?

 thanks,
  Viktor

 On Jan 6, 12:43 pm, phraktle phrak...@gmail.com wrote:
 Hi,

 I'm using the low-level DS API, thus short names for kinds, etc, and
 my keys are already quite compact. The encoded version is in fact
 significantly longer than my ownkey. So it would optimal, if DS did
 not try to second-guess and bloat my PKs. How do you know that DS
 doesn't actually store both versions? Do you know how to decode the DSkey?

 Regards,
   Viktor

 On Jan 5, 5:54 am, jd jdpatter...@gmail.com wrote:



  The encoded EntityKey is a representation that includes yourkey
  name, entity kind, ancestors and app id - encoded into a form that is
  safe to use in urls etc.  Keeping your keys small and kinds small
  (i.e. using short class names) will reduce storage space of keys in
  the DS.  In Twig (i.e. not JDO) you can keep the names of your classes
  as you like and then override typetoKind(Type) to return abbreviated
  names.  I found that this saves a significant amount of space in my
  app that has many relations between entities.

 http://code.google.com/p/twig-persist/

  On Jan 4, 5:01 pm, phraktle phrak...@gmail.com wrote:

   Hi,

   I'm generating my own entity keys, with new Entity(Foo, myId). I
   noticed that in the DataStore viewer, these entities still seem to
   have a defaultkey:

   Decoded entitykey: Foo: name=myId
   Entitykey:
   ahFzY2FyYWJyZWNvbW1lbmRlcnJACxIVUHJvZHVjdFJlY29tbWVuZGF0aW9uIiU1OTg1MEMzMzM
wOUZGRjV8MjAxMDAxMDQwMTAzNTN8cHJvZF8wDA

   So the Entitykey here still seems to be generated by GAE. Why is
   this needed? I do have a primarykeyalready. So does it get stored as
   simply another indexed column? Does this impact storage space too? I
   don't need the GAE entitykeyat all, and would prefer not having to
   pay for its storage either :)

   Thanks,
     Viktor

 --
 You received this message because you are subscribed to the Google Groups 
 Google App Engine for Java group.
 To post to this group, send email to google-appengine-j...@googlegroups.com.
 To unsubscribe from this group, send email to 
 google-appengine-java+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/google-appengine-java?hl=en.




-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




[appengine-java] Where is jsp translation to servlet code stored

2010-01-09 Thread powell...@gmail.com
When I upload a jsp to appengine with Ecllipse, my understanding is
that the translation from jsp to servlet  happens in Eclipse and  only
the compiled code is uploaded to appengine. Is this correct? Where can
I view the translated servlet file?

Thanks
Dave
-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




Re: [appengine-java] Where is jsp translation to servlet code stored

2010-01-09 Thread Qian Qiao
On Sat, Jan 9, 2010 at 19:15, powell...@gmail.com powell...@gmail.com wrote:
 When I upload a jsp to appengine with Ecllipse, my understanding is
 that the translation from jsp to servlet  happens in Eclipse and  only
 the compiled code is uploaded to appengine. Is this correct? Where can
 I view the translated servlet file?

 Thanks
 Dave

$TMPDIR or /tmp on POSIX systems. I'm guess windoze has some sort of
similar directories?

-- Joe

-- 
Two things that are infinite, the universe and my stupidity, and I'm
not sure about the universe.
-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




[appengine-java] After how much time of no traffic does GAE shut-down the instance

2010-01-09 Thread Yossi
Hi,

I've noticed that the same request that takes in average 2 seconds
could take more then 20 seconds after around 10 minutes that the
application is idle (no requests are received). I assume that after
~10 minutes of no requests, the GAE shuts-down the instance.
Is there an official information about this period of time? Is there a
way to extend this period of time (besides writing a cron job that
runs every minute)?

Thanks.

Yossi
-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




Re: [appengine-java] handling com.google.apphosting.api.ApiProxy$RequestTooLargeException: The request to API call datastore_v3.Put() was too large.

2010-01-09 Thread Prashant Gupta
no, it doesn't work :(

2010/1/8 Vince Bonfanti vbonfa...@gmail.com

 Try catching com.google.appengine.api.datastore.DatastoreFailureException,
 as indicated in the docs:


 http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/DatastoreService.html#put(com.google.appengine.api.datastore.Entity)

 Vince


 On Thu, Jan 7, 2010 at 11:25 PM, Prashant Gupta nextprash...@gmail.comwrote:

 hi,

 com.google.apphosting.api.ApiProxy$RequestTooLargeException: The request
 to API call datastore_v3.Put() was too large. was thrown while saving an
 entity to datastore. I want to handle this exception but I am not getting
 which exception to catch. Please help me out...

 Thanks

 --
 You received this message because you are subscribed to the Google Groups
 Google App Engine for Java group.
 To post to this group, send email to
 google-appengine-j...@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.



 --
 You received this message because you are subscribed to the Google Groups
 Google App Engine for Java group.
 To post to this group, send email to
 google-appengine-j...@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.


-- 

You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group.

To post to this group, send email to google-appengine-j...@googlegroups.com.

To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] TaskQueue 10s limit? really?

2010-01-09 Thread Locke
Python supports asynchronous URLFetch, but Java doesn't. So if we need
to do any asynchronous URLFetching, our only option is to use the
TaskQueue, right?

Well, I always thought our apps had 30 seconds to complete their
business. Since URLFetch calls can take up to 10 seconds to complete,
30 seconds is more than enough. So I wrote an asynchronous_urlfetch
function which simply used the TaskQueue to post a URL to a webhook
which called URLFetch. Not as good as the Python way, but it should
work just fine.

But it doesn't! My logs are full of 500 ... Request was aborted after
waiting too long to attempt to service your request. for the
aforementioned webhook. Aparently, rather than giving the normal 30
seconds, App Engine is killing my TaskQueues after only 10! So if my
URLFetch takes 10 seconds, the entire webhook dies!

Am I interpreting this right? Are TaskQueues really getting killed
after 10 rather than 30 seconds? If so, could we please get this
rectified?

And, really, time spent waiting on URLFetch should not count against
us, anyway! That's outside of our control and is certainly NOT
indicative of problems with our apps.
-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




[appengine-java] Re: After how much time of no traffic does GAE shut-down the instance

2010-01-09 Thread Locke
In my testing, apps which are hit every 2 minutes need to boot every
time (costing beacoup CPU cycles), whereas apps hit every 1 minute
stay loaded.

This limit seems to have changed over time. When I started using
appengine several months ago, it would wait ten minutes before
subjecting you to the unload/reload penalty.

I would gladly send google a stick of RAM in the mail if they would
just keep my app going!  ;-)


On Jan 9, 8:16 am, Yossi yossi@gmail.com wrote:
 Hi,

 I've noticed that the same request that takes in average 2 seconds
 could take more then 20 seconds after around 10 minutes that the
 application is idle (no requests are received). I assume that after
 ~10 minutes of no requests, the GAE shuts-down the instance.
 Is there an official information about this period of time? Is there a
 way to extend this period of time (besides writing a cron job that
 runs every minute)?

 Thanks.

 Yossi
-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




[appengine-java] Re: Increased reliability issues on AppEngine for the past 48h

2010-01-09 Thread Locke
I am seeing inexplicable datastore timeouts, too.
com.google.appengine.api.datastore.DatastoreTimeoutException:
Unknown

This happens for simple look-ups (checking if any account Kinds exist
which correspond to the submitted cookie). It always goes away if I
refresh the page. The error is very sporadic.

On Jan 8, 12:54 pm, Jerome Mouton jerome.mou...@gmail.com wrote:
 Hello,

 Our AppEngine application has been experiencing an increase rate of
 bogus exceptions for the past 48+ hours. See the attached image for
 our requests/seconds and errors/seconds for the last 6 hours. We have
 been seeing the exact same pattern for the past 2 days.

 This is an app with billing enabled, and we have way (over 10x) below
 our billing quotas.
 The only change we can figure out that started at about the same time
 as this increase rate of error was the usage of the XMPP API being
 more frequent than before, but the exceptions are not related to the
 XMPP API calls, they are the one of the following:

 - com.google.appengine.api.datastore.DatastoreTimeoutException: Unknown
   on servlets data store JDO queries that are expected to be (and most
 of the time are) extremely fast; when it fails, the servlet shows
 times in this area: 4135ms 187cpu_ms 12api_cpu_ms

 - com.google.apphosting.api.ApiProxy$ApiDeadlineExceededException: The
 API call datastore_v3.RunQuery() took too long to respond and was
 cancelled.
   on servlets data store JDO queries that are expected to be (and most
 of the time are) extremely fast; when it fails, the servlet shows
 times in this area: 5464ms 194cpu_ms

 - Request was aborted after waiting too long to attempt to service
 your request. Most likely, this indicates that you have reached your
 simultaneous dynamic request limit. This is almost always due to
 excessively high latency in your app. Please 
 seehttp://code.google.com/appengine/docs/quotas.htmlfor more details.

 Is this reliability degradation for the past 48 hours seen by other
 users? If a Googler needs our appId for review, please drop me an
 email.

 Thank you.

 Jerome

  20100108-appengine_issue.png
 80KViewDownload
-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




[appengine-java] Re: TaskQueue 10s limit? really?

2010-01-09 Thread Locke
Just to clarify, here's what I'm interpreting as google killing my
TaskQueues after 10 seconds. See where it says 10064ms 0cpu_ms?
This was waiting for a URLFetch to timeout after 10 seconds, but it
was killed before URLFetch could return. 10 seconds is much less than
30 seconds...

01-09 11:26AM 03.652 /hook/do_ava_check 500 10064ms 0cpu_ms 0kb
AppEngine-Google; (+http://code.google.com/appengine)
0.1.0.2 - - [09/Jan/2010:11:26:13 -0800] POST /hook/do_ava_check HTTP/
1.1 500 0
...
Request was aborted after waiting too long to attempt to service your
request. ...

If I am interpreting my logs wrong, let me know...


On Jan 9, 3:52 pm, Locke locke2...@gmail.com wrote:
 Python supports asynchronous URLFetch, but Java doesn't. So if we need
 to do any asynchronous URLFetching, our only option is to use the
 TaskQueue, right?

 Well, I always thought our apps had 30 seconds to complete their
 business. Since URLFetch calls can take up to 10 seconds to complete,
 30 seconds is more than enough. So I wrote an asynchronous_urlfetch
 function which simply used the TaskQueue to post a URL to a webhook
 which called URLFetch. Not as good as the Python way, but it should
 work just fine.

 But it doesn't! My logs are full of 500 ... Request was aborted after
 waiting too long to attempt to service your request. for the
 aforementioned webhook. Aparently, rather than giving the normal 30
 seconds, App Engine is killing my TaskQueues after only 10! So if my
 URLFetch takes 10 seconds, the entire webhook dies!

 Am I interpreting this right? Are TaskQueues really getting killed
 after 10 rather than 30 seconds? If so, could we please get this
 rectified?

 And, really, time spent waiting on URLFetch should not count against
 us, anyway! That's outside of our control and is certainly NOT
 indicative of problems with our apps.
-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




[appengine-java] org.datanucleus.store.appengine.MetaDataValidator checkForIllegalChildField

2010-01-09 Thread Sekhar
I'm getting a warning for an embedded child:

org.datanucleus.store.appengine.MetaDataValidator
checkForIllegalChildField: Unable to validate relation
com.allurefx.herdspot.server.data.Person.im

I understand we get the checkForIllegalChildField error for many-to-
one children that have a Long (rather than Key/String) primary key,
but what I have is an embedded field that can't have a primary key.
What's the reason for this warning, and what's the resolution?
-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




[appengine-java] Re: custom vs. generated keys / storage?

2010-01-09 Thread phraktle

Hi Jeff,

Yeah, I get that, I'm just failing to see why this alternative
representation is even there and exposed in any way? The keys must be
indexed with the representation that I have constructed, as I can
perform lexicographical searches on those specific keys. So what's the
other representation all about? It seems wasteful to me. So I would
still like to understand better, what the mechanics are here...

Viktor

On Jan 9, 12:11 pm, Jeff Schnitzer j...@infohazard.org wrote:
 You have a mistaken understanding of what a Key is.  Both values
 displayed on the Datastore Viewer
 (aghtb2JjYS1zdHIOCxIHQ2hlY2tpbhjiQww and YourEntityKind: id=12345)
 are merely alternative visual representations.  The actual value
 stored in BigTable is a binary representation of this data.  It may or
 may not be more compact than either of these two visual
 representations, but you can be assured that there is only one stored
 version of it (not counting foreign key references or replication, of
 course).

 I don't work for Google, but I watched the Google I/O video on
 BigTable.  You should too.

 Jeff



 On Fri, Jan 8, 2010 at 11:07 PM, phraktle phrak...@gmail.com wrote:

  could someone from Google weigh in on this?

  thanks,
   Viktor

  On Jan 6, 12:43 pm, phraktle phrak...@gmail.com wrote:
  Hi,

  I'm using the low-level DS API, thus short names for kinds, etc, and
  my keys are already quite compact. The encoded version is in fact
  significantly longer than my ownkey. So it would optimal, if DS did
  not try to second-guess and bloat my PKs. How do you know that DS
  doesn't actually store both versions? Do you know how to decode the DSkey?

  Regards,
    Viktor

  On Jan 5, 5:54 am, jd jdpatter...@gmail.com wrote:

   The encoded EntityKey is a representation that includes yourkey
   name, entity kind, ancestors and app id - encoded into a form that is
   safe to use in urls etc.  Keeping your keys small and kinds small
   (i.e. using short class names) will reduce storage space of keys in
   the DS.  In Twig (i.e. not JDO) you can keep the names of your classes
   as you like and then override typetoKind(Type) to return abbreviated
   names.  I found that this saves a significant amount of space in my
   app that has many relations between entities.

  http://code.google.com/p/twig-persist/

   On Jan 4, 5:01 pm, phraktle phrak...@gmail.com wrote:

Hi,

I'm generating my own entity keys, with new Entity(Foo, myId). I
noticed that in the DataStore viewer, these entities still seem to
have a defaultkey:

Decoded entitykey: Foo: name=myId
Entitykey:
ahFzY2FyYWJyZWNvbW1lbmRlcnJACxIVUHJvZHVjdFJlY29tbWVuZGF0aW9uIiU1OTg1MEMzMzM
 wOUZGRjV8MjAxMDAxMDQwMTAzNTN8cHJvZF8wDA

So the Entitykey here still seems to be generated by GAE. Why is
this needed? I do have a primarykeyalready. So does it get stored as
simply another indexed column? Does this impact storage space too? I
don't need the GAE entitykeyat all, and would prefer not having to
pay for its storage either :)

Thanks,
  Viktor

  --
  You received this message because you are subscribed to the Google Groups 
  Google App Engine for Java group.
  To post to this group, send email to google-appengine-j...@googlegroups.com.
  To unsubscribe from this group, send email to 
  google-appengine-java+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/google-appengine-java?hl=en.
-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




Re: [appengine-java] Re: jsp work directory

2010-01-09 Thread seleronm
Hi,

The following links might serve as a reference though it is thought that 
it differs depending on OS that you are using. 

http://groups.google.com/group/google-appengine-java/browse_thread/thread/e63281b3e3d1b05/9b12a70f5172c6c1


Please try.
thanks.


the directory where the jsps are translated into java files and
compiled. like in tomcat.

 What do you mean by work directory?

 siliconeagle wrote:
  does anyone know where the jsp work directory is on the dev server?



-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to google-appengine-java+
unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-
appengine-java?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.




[appengine-java] Re: how to get session id under a Class which doesn't extend HttpServlet?

2010-01-09 Thread Elias Mårtenson
On 9 Jan, 16:53, Prashant Gupta nextprash...@gmail.com wrote:
 I tried following code, getting null all the time.

 public static HttpSession getSession(){
 return new ThreadLocalHttpServletRequest().get().getSession();

 }

You also need to create a filter where you actually put the data in
the TheadLocal. I am just about to go out, so I don't actually have
time to write the code for you. Sorry about that.

Regards,
Elias
-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.