Re: [appengine-java] Re: session management

2010-05-31 Thread Stephan Hartmann
Normally, session cookies are created non-persistent on the browser side,
but you could try to re-set the session cookie in a filter and use
Cookie.setMaxAge(int) to make it persistent, like lembas did with GWT in his
initial post.

For plain Servlet API it could look like:

String sessionId = req.getSession().getId();
Cookie persistentSessionCookie = new Cookie("SESSIONID", sessionId);
persistentSessionCookie.setMaxAge(Integer.MAX_VALUE);
resp.addCookie(persistentSessionCookie);


2010/5/28 romesh soni 

> Hi Stephan,
>  Is that possible that a client had closed the browser and opens a new
> browser and we can still identify the client using session cookies?
>
> Thanks
> Romesh
>
> On Thu, May 27, 2010 at 10:42 PM, Stephan Hartmann 
> wrote:
>
>> Keep in mind that sessions managed by the servlet container expire after a
>> specific time of inactivity on the server side, so if a user comes back
>> after a while with his old session cookie, he will still get a new session.
>> According to the servlet spec, you can obtain this value with
>> HttpSession.getMaxInactiveInterval() and change it with
>> HttpSession.setMaxInactiveInterval(int), with a value of -1 meaning never to
>> expire.
>>
>> Regards,
>> Stephan
>>
>>
>> 2010/5/27 lembas 
>>
>> thanks romesh. I was on vacation did not see your message. sorry for a
>>> late answer.
>>>
>>> I do not "use cookies for managing session". Google does. JESSIONID
>>> cookies is created on server by App Engine anyway. I just extend its
>>> expiration date.
>>> Is it possible to implement "remember me" functionality without
>>> cookies?
>>>
>>> On May 3, 11:22 am, romesh soni  wrote:
>>> > Hey Ikai, sorry I referred you by mistake.. My msg was for lembas
>>> >
>>> >
>>> >
>>> > On Mon, May 3, 2010 at 1:23 PM, romesh soni 
>>> wrote:
>>> > > Hi Ikai,
>>> >
>>> > > the way you are managing session is not good. actually you are using
>>> > > cookies for managing session, which is not a good thing.
>>> > > instead session management is done at server side, not client side.
>>> >
>>> > > On Mon, May 3, 2010 at 1:18 PM, Ikai L (Google) 
>>> wrote:
>>> >
>>> > >> I'm not sure how this mitigates use of the _ah_session records that
>>> are
>>> > >> created. Anytime you set an attribute, it will use this. If you're
>>> worried
>>> > >> about _ah_session getting out of control, a better way would be to
>>> use
>>> > >> Memcache for session data and associate it with a cookie. Stale,
>>> unused
>>> > >> session data will be automatically expired. The advantage of using
>>> the built
>>> > >> in sessions is that since they are backed by both Memcache and the
>>> > >> datastore, they're going to be less volatile.
>>> >
>>> > >> On Sun, May 2, 2010 at 8:46 AM, lembas  wrote:
>>> >
>>> > >>> I have couple of questions about session management. I use GWT+GAE.
>>> I
>>> > >>> do not want my _ah_sessions table to be out of control. I do not
>>> want
>>> > >>> to generate unnecessary sessions.
>>> >
>>> > >>> I have true in my appengine-
>>> > >>> web.xml.
>>> >
>>> > >>> 1.I have the following code at the beginning of my onModuleLoad()
>>> > >>> method, is it ok?
>>> > >>> String sessionid = Cookies.getCookie("JSESSIONID");
>>> > >>> if (sessionid != null) {
>>> > >>>Date now = new Date();
>>> > >>>Date expires = new Date(now.getTime() + (long) 1000 * 60 *
>>> 60 * 24
>>> > >>> *
>>> > >>> 365);
>>> > >>>Cookies.setCookie("JSESSIONID", sessionid, expires);
>>> > >>> }
>>> >
>>> > >>> 2.After the user sends his/her username&password to the server for
>>> the
>>> > >>> first time (i.e. with a new JSESSIONID cookie), I get that "user"
>>> > >>> object from database and if I have it, I save it using:
>>> > >>> getThreadLocalRequest().getSession().setAttribute("user", user);
>>> > >>> and send it to the cli

Re: [appengine-java] Re: session management

2010-05-27 Thread Stephan Hartmann
Keep in mind that sessions managed by the servlet container expire after a
specific time of inactivity on the server side, so if a user comes back
after a while with his old session cookie, he will still get a new session.
According to the servlet spec, you can obtain this value with
HttpSession.getMaxInactiveInterval() and change it with
HttpSession.setMaxInactiveInterval(int), with a value of -1 meaning never to
expire.

Regards,
Stephan


2010/5/27 lembas 

> thanks romesh. I was on vacation did not see your message. sorry for a
> late answer.
>
> I do not "use cookies for managing session". Google does. JESSIONID
> cookies is created on server by App Engine anyway. I just extend its
> expiration date.
> Is it possible to implement "remember me" functionality without
> cookies?
>
> On May 3, 11:22 am, romesh soni  wrote:
> > Hey Ikai, sorry I referred you by mistake.. My msg was for lembas
> >
> >
> >
> > On Mon, May 3, 2010 at 1:23 PM, romesh soni 
> wrote:
> > > Hi Ikai,
> >
> > > the way you are managing session is not good. actually you are using
> > > cookies for managing session, which is not a good thing.
> > > instead session management is done at server side, not client side.
> >
> > > On Mon, May 3, 2010 at 1:18 PM, Ikai L (Google) 
> wrote:
> >
> > >> I'm not sure how this mitigates use of the _ah_session records that
> are
> > >> created. Anytime you set an attribute, it will use this. If you're
> worried
> > >> about _ah_session getting out of control, a better way would be to use
> > >> Memcache for session data and associate it with a cookie. Stale,
> unused
> > >> session data will be automatically expired. The advantage of using the
> built
> > >> in sessions is that since they are backed by both Memcache and the
> > >> datastore, they're going to be less volatile.
> >
> > >> On Sun, May 2, 2010 at 8:46 AM, lembas  wrote:
> >
> > >>> I have couple of questions about session management. I use GWT+GAE. I
> > >>> do not want my _ah_sessions table to be out of control. I do not want
> > >>> to generate unnecessary sessions.
> >
> > >>> I have true in my appengine-
> > >>> web.xml.
> >
> > >>> 1.I have the following code at the beginning of my onModuleLoad()
> > >>> method, is it ok?
> > >>> String sessionid = Cookies.getCookie("JSESSIONID");
> > >>> if (sessionid != null) {
> > >>>Date now = new Date();
> > >>>Date expires = new Date(now.getTime() + (long) 1000 * 60 * 60
> * 24
> > >>> *
> > >>> 365);
> > >>>Cookies.setCookie("JSESSIONID", sessionid, expires);
> > >>> }
> >
> > >>> 2.After the user sends his/her username&password to the server for
> the
> > >>> first time (i.e. with a new JSESSIONID cookie), I get that "user"
> > >>> object from database and if I have it, I save it using:
> > >>> getThreadLocalRequest().getSession().setAttribute("user", user);
> > >>> and send it to the client as a sign of a succesful login.
> >
> > >>> So next time client visits the site with the same JSESSIONID I can
> get
> > >>> the user object directly by:
> > >>> getThreadLocalRequest().getSession().getAttribute("user");
> >
> > >>> ---
> >
> > >>> Is it ok how I use the sesssion management? Is it true that every
> > >>> request comes with the same JSESSIONID (unless client deleted it
> > >>> deliberately), no new session is created on server and server do not
> > >>> need to access database to get the user object?
> >
> > >>> --
> > >>> 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.
> >
> > >> --
> > >> Ikai Lan
> > >> Developer Relations, Google App Engine
> > >> Twitter:http://twitter.com/ikai
> > >> Delicious:http://delicious.com/ikailan
> >
> > >> 
> > >> Google App Engine links:
> > >> Blog:http://googleappengine.blogspot.com
> > >> Twitter:http://twitter.com/app_engine
> > >> Reddit:http://www.reddit.com/r/appengine
> >
> > >>  --
> > >> 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-jav

Re: [appengine-java] Session and AppEngine

2010-05-05 Thread Stephan Hartmann
What is your logic that initiates a session?
The container does not create a session if there is no need for it.
In a servlet you can initiate a session by calling

   HttpServletRequest.getSession(true)

and in a JSP

by adding the attribute

session="true"

to a page directive.

Regards,
Stephan


2010/5/5 Christian Goudreau 

> Hummm I got a weird issue
>
> I added to my appengine-web.xml this line :
> true
>
> But no JSESSIONID cookie is created.
>
> Anyway Idea why ?
>
> Christian
>
> --
> 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.



Re: [appengine-java] Re: Servlet request parameters empty

2010-05-04 Thread Stephan Hartmann
2010/5/4 Rob 

> That did the trick, I love you man! :O)
>
>
:-)


> Now, how would I perform the same with a POST if I needed to?
>
>
If you want to POST your data as key/value pairs like with GET, and jQuery
puts it into the body of the request instead of the query string (i don't
know the implementation details, request parameters as query string are just
fine even if it is a POST request) you have to make sure that the
contentType is the default "application/x-www-form-urlencoded". Just give it
a try.

However, if you want to post the data as JSON fragment (as i would assume
from your original post from the contentType of "application/json"), i think
setting "processData" to "false" could do it. But in your servlet you won't
get the values as request parameters anymore. Instead you have to parse the
input stream of the request, e.g. with Gson to a Java object.

regards,
Stephan


>
> On May 4, 2:07 am, Stephan Hartmann  wrote:
> > if you want to get your data as request parameter, you should use "GET"
> > instead of "POST" and /or let the default contentType
> > "application/x-www-form-urlencoded" and create your json object as either
> >
> > var json = {name: "test"};  // and let jquery convert it to a query
> > string
> > or
> > var json = "name=test";   // the desired query string
> >
> > regards,
> > Stephan
> >
> > 2010/5/4 Rob 
> >
> >
> >
> >
> >
> > > I'm running Google App Engine through IntelliJ Idea and am posting
> > > data to a Servlet using jQuery.ajax. I'm hitting the Servlet without
> > > issue and can return data in the response, however, the request
> > > parameters are always null; I cant seem to POST data. Where am I going
> > > wrong?
> >
> > > var json = JSON2.stringify({name: "test"});
> >
> > > $.ajax({
> > >type: "POST",
> > >url: service,
> > >data: json,
> > >contentType: "application/json; charset=utf-8",
> > >dataType: "json",
> > >async: async,
> > >success: function(o) {
> > > o = $.serviceHelper.jsonSerialize(o);
> > >   callback(o);
> > >},
> > >error: this.dataServiceError
> > >});
> >
> > >protected void doPost(javax.servlet.http.HttpServletRequest
> > > request, javax.servlet.http.HttpServletResponse response) throws
> > > javax.servlet.ServletException, IOException {
> >
> > >PrintWriter out = response.getWriter();
> > >response.setContentType("text/json");
> > >String json = gson.toJson(request.getParameter("name"));
> > >out.println(json);
> >
> > >}
> >
> > > --
> > > 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 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 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.
>
>

-- 
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] Servlet request parameters empty

2010-05-04 Thread Stephan Hartmann
if you want to get your data as request parameter, you should use "GET"
instead of "POST" and /or let the default contentType
"application/x-www-form-urlencoded" and create your json object as either

var json = {name: "test"};  // and let jquery convert it to a query
string
or
var json = "name=test";   // the desired query string

regards,
Stephan


2010/5/4 Rob 

> I'm running Google App Engine through IntelliJ Idea and am posting
> data to a Servlet using jQuery.ajax. I'm hitting the Servlet without
> issue and can return data in the response, however, the request
> parameters are always null; I cant seem to POST data. Where am I going
> wrong?
>
> var json = JSON2.stringify({name: "test"});
>
> $.ajax({
>type: "POST",
>url: service,
>data: json,
>contentType: "application/json; charset=utf-8",
>dataType: "json",
>async: async,
>success: function(o) {
> o = $.serviceHelper.jsonSerialize(o);
>   callback(o);
>},
>error: this.dataServiceError
>});
>
>protected void doPost(javax.servlet.http.HttpServletRequest
> request, javax.servlet.http.HttpServletResponse response) throws
> javax.servlet.ServletException, IOException {
>
>PrintWriter out = response.getWriter();
>response.setContentType("text/json");
>String json = gson.toJson(request.getParameter("name"));
>out.println(json);
>
>}
>
> --
> 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.



Re: [appengine-java] Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.

2010-03-16 Thread Stephan Hartmann
Your JSP file should be not a relative path but absolute, i.e.

*/absoulute/path/to/*mountain.jsp


2010/3/16 Chris 

> Hi,
>
> I've got a strange problem with (I believe) my servlet mapping.  I'm
> trying to map all requests for "/mountain/*" to a JSP file called
> "mountain.jsp".  It works fine when I run it on my localhost, but when
> I upload the project to AppEngine, I get errors like the following:
>
> /mountain/5429370/index.html/index.html/index.html/index.html/
> index.html/index.html/index.html/index.html/...etc
>
> The "/index.html" is repeated over and over until Chrome gives me the
> following error:
> "Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many
> redirects."
>
> Chrome suggests clearing the cookies for the site, but I there are no
> cookies to clear.
>
> Here is my web.xml:
>
> 
> PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>"http://java.sun.com/dtd/web-app_2_3.dtd";>
> 
>
>  
>  mountain
>  mountain.jsp
>  
>
>  
>  mountain
>  /mountain/*
>  
>
>  
>  
>PeakPeekSite.html
>  
>
> 
>
> Has anyone seen this problem or understand what is going on?
>
> Thanks much,
> Chris
>
> --
> 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.



Re: [appengine-java] what if I hit memory limit ?

2010-03-10 Thread Stephan Hartmann
You should use memcache instead of your servlet env. The memcache service
will evict values if you run out of memory.


2010/3/10 Prashant Gupta 

> Hi,
>
> I have designed my app to keep data (within servlet env.) for all previous
> requests. For each request it will first search the data in "servlet env.
> store", if it doesn't find the data here it will fetch data from datastore
> and append the same to "servlet env. store". So, if the same servlet lives
> for longer duration it might accumulate lots of data. What's the risk here?
> What's the upper limit of memory use? What will happen if my app hit this
> upper limit?
>
> 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.
>

-- 
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] Sporadic problems with very high response times

2010-03-04 Thread Stephan Hartmann
Hi Ikai,

i wonder what exactly happens in a loading request before the first
component (piece of code) of an app is hit? In my case it is a
ServletContextListener and the time between the first log entry of the
container for the request and the the log entry from my contextInitialized
method takes more than 5 seconds, e.g.:

03-04 *10:23AM 27.831* /about.html 200 8958ms 6483cpu_ms 8api_cpu_ms 1kb
Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.8) Gecko/20100202
Firefox/3.5.8 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)

 - - [04/Mar/2010:10:23:36 -0800] "GET /about.html HTTP/1.1" 200 1606 ""
"Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.8) Gecko/20100202
Firefox/3.5.8 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)" ""

W 03-04 *10:23AM 33.142*
StartupListener contextInitialized: context initialization starting at: Thu
Mar 04 18:23:33 UTC 2010

Is this to be expected as normal? My app is also cycled out after 1 minute
or so of inactivity.

Regards,
Stephan


2010/3/4 Ikai L (Google) 

> Michael,
>
> (Molson from the IRC office hours?)
>
> Some small percentage of your application's requests will always be
> loading requests, as this is us spinning up a new instance of your
> application to either grow for capacity or tearing down your instance
> and putting it back up as resource allocation demands. We can't
> predict when this will happen. You may want to star this issue:
>
> http://code.google.com/p/googleappengine/issues/detail?id=2456
>
> Startup time is generally a function of several different things:
>
> - Spinning up the JVM (Relatively cheap, but on the order of magnitude
> of 500ms - 1s)
> - How many dependencies are you loading? (Relatively cheap compared to
> JVM spinup)
> - Framework init (Can be VERY expensive - loading up a dynamic
> language runtime will always take a few seconds. Some frameworks will
> also scan every class in your classpath. Spring, for instance, does
> this to look for annotations eagerly on init time)
>
> Strategies to counteract these factors include optimizing for lazy
> loading, which spreads the total load time across acess to several
> different resources. Not many existing frameworks do this.
>
> As your application grows, loading requests should account for a
> smaller and smaller percentage of your total requests. I've seen
> solutions with rich applications that show a static page loading
> dynamic resources as a general landing page. This doesn't solve the
> load time solution, but it meets the user halfway by making a web app
> appear to load faster as opposed to causing a user's brower window to
> be blank while waiting for a request to be handled.
>
> On Tue, Mar 2, 2010 at 4:32 PM, Michael  wrote:
> > Looking at my App Engine logs, I see troubling results when viewing
> > the response times for requests.  In my current log set, the first 80
> > requests all complete in under 100 ms with less than 100 ms of cpu or
> > api time.  Then, oddly, the 83rd request, from the exact same client
> > with the exact same request parameters, takes 7,192 ms to respond with
> > 10,123 cpu ms (and 12 api ms).
> >
> > These kinds of spikes are dotted throughout my logs.  They occur in
> > less than 1% of cases, as far as I can tell, but the spikes are not
> > just large; they're enormous.  I know for a fact that the request
> > parameters and returned data were identical to the requests several
> > seconds before and after from the same client, but the request took
> > about 20 times longer to serve.
> >
> > Does anyone know what causes these large spikes in response time, and
> > can anyone share tricks to help alleviate these spikes?  I know that
> > it is somehow related to instantiating the JVM, but I don't know:
> > - how to reduce the startup time of the JVM
> > - how to predict when GAE will try to start a new JVM
> >
> > Thanks in advance for any advice,
> > - Michael
> >
> > --
> > 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.
> >
> >
>
>
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App Engine
> http://googleappengine.blogspot.com | http://twitter.com/app_engine
>
> --
> 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

Re: [appengine-java] Re: Forwarding a request to a external URL & preserve IP - Can it be done?

2010-03-04 Thread Stephan Hartmann
You won't be able to spoof the source ip address of the requests that your
app sends to your URLs and you don't want to. If you would, the server would
send its response IP packets directly to the original clients.

You could try to set the HTTP request header field "X-Forwarded-For" to the
value of your clients IP address. Of course, the server and / or the
application that you call must support this header.

regards,
Stephan

2010/3/4 mscwd01 

> I dont like "bumping" posts, but this has wasted far too much of my
> time now ;)
>
> Any help would be greatly appreciated.
>
> On Mar 3, 4:47 pm, mscwd01  wrote:
> > Hey,
> >
> > Is there a method in which I can receive a request and then forward
> > the same request to an external URL (not redirect)?
> >
> > Importantly, the IP address of the device which made the initial
> > request MUST be preserved. It must look, to the external URL, that the
> > request came from the device which made the initial request and NOT
> > from the app engine.
> >
> > The reason I need to do this is the external URL returns data whose
> > representation changes regularly. My app engine application will parse
> > this data and return it to my Android application in a format it
> > expects.
> >
> > So is this at all possible?
> >
> > 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.
>
>

-- 
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] getting host headers in Java

2010-03-03 Thread Stephan Hartmann
It is part of the servlet spec:

javax.servlet.ServletRequest.getServerName()


2010/3/3 deuce4 

> Hi, I would like to use the subdomains of my appspot.com domain to set
> initial user parameters.
> I'm not really sure how to do this in Java.  Google provides the
> Python example self.request.headers["Host"].
>
> Can anyone help with the Java code to parsing and processing
> subdomains in the appspot.com url?
>
> 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.
>
>

-- 
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: Problem with persistance

2010-02-25 Thread Stephan Hartmann
2010/2/25 datanucleus 

> > I think in your Offer class you should use getter/setter for mOfferDetail
> > (not a constructor to set the field).
>
> Can't see why that would make the slightest difference. What does
> appear iffy is that if you have a bidirectional relation then the user
> is responsible for setting both sides. I only see Offer.mOfferDetails
> being set and not the other side.
>

isn't setting Offer.mOfferDetails enough for making Offer.getOfferDetails()
returning not null, even if it is a bidirectional relation?


> --
> 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.



Re: [appengine-java] Re: Problem with persistance

2010-02-25 Thread Stephan Hartmann
I think in your Offer class you should use getter/setter for mOfferDetail
(not a constructor to set the field).


2010/2/25 Anton Klotz 

> Hi Jake,
>
> thanks a lot for your answer.
>
> After changing the mappedBy statement to child like this:
>
>@Persistent(mappedBy = "mOfferDetails")
>private Offer mOffer;
>
> and removing mappedBy from parent, Offer object seems to be persisted.
> But when I get this object from the database with:
>
>public Offer getOfferWithId (long id)
>{
>return pm.getObjectById(Offer.class, id);
>}
>
> and try to access child with
>
>System.out.printf(String.format ("Title %s",
> mOffer.getOfferDetails().getOfferDescription() ));
>
> I get following error:
>
>  java.lang.NullPointerException
>at
>
> com.sparradar.server.action.actioncommands.ShowOfferDetailsActionCommand.execute(ShowOfferDetailsActionCommand.java:
> 41)
> at
>
> info.rk.vaadinapp.manager.urldispatching.URLActionDispatcher.handleURI(URLActionDispatcher.java:
> 90)
>at com.vaadin.ui.Window.handleURI(Window.java:358)
>at
>
> com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleURI(AbstractCommunicationManager.java:
> 1830)
>at
>
> com.vaadin.terminal.gwt.server.CommunicationManager.handleURI(CommunicationManager.java:
> 311)
>at
>
> com.vaadin.terminal.gwt.server.AbstractApplicationServlet.handleURI(AbstractApplicationServlet.java:
> 912)
>at
>
> com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:
> 471)
>at
>
> com.vaadin.terminal.gwt.server.GAEApplicationServlet.service(GAEApplicationServlet.java:
> 231)
>at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
> 487)
>at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1093)
>at
>
> com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
> 51)
>at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1084)
>at
>
> com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
> 43)
>at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1084)
>at
>
> com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:
> 121)
>at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1084)
>at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
> 360)
>at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
> 216)
>at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
> 181)
>at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
> 712)
>at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
> 405)
>at
>
> com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:
> 70)
>at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> 139)
>at com.google.appengine.tools.development.JettyContainerService
> $ApiProxyHandler.handle(JettyContainerService.java:352)
>at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> 139)
>at org.mortbay.jetty.Server.handle(Server.java:313)
>at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
> 506)
>at org.mortbay.jetty.HttpConnection
> $RequestHandler.headerComplete(HttpConnection.java:830)
>at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
>at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
>at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
> 396)
>at org.mortbay.thread.BoundedThreadPool
> $PoolThread.run(BoundedThreadPool.java:442)
>
>
> I don't get the error if I try to access eg mOffer.getId(). So my
> interpretation of this error is that either the child object was not
> saved in the database, or it was not fetched from the database. I
> don't know how to verify this.
>
> Thanks,
>
> Anton
>
>
> On 24 Feb., 20:17, Jake  wrote:
> > http://code.google.com/appengine/docs/java/datastore/relationships.ht...
> >
> > "You create a bidirectional one-to-one relationship using fields on
> > both classes, with an annotation on the child class's field to declare
> > that the fields represent a bidirectional relationship. The field of
> > the child class must have a @Persistent annotation with the argument
> > mappedBy = "...", where the value is the name of the field on the
> > parent class."
> >
> > From what I see, you have it backwards, with 

Re: [appengine-java] custom authentication when using Google Apps domain

2010-02-24 Thread Stephan Hartmann
You can use Google Apps Standard accounts or common Google Accounts (e.g.
Goggle mail) as well (you have to choose when you setup your app).
If you choose not to use Google Apps Accounts for your app, you still can
assign it a subdomain of your Google Apps domain.

For implementing your own custom authentication i'd try
http://securityfilter.sourceforge.net/
It has a deployment descriptor-like configuration.
If you choose SecurityFilter, you should take care of static files because
GAE will serve them directly bypassing servlet filters.

Regards,
Stephan


2010/2/24 Houston startup coder 

> We need users to be able to access our app on our domain, so I went
> into my Dashboard and clicked "Add New URL" to set this up, and then
> added a CNAME at GoDaddy.  We use Google Apps for our domain
> internally, but do not want the users of our App Engine app accessing
> Mail, Documents, Sites, etc.  However, my understanding is that the
> only way I could point a subdomain at our App Engine app was to use
> Google Apps and "Add New URL".
>
> We're going to have an installed desktop application access our app
> via ClientLogin, and it's fine if that needs to talk to
> .appspot.com in order to use HTTPS.  The plan is for the
> installed application to hide the credentials it uses to safely
> communicate with our App Engine application behind the scenes.
>
> The only time our users will directly interact with the App Engine app
> is when they login via a web browser.  For that, we'd like to use
> custom authentication because I don't want to have to pay $50/user/
> year for them to access via a Google Apps Premier account.  But it
> sounds like this means we can't safeguard portions of the site with
> the deployment descriptor if we're using custom authentication:
>
>
> http://code.google.com/appengine/docs/java/config/webxml.html#Security_and_Authentication
>
> Is this true?  How can we handle this?
>
> --
> 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.



Re: [appengine-java] Re: How to pass paramters to servlet deployed on GAE?

2010-02-18 Thread Stephan Hartmann
As url-patter i would use
  /test1

or, if you need a path info in your servlet, at least
  /test1*


2010/2/18 barak 

> 
>test1
>com.TestServlet
> 
> 
>test1
>/test1/*
> 
>
>
> On Feb 18, 6:41 pm, Stephan Hartmann  wrote:
> > You sayhttp://appid.appspot.com/test1/hits the servlet. What happens
> > without a trailing slash? Is it redirected?
> > How does your servlet mappings look like?
> >
>
> --
> 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.



Re: [appengine-java] How to pass paramters to servlet deployed on GAE?

2010-02-18 Thread Stephan Hartmann
You say http://appid.appspot.com/test1/ hits the servlet. What happens
without a trailing slash? Is it redirected?
How does your servlet mappings look like?


2010/2/18 barak 

> Hello all,
>
> I've a test servlet to deploy on gae platform, which just read
> paramters from the request and and sysout them. While deploying on the
> development server (via Eclipse plugin) everything works as expected,
> i.e. http://localhost:/test1?p1=v1 causes the servlet to display
> the parameter and its value to the log file.
>
> When deployed to GAE, however, the results are different. Bringing the
> browser to http://appid.appspot.com/test1?p1=v1 causes the browser
> show link-is-broken screen. In the log files there messages like GET /
> test1?p1=v1/ HTTP/1.1" 404.
>
> Accessing http://appid.appspot.com/test1/ do hit the servlet, but the
> parameters map in the request is empty.
>
> So, what is the right way to pass parameters to servlets?
>
> 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.
>
>

-- 
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: how to do initialization at startup?

2010-02-18 Thread Stephan Hartmann
A reliable, high available, scalable and failover tolerant application
requires a distributed environment where various application server
instances run in different Java VMs on different machines with some kind of
loadbalancing in front.
So many things that you have to rethink arise from this change from a single
server / single Java VM approach to a distributed environment with different
Java VMs that do not share the same memory - no matter if it is GAE, JBoss,
Tomcat or whatever application server that supports clustering and
distributed webapps.



2010/2/18 tsp...@green20now.com 

> AJ,
> With GAE, many fundamental assumptions should be questioned. For
> example, why do you need a counter? Most developers use a counter for the
> key, jusst because they always have. With GAE you need to often challange
> the fundamental requirements and rethink the approach.  Overall all I think
> it is good for many developers since thy get in a rut and aply the same
> solution to all problems (over using a design pattern cause it always worked
> before)
>
> Sent from my Verizon Wireless Phone
>
> - Reply message -
> From: "AJ Chen" 
> Date: Wed, Feb 17, 2010 10:52 PM
> Subject: [appengine-java] Re: how to do initialization at startup?
> To: 
>
> There is significant difference between dealing with infrequent crash event
> and dealing with frequent shutdown by GAE. The difference is huge when you
> want to have some intermediate data in memory for performance reason. When
> there is a system crash, you just start over, which is tolerable in most
> cases.  Restarting app by GAE is a total different story because it makes
> storing data in memory no longer a valid approach. For my google app, I see
> it is restarted by GAE even after a few minutes. My usual singleton object
> become useless because the data objects it holds are recreated every few
> minutes. This is why I think GAE's frequent restart behavior is a constraint
> forcing me (probably other developers) to change design pattern, which may
> be good or bad.
>
> In this case, the change is not good, I'm afraid. Let's look at the counter
> example.  Normally it's trivial to keep a counter of some sort on the
> server. But in GAE, it's non-trivial. You can't get a total count from
> datastore easily and storing a counter in memory is not reliable. SO, you
> have to do some creative work-around as proposed in GAE documentation.
>
> Am I making sense? In any case, I'm hoping someone has an easy/reliable way
> to keep tracking a counter in memory within GAE. I'll appreciate any
> suggestion.
>
> -aj
>
> On Wed, Feb 17, 2010 at 1:56 PM, Stephan Hartmann wrote:
>
>> Hi AJ,
>>
>> Your consideration is not specific to GAE. You always have the potential
>> risk that a server could crash and then all your unstored data changes will
>> get lost.
>> So for critical data you should use a write-through cache. However, in a
>> distributed environment like GAE (but not specific to GAE, every standard
>> conform servlet container will support this) you have to take special care
>> to keep the caches of all nodes in sync, or just use a distributed cache
>> like Memcache in GAE.
>>
>> Regards,
>> Stephan
>>
>> 2010/2/17 AJ Chen 
>>
>>> yes, the new console is a good addition. however, because the app can be
>>> shutdown/restarted by GAE at any time, you would still need to put the
>>> initialization code in context listener (or similar place) so that it will
>>> be called automatically when the app is restarted.
>>>
>>>
>>> I just realize a potential major issue in GAE environment, which may
>>> require some paradigm shift in server programming (at least to me). Usually,
>>> one the server side, you may have a singleton class to keep some data
>>> objects closeby as well as updating the data at run time. The data may
>>> change so fast that they are conveniently kept in memory for some time
>>> before put into permanent storage. This is safe because the web server does
>>> not kill the app at will. Now that GAE may kill the app and restart it at
>>> any time, keeping data in memory becomes a big potential problem because the
>>> data will be gone after the app starting. This means you would have to save
>>> the new data into datastore immediately. If you have lots of intermediate
>>> data or temporary data, you have to save them to datastore immediately as
>>> well. This always-using-datastore situation created by GAE may slow down
>>> some applications in addition to a lot more coding for storage.
>>>
>&g

Re: [appengine-java] Re: how to do initialization at startup?

2010-02-17 Thread Stephan Hartmann
Hi AJ,

Your consideration is not specific to GAE. You always have the potential
risk that a server could crash and then all your unstored data changes will
get lost.
So for critical data you should use a write-through cache. However, in a
distributed environment like GAE (but not specific to GAE, every standard
conform servlet container will support this) you have to take special care
to keep the caches of all nodes in sync, or just use a distributed cache
like Memcache in GAE.

Regards,
Stephan

2010/2/17 AJ Chen 

> yes, the new console is a good addition. however, because the app can be
> shutdown/restarted by GAE at any time, you would still need to put the
> initialization code in context listener (or similar place) so that it will
> be called automatically when the app is restarted.
>
> I just realize a potential major issue in GAE environment, which may
> require some paradigm shift in server programming (at least to me). Usually,
> one the server side, you may have a singleton class to keep some data
> objects closeby as well as updating the data at run time. The data may
> change so fast that they are conveniently kept in memory for some time
> before put into permanent storage. This is safe because the web server does
> not kill the app at will. Now that GAE may kill the app and restart it at
> any time, keeping data in memory becomes a big potential problem because the
> data will be gone after the app starting. This means you would have to save
> the new data into datastore immediately. If you have lots of intermediate
> data or temporary data, you have to save them to datastore immediately as
> well. This always-using-datastore situation created by GAE may slow down
> some applications in addition to a lot more coding for storage.
>
> Without knowing what exactly happens when GAE automatically shutdowns the
> app, my worry may be wrong.  Does anyone see the similar issue?  Any
> suggestion for safely keeping data in memory?
>
> -aj
>
>
> On Wed, Feb 17, 2010 at 10:00 AM, Vlad Skarzhevskyy <
> skarzhevs...@gmail.com> wrote:
>
>> There is an Custom Admin Console pages in new SDK 1.3.1.
>> I think the best place to preload the data to your application is
>> using servlet/page exposed in this Console.
>>
>> --
>> 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.
>>
>>
>
>
> --
> AJ Chen, PhD
> Chair, Semantic Web SIG, sdforum.org
> http://web2express.org
> @web2express on twitter
> Palo Alto, CA, USA
> 650-283-4091
> *Monitoring social media in real time*
>
> --
> 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.



Re: [appengine-java] Re: App Engine and Spring slow start up

2010-02-17 Thread Stephan Hartmann
The problem is that the initialization of your app takes longer than 30
seconds.
Pinging your app doesn't help when the app is restarted due to redeployment
or maintenance, or when high traffic demands a second instance.

You should try to reduce your startup time.

regards,
Stephan

2010/2/17 luijar 

> Great, all of our projects are Spring enabled lol. But I guess it's
> good that we are not the only ones seeing this, hopefully it gets a
> little more visibility. We have a cron job (1 min) that tries to keep
> our application alive by hitting a URL, but it does not do a very good
> job. It's frustrating and we don't even have access to the 500 page to
> tell the user to retry or go somewhere else.
>
> On Feb 17, 11:21 am, oth  wrote:
> > Yes we have seen this problem a lot. Per our tests, an application
> > becomes idle after a minute of non activity. So, the unfortunate
> > reality is that you need to keep your app alive by simulating activity
> > on it. Or go the non Spring route.
> >
> > Thanks
> >
> > On Feb 16, 4:14 pm, luijar  wrote:
> >
> > > Hello Google App Engine forum,
> >
> > >   We have been seeing ever since we deployed our applications
> > > (currently 3 of them) that when our application instances become idle
> > > (they have not been hit for x amount of seconds) subsequent requests
> > > return with a 500 response. Logs show a hard deadline exceeded error
> >
> > > com.google.apphosting.runtime.HardDeadlineExceededError: This request
> > > (32306ebe63b71ab0) started at 2010/02/12 20:39:11.984 UTC and was
> > > still executing at 2010/02/12 20:39:41.225 UTC.
> > > at
> > >
> com.google.appengine.runtime.Request.process-32306ebe63b71ab0(Request.java)
> >
> > > And the first line of the log message has the following :
> >
> > > 02-12 12:39PM 14.088
> >
> > > javax.servlet.ServletContext log: Initializing Spring root
> > > WebApplicationContext
> >
> > > Question:
> > > Has anyone else seen this behavior? How long does it take for an
> > > application instance to become idle?
> >
> > > 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.
>
>

-- 
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: filereading error

2010-02-17 Thread Stephan Hartmann
How do you access your file?
I use

ServletContext.getResourceAsStream("/csv/countries.csv");

If you use java.io.File, AFAIK you have to use a path relative to your
webapp folder without leading slash, e.g.

  new File("csv/countries.csv");

regards,
Stephan

2010/2/17 cscsaba 

> Hello Stephan,
>
> I have tried several combination of include path without result.
> http://imagebin.org/85235
> It seems to me something other factor prevent reading this csv.
> Have you tried to read resource file on GAE ?
>
>
> On Feb 17, 7:22 pm, Stephan Hartmann  wrote:
> > i think the correct pattern is "**/*.csv"
> >
> > 2010/2/17 cscsaba 
> >
> > > Hello,
> >
> > > What is the right way to reading files on GAE
> > > I made this preparation below in appengine-web.xml
> > > ...
> > > 
> > >
> > >   
> > > ...
> >
> > > but I got this error:
> > > exception :access denied (java.io.FilePermission \\csv\countries.csv
> read)
> > > / java.securit
> > > nied (java.io.FilePermission \\csv\countries.csv read)
> >
> > > Thanks ahead.
> >
> > > cscsaba
> >
> > > --
> > > 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.
>
>

-- 
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] filereading error

2010-02-17 Thread Stephan Hartmann
i think the correct pattern is "**/*.csv"


2010/2/17 cscsaba 

> Hello,
>
>
> What is the right way to reading files on GAE
> I made this preparation below in appengine-web.xml
> ...
> 
>
>   
> ...
>
> but I got this error:
> exception :access denied (java.io.FilePermission \\csv\countries.csv read)
> / java.securit
> nied (java.io.FilePermission \\csv\countries.csv read)
>
> Thanks ahead.
>
> cscsaba
>
> --
> 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.



Re: [appengine-java] Null Pointer Exception at the time of transaction commit.

2010-02-17 Thread Stephan Hartmann
You should make your entity classes visible to the build path of your client
project.

2010/2/17 Sushama Khadilkar 

>
>
> Thanks Again Stephan Hartmann,But can u tell me one thing ,
>>>
>>  cant we use List or Set or something else for the return type of the
> addEmp() method. because while using Set as a return type in Async
> & in greeting Service i m gettin a error. so plz can u tell it me. Plz
> Plz.
>
> The output is::
>
>
>
> Compiling module com.employeedepartmentgae.Employeedepartmentgae
>Refreshing module from source
>   Validating newly compiled units
>  Removing units with errors
> [ERROR] Errors in
> 'file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/GreetingServiceAsync.java'
>[ERROR] Line 6: The import
> com.employeedepartmentgae.server.domainobject.Employee cannot be resolved
>[ERROR] Line 18: Employee cannot be resolved to a type
> [ERROR] Errors in
> 'file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/GreetingService.java'
>[ERROR] Line 6: The import
> com.employeedepartmentgae.server.domainobject.Employee cannot be resolved
>[ERROR] Line 20: Employee cannot be resolved to a type
> [ERROR] Errors in
> 'file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/EmployeeWidget.java'
>[ERROR] Line 12: The import
> com.employeedepartmentgae.server.domainobject.Employee cannot be resolved
>[ERROR] Line 75: The method addEmp(String, String, String,
> AsyncCallback>) from the type GreetingServiceAsync refers to
> the missing type Employee
>[ERROR] Line 75: The type new
> AsyncCallback>(){} must implement the inherited abstract
> method AsyncCallback>.onSuccess(Set)
>[ERROR] Line 75: Employee cannot be resolved to a type
>[ERROR] Line 94: The method onSuccess(Set) of type
> new AsyncCallback>(){} must override or implement a supertype
> method
>[ERROR] Line 94: Employee cannot be resolved to a type
>[ERROR] Line 96: Employee cannot be resolved to a type
>[ERROR] Line 96: Employee cannot be resolved to a type
>[ERROR] Line 98: Employee cannot be resolved to a type
>  Removing invalidated units
> [WARN] Compilation unit
> 'file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/Employeedepartmentgae.java'
> is removed due to invalid reference(s):
>[WARN]
> file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/EmployeeWidget.java
> [WARN] Compilation unit
> 'file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/DepartmentWidget.java'
> is removed due to invalid reference(s):
>[WARN]
> file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/GreetingService.java
>[WARN]
> file:/home/wissen18/employeedepartmentgae/src/com/employeedepartmentgae/client/GreetingServiceAsync.java
>Computing all possible rebind results for
> 'com.employeedepartmentgae.client.Employeedepartmentgae'
>   Rebinding com.employeedepartmentgae.client.Employeedepartmentgae
>  Checking rule  class='com.google.gwt.user.rebind.ui.ImageBundleGenerator'/>
> [ERROR] Unable to find type
> 'com.employeedepartmentgae.client.Employeedepartmentgae'
>[ERROR] Hint: Previous compiler errors may have made this
> type unavailable
>[ERROR] Hint: Check the inheritance chain from your module;
> it may not be inheriting a required module or a module may not be adding its
> source path entries properly
>
>
>  --
> 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.



Re: [appengine-java] Suggested migration path for Web app using realm auth and offering web service.

2010-02-17 Thread Stephan Hartmann
For authentication you could use Securityfilter (
http://securityfilter.sourceforge.net/) or Acegi (Spring Security,
http://www.acegisecurity.org/)
Don't know if either of them works with GAE. About Acegi there has been
little discussion here on the list i think.

Regards,
Stephan



2010/2/17 AlexC 

> Hi all,
>
> I have an app which is running on Glassfish and serves data via web
> services and BlazeDS. Authentication is handled via realm
> authentication on the app server. My client side is a flex app which
> launches from a secure folder once the user has authenticated.
> Persistence is currently in mysql but all via JPA.
>
> Until now, I've thought it's too much hassle to try and get it working
> on GAE but being someone who doesn't know when to quit, I'd like to
> try again. Does this kind of app sound doable on GAE without too much
> re-work ?
>
> I think GAE support WS now (via Hessian ?) but what about realm
> authentication ? (My clients don't have google accounts so I can't use
> that). Is there any substitute for realm authentication in GAE land ?
>
> Thought I'd ask you all here before I try again in case I'm about to
> run headlong into a world-of-hurt!
>
> Any pointers would be great.
>
> Tks
> Alex
>
> --
> 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.



Re: [appengine-java] Re: Caching pages.

2010-02-17 Thread Stephan Hartmann
You may consider using OSCache (http://www.opensymphony.com/oscache/) for
caching parts of JSPs with its JSP tags or whole responses (don't know if it
works with GAE).

Cheers,
Stephan

2010/2/13 abhi 

> @ bimbo jones ->
> Thanx , thats a good idea, i guess i found out how to use memcache for
> jsps ,
> jsp has a buffer , so i can save it to memcache  :)
>
> @Brain -> The server should cache JSP's for you- > what do you mean by
> that? Do you mean browser cache?
>
> --
> 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.



Re: [appengine-java] Null Pointer Exception at the time of transaction commit.

2010-02-17 Thread Stephan Hartmann
In your addEmp method i would add

dept.getEmployee().add(e)

after you instantiate your new employee object.
If i remember correctly, according to the JPA spec, managing relationships
is up to you.
BTW i would refactor the name of the list field "employee" to "employees"
(and its get and set method).

Regards,
Stephan

2010/2/17 Sushama Khadilkar 

> Thanks Stephan Hartmann,
> But there is another problem now .
> Does the DataStore will have a Foreign Key of Department in Employee?
> And , is it visible in the Employee table?
>
> Following are my POJO's ::
>
>
> /Department///
>
> import java.io.Serializable;
> import java.util.List;
>
> import javax.persistence.Entity;
> import javax.persistence.GeneratedValue;
> import javax.persistence.GenerationType;
> import javax.persistence.Id;
> import javax.persistence.OneToMany;
>
> import com.google.appengine.api.datastore.Key;
>
>
> /**
>  * @author Sushama Khadilkar.
>  *
>  * Create Date : 17-Feb-2010
>  */
> @SuppressWarnings("serial")
> @Entity
> public class Department implements Serializable{
>
> @Id
> @GeneratedValue(strategy=GenerationType.IDENTITY)
> private Key dept_id;
>
> private String dept_name;
>
> private String head;
>
> @OneToMany(mappedBy="department")
> public Listemployee;
>
>
> public Key getDept_id() {
> return dept_id;
> }
>
>
> public void setDept_id(Key dept_id) {
> this.dept_id = dept_id;
> }
>
>
> public String getDept_name() {
> return dept_name;
> }
>
>
> public void setDept_name(String dept_name) {
> this.dept_name = dept_name;
> }
>
>
> public String getHead() {
> return head;
> }
>
>
> public void setHead(String head) {
> this.head = head;
> }
>
>
> public List getEmployee() {
> return employee;
> }
>
>
> public void setEmployee(List employee) {
> this.employee = employee;
> }
>
>
>
>
> }
>
>
>
> //Employee/
>
> import java.io.Serializable;
>
> import javax.persistence.CascadeType;
> import javax.persistence.Entity;
> import javax.persistence.GeneratedValue;
> import javax.persistence.GenerationType;
> import javax.persistence.Id;
> import javax.persistence.ManyToOne;
>
> import com.google.appengine.api.datastore.Key;
>
>
> /**
>  * @author Sushama Khadilkar.
>  *
>  * Create Date : 17-Feb-2010
>  */
> @SuppressWarnings("serial")
> @Entity
> public class Employee implements Serializable{
>
> @Id
> @GeneratedValue(strategy=GenerationType.IDENTITY)
> private Key emp_id;
>
> private String emp_name;
>
> private String emp_sal;
>
> @ManyToOne(cascade = CascadeType.ALL)
> private Department department;
>
>
> public Key getEmp_id() {
> return emp_id;
> }
>
>
> public void setEmp_id(Key emp_id) {
> this.emp_id = emp_id;
> }
>
>
> public String getEmp_name() {
> return emp_name;
> }
>
>
> public void setEmp_name(String emp_name) {
> this.emp_name = emp_name;
> }
>
>
> public String getEmp_sal() {
> return emp_sal;
> }
>
>
> public void setEmp_sal(String emp_sal) {
> this.emp_sal = emp_sal;
> }
>
>
> public Department getDepartment() {
> return department;
> }
>
>
> public void setDepartment(Department department) {
> this.department = department;
>
> }
>
>
>
>
> }
>
>
>  --
> 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.



Re: [appengine-java] how to do initialization at startup?

2010-02-17 Thread Stephan Hartmann
Your app becomes shut down if it does not receive any requests for some
time. After that, the next request will initiate a new startup sequence, so
the implementation of the servlet spec is correct.

You should also implement ServletContextListener.contextDestroyed() to
perform cleanup of your data, if needed.

Regards,
Stephan


2010/2/17 AJ Chen 

> For standard web app, I use a context listener servlet to do initialization
> at startup. This also works in eclipse with GAE plugin, i.e. the context
> listener is called only once at startup. But, it does not work in production
> because the context listener servlet is called frequently. It seems GAE
> restarts the context or something that triggers the call to the listener
> servlet. SO, the question is:  what's the right way to do one-time
> initialization (e.g. pre-load data) in GAE? Maybe GAE does not have the
> concept of initialization. Any suggestion is appreciated.
> -aj
>
> --
> AJ Chen, PhD
> Chair, Semantic Web SIG, sdforum.org
> http://web2express.org
> @web2express on twitter
> Palo Alto, CA, USA
> 650-283-4091
> *Monitoring social media in real time*
>
> --
> 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.



Re: [appengine-java] Null Pointer Exception at the time of transaction commit.

2010-02-17 Thread Stephan Hartmann
Could you please provide the source of your Employee and Department classes?
And AFAIK you must not use full qualified class names in queries but the
simple class name ("Department" only).

Regards,
Stephan

2010/2/16 Sushama Khadilkar 

> package com.wissen.enterprisebysush.server;
>
> import java.util.List;
>
> import javax.jdo.JDOHelper;
> import javax.jdo.PersistenceManager;
> import javax.jdo.PersistenceManagerFactory;
> import javax.jdo.Transaction;
> import javax.persistence.EntityManager;
> import javax.persistence.EntityManagerFactory;
> import javax.persistence.EntityTransaction;
> import javax.persistence.Persistence;
> import javax.persistence.Query;
>
> import com.google.gwt.user.client.Window;
> import com.google.gwt.user.server.rpc.RemoteServiceServlet;
> import com.wissen.enterprisebysush.client.GreetingService;
> import com.wissen.enterprisebysush.server.domainobject.Department;
> import com.wissen.enterprisebysush.server.domainobject.Employee;
>
> /**
>  * The server side implementation of the RPC service.
>  */
> @SuppressWarnings("serial")
> public class GreetingServiceImpl extends RemoteServiceServlet implements
> GreetingService {
>
> EntityManagerFactory emf =
> Persistence.createEntityManagerFactory("transactions-optional");
>
> public String greetServer(String input) {
> String serverInfo = getServletContext().getServerInfo();
> String userAgent = getThreadLocalRequest().getHeader("User-Agent");
> return "Hello, " + input + "!I am running " + serverInfo +
> ".It looks like you are using:" + userAgent;
> }
>
> @SuppressWarnings("unchecked")
> public void addDept(String dept_name, String dept_head) {
>
> EntityManager em = null;
>
> try {
> em = emf.createEntityManager();
> em.getTransaction().begin();
> Department d = new Department();
> d.setDept_name(dept_name);
> d.setHead(dept_head);
>
> Query q = em.createQuery("select from
> com.wissen.enterprisebysush.server.domainobject.Department d");
> List deptList = q.getResultList();
>
> for (Department dept : deptList) {
> System.out.println("Department name: " +
> dept.getDept_name());
> }
>
> em.persist(d);
>
> } finally {
> em.getTransaction().commit();
> em.close();
>
> }
>
> }
>
> public void addEmp(String emp_name, String emp_sal, String did) {
> EntityManager em = emf.createEntityManager();
> try {
>
>
> String s = did;
>
> EntityTransaction transaction = em.getTransaction();
> transaction.begin();
> System.out.println("value of Department_name is::" + s);
> System.out.println("Transaction is active and
> is::"+transaction);
>
> //Query q = em.createQuery("select dept_id from
> com.wissen.enterprisebysush.server.domainobject.Department d where
> d.dept_name = ?1");
> //q.setParameter(1, s);
> //System.out.println("Name of Department is::" +
> s);
> //Department dept = (Department)
> q.getSingleResult();
>
> Query q = em.createQuery("select from
> com.wissen.enterprisebysush.server.domainobject.Department d");
> Department dept = (Department) q.getResultList().get(0);
> System.out.println("Name of Department is::" +
> dept.getDept_name());
>
> //System.out.println("Query executed
> Successfully!!" + q.getSingleResult());
> Employee e = new Employee();
> e.setEmp_name("Abcdh");
> e.setEmp_sal("5000");
> e.setDepartment(dept);
> em.persist(e);
>
> System.out.println("Transaction: " + transaction);
>
> transaction.commit();
> em.close();
>
> } catch (NullPointerException e) {
> e.printStackTrace();
> System.out.println("Exception::" + e.getCause());
> } finally {
>
> }
> }
>
> }
>
>
> Output is::
>
>
> The server is running at http://localhost:8090/
> value of Department_name is::Production
> Transaction is active and
> is::org.datanucleus.jpa.entitytransactioni...@1a21c7d
> Name of Department is::Accounts
> Transaction: org.datanucleus.jpa.entitytransactioni...@1a21c7d
> java.lang.NullPointerException
> Exception::nullat
> com.google.appengine.api.datastore.KeyFactory.stringToKey(KeyFactory.java:181)
> at
> org.datanucleus.store.appengine.DatastoreElementContainerStoreSpecialization.extractElementKey(DatastoreElementContainerStoreSpecialization.java:170)
> at
> org.datanucleus.store.appengine.DatastoreAbstractCollectionStoreSpecialization.contains(DatastoreAbstractCollectionStoreSpecialization.java:57)
> at
> org.datanucleus.store.mapped.scostore.AbstractCollectionStore.contains(AbstractCollectionStore.j

Re: [appengine-java] Mail API / Sender Email Address

2010-02-16 Thread Stephan Hartmann
You could try to login to app-engine with your google apps account under
https://appengine.google.com/a//

Of course you have to create and deploy a new app instance in this account.

I guess it is related to the fact that real google accounts (like google
mail) and google apps accounts use different authentication infrastructures.

Regards,
Stephan


2010/2/14 Henning 

> Hello,
>
> I have set up my own .com domain on Google apps, set the CNAME entries
> and I can now access my google app engine project through my own .com
> address rather than appspot. I set up google mail as a google app on
> my domain too.
>
> If I have now a google mail account like m...@mydomain.com and my app
> runs on www.mydomain.com how can I send with my application emails
> with sender address "m...@mydomain.com" ? In the doc there it is said
> that only addresses of admins or developers are valid. I tried to
> create a new developer "m...@mydomain.com" but that does not work (no
> invitation email ever arrives). If I send an email from hotmail to
> m...@mydomain.com it arrives.
>
> What can I do ? I have a registration form and the password should be
> sent to the user by email. I don't want to provide the user my fancy
> hotmail address I used to register on app engine / google accounts
> originally.
>
> Thank you,
> Henning.
>
> --
> 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.



Re: [appengine-java] Content caching and Compression

2010-02-16 Thread Stephan Hartmann
AFAIK gzip compression is turned on by default. You can verify this by
looking at the content-encoding response header (i use the Live HTTP headers
plugin for firebug/firefox).

Regards,
Stephan

2010/2/15 zainul franciscus 

> I was browsing through Google App Engine feature documentation. In
> certain page I found that Google App Engine does not support gzip
> compression  nor content caching but on other page Google said that
> they have incorporated gzip compression feature in app engine.
>
> Does any body know whether google app engine support gzip compression
> and content caching ? If yes how can we do it.
>
> Cheers,
> Zainul Franciscus
>
> --
> 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.



Re: [appengine-java] Re: App instance recycling and response times - is there solution?

2010-01-14 Thread Stephan Hartmann
Jeff,

in one point i disagree.

In a high available einvironment you would have a cluster of load balanced
application servers and you would deploy new versions of your app in turn,
one at a time.
So if one instance is down the other(s) will continue serving your users
(though it might require sticky sessions).
Of course, this is a must for enterprise applications.

Regards,
Stephan


2010/1/13 Jeff Schnitzer 

> I've been thinking about this issue a little.  It's not quite as
> straightforward as just keeping an instance warm.  Even if you have an
> app that gets multiple hits per second, there will still be cold
> starts:
>
>  * When a new instance comes online to serve more demand.
>  * When you redeploy a version of your app.
>
> Is appengine smart about letting new instances added to the pool "warm
> up" before serving requests?  It's hard to tell from my logs but it
> doesn't look like it.
>
> I know appengine is *not* smart about warming up an instance before
> redeploying.  When I redeploy, some large number of users must wait
> while the appserver(s) startup.
>
> One thing to keep in mind during these discussions is how other Java
> EE environments solve this problem:  They *don't*.  For a long time
> it's been assumed in the EE development that server initialization
> time is irrelevant, and we grew fat libraries that take tens of
> seconds to minutes to start up.  The problem is, this time has *never*
> been irrelevant - even in a production environment you must deploy new
> versions of your app, and none of the appservers I'm familiar with are
> smart enough to keep serving off the old version while the new one
> loads.  Users with unlucky timing always got screwed.
>
> We just didn't care because we only deployed code once a week and we
> added/removed server instances far less often than that.  Well guess
> what, now it's easy - you can deploy up to 1,000 times per day just by
> clicking a button in eclipse, and server provisioning is now not only
> trivial but 100% transparent to you.  Just try that with WebSphere!
>
> You aren't going to like this, but here's the only answer that isn't
> going to piss off your customers:  Stop using Spring.  Stop performing
> eager initialization.  Stop assuming that users don't see startup
> time.  Yes, change the way you write code.
>
> Jeff
>
> On Tue, Jan 12, 2010 at 1:11 PM, Don Schwarz  wrote:
> > Make sure you are using offline precompilation.  We are always working on
> > optimizations to decrease the latency of loading requests, but here are
> some
> > other tips:
> >
> http://googleappengine.blogspot.com/2009/12/request-performance-in-java.html
> > On Tue, Jan 12, 2010 at 3:01 PM, Locke  wrote:
> >>
> >> I agree that making users wait 20 seconds for your app to load is not
> >> adequate for the vast majority of apps. I also agree that
> >> reengineering everything to try and hide load times from users is a
> >> poor solution in most cases.
> >>
> >> Using cron to keep your app loaded will not consume your quota; it
> >> will actually conserve your quota. Every time your app loads you will
> >> be billed for 20s of CPU time. If you keep it loaded, you will only be
> >> billed for a few milliseconds per 'keep-alive' cron execution.
> >>
> >> However, the Google engineers who post here have recommended against
> >> doing this. If everyone did it, appengine might run out of resources
> >> (RAM, I assume).
> >>
> >> I imagine that Google will need to either find a way to load apps in
> >> 1/10th the time (the ideal solution), raise prices significantly, or
> >> ration  resources in some other way.
> >>
> >> If I may make a suggestion to the Google engineers: offer a "keep my
> >> app loaded" option and make it available ONLY for billing-enabled
> >> apps. Disable cron for apps which are not billing-enabled, so that
> >> people who just want free hosting or are merely toying with appengine
> >> won't be using up resources all the time.
> >>
> >> This way, the people who have shown that they are serious about
> >> appengine (by laying their cash down) won't be driven away by the
> >> people who are just fooling with it.
> >
> > Yes, we are seriously considering something like this.  Please star this
> > issue for updates:
> > http://code.google.com/p/googleappengine/issues/detail?id=2456
> >
> >>
> >> On Jan 12, 1:43 pm, Konrad  wrote:
> >> > I asked same question on Stack Overflow (http://stackoverflow.com/
> >> >
> questions/2051036/google-app-engine-application-instance-recycling-and-
> >> > response-times).
> >> >
> >> > So far proposed solutions (in SO thread and found on other websites)
> >> > do not satisfy me. Creating cron or any other kind of periodic HTTP
> >> > requests to keep instance up and running make no sense. First - there
> >> > is no evidence that this instance will serve next coming request (eg.
> >> > from different network location etc.), second - it will consume Quota
> >> > (which is less a problem).
> >> >
> >> > Other solutio

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

2010-01-14 Thread Stephan Hartmann
Threads do not end when they finished serving a request. Instead they will
catch up another request in the queue and serve it.
So basically at the end of your service method of your servlet you should
explicitly set the value of your ThreadLocal to null, prefferably in a
finally block.


2010/1/14 Prashant Gupta 

> anyone???
>
> 2010/1/12 Prashant Gupta 
>
> Hi,
>>
>> Thanks guys for looking into this.
>>
>> All requests to my app pass through a single servlet, say *Main*. So, I
>> thought I need not to add additional filter and I used a ThreadLocal
>> variable to store session id :
>>
>> public static final ThreadLocal sessionID = new
>> ThreadLocal();
>>
>> And for every request I am doing
>>
>> if(*Main*.sessionID.get() == null)
>>
>> *Main*.sessionID.set(req.getSession().getId());
>>
>> But it doesn't seem to work. According to my understanding 
>> *Main*.sessionID.get()
>> should be null each new session (or each new request, I am not sure here).
>> Did I get something wrong?
>>
>>
>> 2010/1/9 A1programmer 
>>
>>>  You probably want to architect the classes in such a way that they are
>>> not tightly coupled to the http servlet session.
>>>
>>> Anyway, when you were working with ThreadLocal earlier, did you first
>>> set the ServletRequest from the filter?
>>>
>>> class UserService {
>>>private UserDAO userDAO;
>>>
>>>   public Collection  getItemsForUser(User user){
>>>  return userDao.getItemsForUser(user);
>>>   }
>>>
>>> }
>>>
>>>
>>> class UserDAO {
>>>
>>>   public Collection getItemsForUser(User user) {
>>>
>>>   Long userId = user.getId();
>>>   String userName = user.getUserName();
>>>
>>>   // query the database based on user information
>>>
>>>   }
>>>
>>> }
>>>
>>> On Jan 9, 3:53 am, Prashant Gupta  wrote:
>>> > I tried following code, getting null all the time.
>>> >
>>> > public static HttpSession getSession(){
>>> > return new ThreadLocal().get().getSession();
>>> >
>>> > }
>>> >
>>> > 2010/1/9 Elias MÃ¥rtenson 
>>> >
>>> >
>>> >
>>> > > On 9 Jan, 01:27, Prashant Gupta  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.com>> 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.
>>>
>>>
>>>
>>>
>>
>
> --
> 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.



Re: [appengine-java] Re: /a/domain.com/ Logic

2009-12-07 Thread Stephan Hartmann
I'd suggest that you add your single app to your customer's apps account
under a dedicated alias.
E.g. if your customer's domain is customer1.com you would add the app as
yourapp.customer1.com.
You repeat this for every customer's google apps domain.
Then in your application you can identify which customer's domain is used by
calling

javax.servlet.ServletRequest.getServerName()

Best regards,
Stephan


2009/12/6 patrick 

>
> Hello
>
> I'm trying to build an application wich can be deployed to diffrent
> google apps custmer, and each of them shoud have there own enviorment,
> like gmail, docs, ...
> But i don't like to deploy it to each customer app engine. Is there
> such a funtion?
>
>
> On 14 Okt., 22:24, "Jason (Google)"  wrote:
> > What are you trying to do exactly? Are you just looking to segment your
> > application for various domains/clients?
> > - Jason
> >
> > On Mon, Oct 12, 2009 at 12:37 PM, patrick  >wrote:
> >
> >
> >
> >
> >
> > > Is there a API or a Function at Google to use this /a/domain.com/
> > > Logic. How Google use it for his APPS applikations?
> >
> > > If ther isn't such a function, how is the best way to implement it?
> > > Dose someone have experience?
>
> --
>
> 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.




Re: [appengine-java] Problem in uploading jsp file

2009-11-24 Thread Stephan Hartmann
You are using a Java Runtime Environment (JRE) which does not include a 
compiler.

You have to use a JDK instead.

Regards,
Stephan


sahil mahajan schrieb:
>
> Hello
>
> I am working on java google app engine. When I try to upload my 
> application, I receive following error
>
>
> Error Details:
>
> Nov 24, 2009 10:18:11 PM org.apache.jasper.JspC processFile
>
> INFO: Built File: \addressbook.jsp
>
> java.lang.IllegalStateException: cannot find javac executable based on 
> java.home
>
> , tried "C:\Program Files\Java\jre1.6.0_04\bin\javac.exe" and 
> "C:\Program Files\
>
> Java\bin\javac.exe"
>
> Unable to upload app: cannot find javac executable based on java.home, 
> tried "C:
>
> \Program Files\Java\jre1.6.0_04\bin\javac.exe" and "C:\Program 
> Files\Java\bin\ja
>
> vac.exe"
>
>
> If I remove addressbook.jsp file, error does not occur
>
> What could be the reason?
>
> --
>
> 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.




Re: [appengine-java] Re: Xalan

2009-11-19 Thread Stephan Hartmann
It seems that the classes of the JSTL are loaded by a different 
classloader than the webapp classloader.
Because this class loader does not have xalan in place, it fails.

Could you please add xalan to the classpath of this classloder?
(If i do this in the eclipse plugin, it works, but only in the local dev 
environment of course).

I added this as a comment on issue 2180.

Regards,
Stephan

metamesh schrieb:
> Hi,
>
> I have the same problem when using the xml tags of jstl with appengine
> 1.2.6.
>
> I also tried to put the missing class into the WEB-INF/classes/...
> folder but still no success.
>
> Note that
> http://code.google.com/p/googleappengine/issues/detail?id=2180
> has not a fix but only verifies that the class
> org.apache.xpath.VariableStack is available at compile time but not at
> run time.
>
> Regards,
> Stephan
>
>
> On Oct 5, 7:18 pm, "Jason (Google)"  wrote:
>   
>> Can you confirm that the tip 
>> inhttp://code.google.com/p/googleappengine/issues/detail?id=2180(see the
>> second comment) works for you?
>>
>> - Jason
>>
>> On Wed, Sep 30, 2009 at 9:17 AM, Maniacs  wrote:
>>
>> 
>>> I tried to use JSTL xml tags and I got the following
>>> exception :java.lang.NoClassDefFoundError: org/apache/xpath/
>>> VariableStack
>>>   
>>> However, I put in WEB-INF/lib the file xalan.jar.
>>>   
>>> Is xalan incompatible with app-engine ?
>>>   
>>> Regards
>>>   
>
> --
>
> 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=.