[appengine-java] Re: 1.4 eclipse plugin

2010-12-04 Thread GoSharp Lite
I solve my jsp compilation issue by using below steps.

1) Download and install eclipse-java-helios-SR1-win32.zip.
2) Install plugins from http://dl.google.com/eclipse/plugin/3.6;.
3) Download and install java_ee_sdk-6u1-jdk-windows.exe.
4) Create a new and empty app using same project name and package as
my old app.
5) Carefully copy all files in src and war from my old app into the
new app.
6) Import all external libs from my old app into the new app.
7) Set Properties-Google-App Engine-ORM to server files which need
enhancement.
8) Debug and no more Unable to compile class for JSP.

On Dec 4, 11:47 am, Jerome jerome.mou...@gmail.com wrote:
 Sorry, no solution but a very similar issue with Eclipse Helios SR 1:

 org.apache.jasper.JasperException: Unable to compile class for JSP:

 An error occurred at line: 9 in the generated java file
 org.apache.jasper.runtime.HttpJspBase cannot be resolved to a type

 An error occurred at line: 10 in the generated java file
 org.apache.jasper.runtime.JspSourceDependent cannot be resolved to a
 type

 An error occurred at line: 12 in the generated java file
 JspFactory cannot be resolved to a type

 An error occurred at line: 12 in the generated java file
 JspFactory cannot be resolved

 An error occurred at line: 23 in the generated java file
 javax.el.ExpressionFactory cannot be resolved to a type

 An error occurred at line: 24 in the generated java file
 org.apache.AnnotationProcessor cannot be resolved to a type

 An error occurred at line: 31 in the generated java file
 _el_expressionfactory cannot be resolved

 An error occurred at line: 31 in the generated java file
 _jspxFactory cannot be resolved

 An error occurred at line: 31 in the generated java file
 The method getServletConfig() is undefined for the type plans_jsp

 An error occurred at line: 32 in the generated java file
 _jsp_annotationprocessor cannot be resolved

 An error occurred at line: 32 in the generated java file
 org.apache.AnnotationProcessor cannot be resolved to a type

 An error occurred at line: 32 in the generated java file
 The method getServletConfig() is undefined for the type plans_jsp

 An error occurred at line: 32 in the generated java file
 org.apache.AnnotationProcessor cannot be resolved to a type

 An error occurred at line: 38 in the generated java file
 HttpServletRequest cannot be resolved to a type

 An error occurred at line: 38 in the generated java file
 HttpServletResponse cannot be resolved to a type

 An error occurred at line: 39 in the generated java file
 ServletException cannot be resolved to a type

 An error occurred at line: 41 in the generated java file
 PageContext cannot be resolved to a type

 An error occurred at line: 42 in the generated java file
 HttpSession cannot be resolved to a type

 An error occurred at line: 43 in the generated java file
 ServletContext cannot be resolved to a type

 An error occurred at line: 44 in the generated java file
 ServletConfig cannot be resolved to a type

 An error occurred at line: 45 in the generated java file
 JspWriter cannot be resolved to a type

 An error occurred at line: 47 in the generated java file
 JspWriter cannot be resolved to a type

 An error occurred at line: 48 in the generated java file
 PageContext cannot be resolved to a type

 An error occurred at line: 53 in the generated java file
 _jspxFactory cannot be resolved

 An error occurred at line: 1,315 in the generated java file
 SkipPageException cannot be resolved to a type

 An error occurred at line: 1,322 in the generated java file
 _jspxFactory cannot be resolved

 Stacktrace:
         at
 org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:
 92)
         at
 org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:
 330)
         at
 org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:
 439)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
         at
 org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:
 592)
         at
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
 317)
         at
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
 313)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
         at com.google.appengine.tools.development.PrivilegedJspServlet.access
 $101(PrivilegedJspServlet.java:23)
         at com.google.appengine.tools.development.PrivilegedJspServlet
 $2.run(PrivilegedJspServlet.java:59)
         at java.security.AccessController.doPrivileged(Native Method)
         at
 com.google.appengine.tools.development.PrivilegedJspServlet.service(PrivilegedJspServlet.java:
 57)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         at 

[appengine-java] Re: 1.4 eclipse plugin

2010-12-04 Thread GoSharp Lite
I solve my jsp compilation issue by using below steps.

1) Download and install eclipse-java-helios-SR1-win32.zip.
2) Install plugins from http://dl.google.com/eclipse/plugin/3.6;.
3) Download and install java_ee_sdk-6u1-jdk-windows.exe.
4) Create a new and empty app using same project name and package as
my old app.
5) Carefully copy all files in src and war from my old app into the
new app.
6) Import all external libs from my old app into the new app.
7) Set Properties-Google-App Engine-ORM to server files which need
enhancement.
8) Debug and no more Unable to compile class for JSP.

On Dec 4, 11:47 am, Jerome jerome.mou...@gmail.com wrote:
 Sorry, no solution but a very similar issue with Eclipse Helios SR 1:

 org.apache.jasper.JasperException: Unable to compile class for JSP:

 An error occurred at line: 9 in the generated java file
 org.apache.jasper.runtime.HttpJspBase cannot be resolved to a type

 An error occurred at line: 10 in the generated java file
 org.apache.jasper.runtime.JspSourceDependent cannot be resolved to a
 type

 An error occurred at line: 12 in the generated java file
 JspFactory cannot be resolved to a type

 An error occurred at line: 12 in the generated java file
 JspFactory cannot be resolved

 An error occurred at line: 23 in the generated java file
 javax.el.ExpressionFactory cannot be resolved to a type

 An error occurred at line: 24 in the generated java file
 org.apache.AnnotationProcessor cannot be resolved to a type

 An error occurred at line: 31 in the generated java file
 _el_expressionfactory cannot be resolved

 An error occurred at line: 31 in the generated java file
 _jspxFactory cannot be resolved

 An error occurred at line: 31 in the generated java file
 The method getServletConfig() is undefined for the type plans_jsp

 An error occurred at line: 32 in the generated java file
 _jsp_annotationprocessor cannot be resolved

 An error occurred at line: 32 in the generated java file
 org.apache.AnnotationProcessor cannot be resolved to a type

 An error occurred at line: 32 in the generated java file
 The method getServletConfig() is undefined for the type plans_jsp

 An error occurred at line: 32 in the generated java file
 org.apache.AnnotationProcessor cannot be resolved to a type

 An error occurred at line: 38 in the generated java file
 HttpServletRequest cannot be resolved to a type

 An error occurred at line: 38 in the generated java file
 HttpServletResponse cannot be resolved to a type

 An error occurred at line: 39 in the generated java file
 ServletException cannot be resolved to a type

 An error occurred at line: 41 in the generated java file
 PageContext cannot be resolved to a type

 An error occurred at line: 42 in the generated java file
 HttpSession cannot be resolved to a type

 An error occurred at line: 43 in the generated java file
 ServletContext cannot be resolved to a type

 An error occurred at line: 44 in the generated java file
 ServletConfig cannot be resolved to a type

 An error occurred at line: 45 in the generated java file
 JspWriter cannot be resolved to a type

 An error occurred at line: 47 in the generated java file
 JspWriter cannot be resolved to a type

 An error occurred at line: 48 in the generated java file
 PageContext cannot be resolved to a type

 An error occurred at line: 53 in the generated java file
 _jspxFactory cannot be resolved

 An error occurred at line: 1,315 in the generated java file
 SkipPageException cannot be resolved to a type

 An error occurred at line: 1,322 in the generated java file
 _jspxFactory cannot be resolved

 Stacktrace:
         at
 org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:
 92)
         at
 org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:
 330)
         at
 org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:
 439)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
         at
 org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:
 592)
         at
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
 317)
         at
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
 313)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
         at com.google.appengine.tools.development.PrivilegedJspServlet.access
 $101(PrivilegedJspServlet.java:23)
         at com.google.appengine.tools.development.PrivilegedJspServlet
 $2.run(PrivilegedJspServlet.java:59)
         at java.security.AccessController.doPrivileged(Native Method)
         at
 com.google.appengine.tools.development.PrivilegedJspServlet.service(PrivilegedJspServlet.java:
 57)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         at 

[appengine-java] Checking admin priviledges using UserService in a cron/task-queue task execution

2010-12-04 Thread andrew
I am trying to debug some issues with task execution and have a
question.

Background
==
Documentation states that tasks (cron and task queue) are executed by
a system process with admin priviledges.

To protect task execution from unauthorized execution I originally
protected them with a security constraint in the web.xml file. That
seemed to work OK.

Now, for other reasons, I'd like to protect them with code of my own
in a filter.

I have been trying to confirm admin priviledges in the filter, using
code like this:

public boolean isAdmin() {
UserService user = UserServiceFactory.getUserService();

if ( user.isUserLoggedIn() ) {
return user.isUserAdmin();
}
else {
return false;
}
 }

and I also tried directly:
 return user.isUserAdmin();

without checking for login first.

Problem
===
In both cases this seems to return false, even when when the request
comes from the system to run a task-queue task.
Despite the statement that these requests are run as admin.

Question:
===
Can I use the UserService to check admin permissions when the code is
being run in a request started by the system to serve a cron or task-
queue task?

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.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: GWT wrapper for the client side (javascript) Channel API

2010-12-04 Thread George Moschovitis
 http://code.google.com/p/gwt-gae-channel/

excellent, thanks!
-g.

-- 
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] DataStore embeds equals signs (=) into saved file

2010-12-04 Thread Max
Hi,

My GAE application strips attachments from inbound emails and saves them as 
byte[].  Objectify translates the byte[] to a 
com.google.appengine.api.datastore.Blob (does not utilize BlobStore).  For some 
files, it embeds equal signs in places where the original document doesn't have 
any equal signs.  I've found that MS documents and HTML are rather tolerant of 
this behavior, but PDFs tend to get corrupt when this happens.  Does anyone 
know why these equal signs are added in seemingly random places?  Any other 
advice to get around this?  

Below is an example of the contents of a PDF from the more command.  You can 
see the equal signs from the second representation of the file.

Original file (Good):
1 0 obj

/CreationDate (D:20101203120005)
/Producer (SCS2PDF v1.0 (\251 BeppeCosta, 2005))
/Title (PRINT1)

endobj
2 0 obj

/Type /Catalog
/Pages 3 0 R

endobj

File Snippet After Saving to DataStore (Bad):
1 0 obj

/CreationDate =
(D:20101203120005)
/Producer (SCS2PDF v1.0 (\251 BeppeCosta, =
2005))
/Title (PRINT1)

endobj
2 0 obj

/Type =
/Catalog
/Pages 3 0 R

endobj

Any thoughts?
thanks!
MG

-- 
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] HttpServletRequest.getLocalPort() returns 0

2010-12-04 Thread Simpatico
I'm having the same problem here:
http://sss.mysimpatico.com/server?authentication=unregistered
What was the thank you for?

-- 
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] HttpServletRequest.getLocalPort() returns 0

2010-12-04 Thread Gabriele Kahlout
and btw this happens also with getRemotePort()

-- 
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: URLFetch weirdness

2010-12-04 Thread hector
No, it was failing fast... I was not even seeing the call in my web
service.
In any case, it started working correctly again.  No change on my
part.

I wonder where that appspot was deployed... I have other appspots that
were not experiencing the issue.

On Dec 2, 10:22 pm, Philippe Beaudoin philippe.beaud...@gmail.com
wrote:
 You're not hitting the 10s (or default 5s) timeout of URLFetch by any
 chance? (Could happen if the service is slower than usual.)

 On Dec 2, 2:46 pm, hector hrov...@gmail.com wrote:

  Have you guys noticed any weirdness with URLFetch today?

  One of my appspots is getting intermittent IOException through the
  URLFetchService.  Most of the time it fails, once in a while it goes
  through.  I've verified the target web service and it is up (and has
  been up).

-- 
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: no async queries on AsyncDatastoreService for 1.4.0?

2010-12-04 Thread Luke
i finished updating my server to use the AsyncDatastoreService.  i
also cleaned up my memcache code to batch cache requests.  both of
these changes allowed me to improve the request time by up to 4x for
some requests.  from ~80ms to ~20ms.  now i can prefetch content for
the user with little to no penalty to request latency.  in fact, much
content will have no latency thanks to prefetching :)

the server used to get and set cached objects in memcache for each
command in a batch.  if i have 4 commands in a batch, that could be up
to 8 memcache RPCs as well as the actual work for those commands.
that was pretty wasteful.  so i updated my server to batch all gets
into a getAll, and all puts into a putAll.  that made a big
difference.  the length of each get and put are the same, but now i
have no more than two memcache calls no matter how many commands are
in a batch.  if everything hits the cache, then i don't even need to
do a put...the entire request will finish in about 6ms.

the server also used the synchronous datastore service. so all i/o was
blocking.  now it's been updated to use AsyncDatastoreService.  the
server can kick off all i/o for each command at the beginning of the
request and gather up the results when they finish.

my queries are still blocking...but that doesn't seem to be much of an
impact for now.

thanks to the app engine team for delivering this interface :)

On Dec 3, 11:52 am, Jeff Schnitzer j...@infohazard.org wrote:
 Does it take so much time to process your results that it really
 matters they be done in the optimal order?

 All that polling code is complicated... unless you're shaving off a
 lot of real-world time, seems like it's better to just launch all
 batches and block on the first one.

 Jeff

 On Wed, Dec 1, 2010 at 8:44 PM, Luke lvale...@gmail.com wrote:
  great, thanks for the insight max.

  i have a client that will batch together multiple requests into one
  RPC call to my app on GAE.  each of these individual requests may have
  one or more datastore accesses.  this may include some prefetch
  requests.

  so i want to build a mechanism that will interleave these requests
  taking advantage of theAsyncDatastoreServicefor minimum request
  latency.

  i've gone through my server-side stack and made it asynchronous by
  wrapping RPC returns in Future objects.  then i've created a
  FutureChain object that takes one or more Future objects as input, and
  will return one Future object.  i then have some code that will poll
  the ultimate Future objects until all of them have finished.

  it ends up being a simple multi-threaded emulation where each
  individual request in a batch gets a thread and each thread gives up
  control when it makes an Async request.

  now for the PreparedQuery, because my app knows how many items i want,
  i should be able to wrap it in a special Future object that will try
  to pull in that many items when it is polled...but the problem is, i
  don't know when the batch has come back, so every time i call next(),
  i risk blocking on I/O when i could be initiating another I/O
  asynchronously or processing the results of an async I/O.

  so until there is explicit knowledge of when the I/O for a batch has
  finished, i may be able to get away with reducing the poll-rate of
  queries

  i suppose i could just query for the keys, then i could use an
  explicit Async method to fetch the entities themselves.  if i query
  for keys, will they be split up in batches?  any way to know how many
  keys will be in one batch?

  On Nov 29, 11:08 am, Max Ross (Google) maxr+appeng...@google.com
  wrote:
  Hi Luke,

  First the awesome news:
  As of 1.4.0, many queries are implicitly asynchronous.  When you call
  PreparedQuery.asIterable() or PreparedQuery.asIterator(), we initiate the
  query in the background and then immediately return.  This lets you do work
  while the first batch of results is being fetched.  And, when the first
  batch has been consumed we immediately request the next batch.  If you're
  performing a significant amount of work with each Entity as you iterate you
  will probably see a latency win as a result of this.

  Now the less awesome news:
  We didn't get around to making the List returned by PreparedQuery.asList()
  work this same magic, but you can expect this in a future release.

  Some deeper thoughts:
  The underlying RPCs between your app and the datastore fetch results in
  batches.  We fetch an initial batch of results, and once that batch has 
  been
  consumed we fetch the next batch.  But, there's nothing in the API that 
  maps
  to these batches - it's either a List containing the entire result set or 
  an
  Iterable/Iterator that returns Entities one at a time.  An API that 
  provides
  async access to the individual results returned by an Iterable/Iterator
  (IteratorFutureEntity) doesn't really make sense since you don't know
  which call to hasNext() is going to require a new batch to be fetched, 

[appengine-java] Re: DataStore embeds equals signs (=) into saved file

2010-12-04 Thread Didier Durand
Hi,

somebody already had a problem similar to yours and found the issue
and its solution:
http://groups.google.com/group/google-appengine-python/browse_thread/thread/0ac4ab5266fb3781

Hope it helps
didier

On Dec 4, 9:04 pm, Max 6738...@gmail.com wrote:
 Hi,

 My GAE application strips attachments from inbound emails and saves them as 
 byte[].  Objectify translates the byte[] to a 
 com.google.appengine.api.datastore.Blob (does not utilize BlobStore).  For 
 some files, it embeds equal signs in places where the original document 
 doesn't have any equal signs.  I've found that MS documents and HTML are 
 rather tolerant of this behavior, but PDFs tend to get corrupt when this 
 happens.  Does anyone know why these equal signs are added in seemingly 
 random places?  Any other advice to get around this?  

 Below is an example of the contents of a PDF from the more command.  You 
 can see the equal signs from the second representation of the file.

 Original file (Good):
 1 0 obj
 
 /CreationDate (D:20101203120005)
 /Producer (SCS2PDF v1.0 (\251 BeppeCosta, 2005))
 /Title (PRINT1)

 endobj
 2 0 obj
 
 /Type /Catalog
 /Pages 3 0 R

 endobj

 File Snippet After Saving to DataStore (Bad):
 1 0 obj
 
 /CreationDate =
 (D:20101203120005)
 /Producer (SCS2PDF v1.0 (\251 BeppeCosta, =
 2005))
 /Title (PRINT1)

 endobj
 2 0 obj
 
 /Type =
 /Catalog
 /Pages 3 0 R

 endobj

 Any thoughts?
 thanks!
 MG

-- 
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] Authentication Failed

2010-12-04 Thread Jeevan
hello all,
I developing an application called Cloud based teaching system and its
done! I am registering my google app engine app. I am able to get the
token but I am not able to generate multiple session tokens, and I am
not able to register my app with the google registration key, too.

Authentication Failed this is the error message which is given by my
eclipse

-- 
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: Checking admin priviledges using UserService in a cron/task-queue task execution

2010-12-04 Thread Didier Durand
Hi,

To check if your code is running as a task, you can use the specific
http headers added by GAE: QueueName, TaskName, RetryCount. See
http://code.google.com/appengine/docs/java/taskqueue/overview.html#Task_Request_Headers

If additionally. you made the right security restrictions, you are
pretty safe to assume that you are Admin in a task if those headers
are here.
For the security constraint, see
http://code.google.com/appengine/docs/java/taskqueue/overview.html#Securing_URLs_for_Tasks

It's exactly the same idea for cron jobs: see
http://code.google.com/appengine/docs/java/config/cron.html#Securing_URLs_for_Cron.

So, not a direct answer to your question but a way to reach your goal.

Hope it helps
didier

On Dec 4, 2:38 pm, andrew aute...@gmail.com wrote:
 I am trying to debug some issues with task execution and have a
 question.

 Background
 ==
 Documentation states that tasks (cron and task queue) are executed by
 a system process with admin priviledges.

 To protect task execution from unauthorized execution I originally
 protected them with a security constraint in the web.xml file. That
 seemed to work OK.

 Now, for other reasons, I'd like to protect them with code of my own
 in a filter.

 I have been trying to confirm admin priviledges in the filter, using
 code like this:

         public boolean isAdmin() {
                 UserService user = UserServiceFactory.getUserService();

                 if ( user.isUserLoggedIn() ) {
                         return user.isUserAdmin();
                 }
                 else {
                         return false;
                 }
          }

 and I also tried directly:
          return user.isUserAdmin();

 without checking for login first.

 Problem
 ===
 In both cases this seems to return false, even when when the request
 comes from the system to run a task-queue task.
 Despite the statement that these requests are run as admin.

 Question:
 ===
 Can I use the UserService to check admin permissions when the code is
 being run in a request started by the system to serve a cron or task-
 queue task?

 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.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.