[appengine-java] Re: Getting Started: Using JSPs

2009-08-25 Thread Alexander Arendar
Make sure you are using JDK, not just a JRE so your jsps can be compiled.
Also JSP editor in Eclipse is not very clever :) Sometimes it marks valid
jsps as corrupted. Closing and reopening editor sometimes helps.

On Tue, Aug 25, 2009 at 12:30 PM, Valentino Hankypants wrote:

>
> hello together,
>
> i'm starting with development of google AppEngine. i tried to go
> through the getting started in the user doc. but i come to a problem.
> Up to this point i do not have problems with the getting started
> "tutorial".
> my problem:
>
> in the tutorial is mentioned that the guestbook app will use JSP
> pages. if i add the *.jsp into the eclipse framework at the
> recommended position (in the war directory) eclipse marks the JSP as
> corrupted (with this nice red icon) without any suggestion why this
> file is not wanted at the current position.
>
> any ideas what there is the problem??? would be great...
>
> greatz
> valentino
> >
>

--~--~-~--~~~---~--~~
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-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: about values

2009-10-20 Thread Alexander Arendar

People, it would be great for me to know this as well.
Is there anyone who knows how to do this properly?

On Oct 19, 4:09 pm, Prashant  wrote:
> hi,
>
> i added a new column to my data table, as it is newly added it is showing
>  as column values in datastore. now i want to initialize those
>  values to some value, say 0. how do i do that programmatically? i
> tried using "column == null" as filter but that doesn't work.
--~--~-~--~~~---~--~~
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-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: programatically upload files to datastore

2009-10-20 Thread Alexander Arendar
Hi,

it seems ok.
I use the same way ApacheIO just I have regular UI form. But it's no matter
if you fire POST http request from the HTML form or if that is done
programatically.
Just test and make sure it works.

Sincerely,
Alex

On Tue, Oct 20, 2009 at 6:17 PM, Houston startup coder <
stephenh...@gmail.com> wrote:

>
> I haven't actually tested this code yet since I got sidetracked with
> some other stuff.  But I basically worked off of the example farther
> down this page:
>
> http://code.google.com/appengine/kb/java.html
>
> Then I just modified it to save the file data as an attribute to an
> object I want to persist to the datastore.  So does anyone know if
> this is what I should be doing to have a desktop app upload files in
> the background to Google App Engine?  Should they be going through a
> servlet if it's not an actual human user filling out a file upload
> form on a webpage?
>
> Here's my code:
>
>
>
> import org.apache.commons.fileupload.FileItemStream;
> import org.apache.commons.fileupload.FileItemIterator;
> import org.apache.commons.fileupload.servlet.ServletFileUpload;
>
> import org.apache.commons.io.IOUtils;
>
> import java.io.InputStream;
> import java.io.IOException;
> import java.util.logging.Logger;
>
> import javax.jdo.PersistenceManager;
> import javax.servlet.ServletException;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
> import com.google.appengine.api.datastore.Blob;
> import com.ideate.PMF;
>
> public class FileUploader extends HttpServlet {
>  private static final Logger log =
>  Logger.getLogger(FileUploader.class.getName());
>
>  public void doPost(HttpServletRequest req, HttpServletResponse res)
>  throws ServletException, IOException {
>try {
>  ServletFileUpload upload = new ServletFileUpload();
>  res.setContentType("text/plain");
>
>  FileItemIterator iterator = upload.getItemIterator(req);
>  while (iterator.hasNext()) {
>FileItemStream item = iterator.next();
>InputStream stream = item.openStream();
>
>if (item.isFormField()) {
>  log.warning("Got a form field: " + item.getFieldName());
>} else {
>  log.warning("Got an uploaded file: " + item.getFieldName() +
>  ", name = " + item.getName());
>
>  // You now have the filename (item.getName() and the
>  // contents (which you can read from stream).  Here we just
>  // print them back out to the servlet output stream, but you
>  // will probably want to do something more interesting (for
>  // example, wrap them in a Blob and commit them to the
>  // datastore).
>
>  Blob uploadedImage = new Blob(IOUtils.toByteArray(stream));
>
>  Photo photo = new Photo();
>  photo.setName(item.getName());
>  photo.setImageData(uploadedImage);
>
>  PersistenceManager pm = PMF.get().getPersistenceManager();
>  try {
>  pm.makePersistent(photo);
>  } finally {
>  pm.close();
>  }
>
>  /*
>  int len;
>  byte[] buffer = new byte[8192];
>  while ((len = stream.read(buffer, 0, buffer.length)) != -1)
> {
>res.getOutputStream().write(buffer, 0, len);
>  }
>  */
>}
>  }
>} catch (Exception ex) {
>  throw new ServletException(ex);
>}
>  }
> }
>
>
> THE END
>
> Thanks for any help...
>
>
>
>
>
> On Oct 19, 12:18 pm, Abhinav Lele  wrote:
> > Could you share your code for the servlet that handles file uploads. I
> have
> > been not able to get that working. Thanks in advance
> > --
> > Abhinav
> >
> > -_[No constructors were harmed in the writing of this post. Any
> resemblance
> > to objects living or dead is purely coincidental]_-
> >
> > On Mon, Oct 19, 2009 at 7:40 AM, Houston startup coder <
> >
> >
> >
> > stephenh...@gmail.com> wrote:
> >
> > > I need to upload images, sound files and text documents from a mostly
> > > standalone client PC application to a GAE app. I'm following the file
> > > upload example in the Google App Engine for Java documentation and
> > > using the Apache Commons ServletFileUpload to stream in the data and
> > > then save it with the PersistenceManager.
> >
> > > Uploading through a servlet seems just fine, but I took a step back to
> > > wonder whether a servlet was the best way to upload these files to GAE
> > > since this isn't a human choosing files on a webpage but rather some
> > > software programatically sending the files up to the server.  Is a
> > > servlet my best choice in this case?
> >
> > > 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-java@googlegroups.com
To unsubscribe from this group, send email t

[appengine-java] Re: about values

2009-10-22 Thread Alexander Arendar

Hi Jason,

maybe my question is a trivial for you but still:
how melodramatically should I detect when the value is NOT set?
As you already explained i can't use ==null. What should I use
instead?

Sincerely,
Alex

On Oct 21, 9:36 pm, "Jason (Google)"  wrote:
> No. If an entity does not have a value set for a particular property (null
> IS a value, different from ), then it won't appear in any query
> results involving that property. You'll need to continue sifting through
> every entity to see if a value is set, and if not, setting it directly.
> - Jason
>
> On Mon, Oct 19, 2009 at 6:09 AM, Prashant  wrote:
> > hi,
>
> > i added a new column to my data table, as it is newly added it is showing
> >  as column values in datastore. now i want to initialize those
> >  values to some value, say 0. how do i do that programmatically? i
> > tried using "column == null" as filter but that doesn't work.
>
>
--~--~-~--~~~---~--~~
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-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] java.util.Timer is in the white list but you can't use it

2009-12-25 Thread Alexander Arendar
Hi ppl,

please explain me. Maybe I'm kinda stupid but we have java.util.Timer
class in the white list.
But actually you can't use this class since GAE forbids threads
instantiation.
Now a simple straightforward question: why the heck the class is in
the whitelist? Just for fun?

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




Re: [appengine-java] Re: sending mail in google app engine in java

2010-02-18 Thread Alexander Arendar
You don't need any third party server.
Just reserve one of your deployed apps as your test server and test all your
mail-sending stuff there.
As Conor already explained you can't send mails testing locally.

On Thu, Feb 18, 2010 at 2:00 PM, lakshmi  wrote:

> Thanks cowper,
> really you did a great help to me.Nearly i am searching for this
> clarity for two weeks.Thank you very much.
> But what can i do for sending emails from google app engine.
> Is there any need with third party server.can you mention those
> details also please.
>
>
>
> Thanks,
> Lakshmi.
> On Feb 18, 3:48 pm, Conor Power  wrote:
> > The admin is an email address for some configured as an application
> > developer from the application console.
> >
> > If you're testing from local SDK the email does not get sent so that
> could
> > be the issue. However for me I see log statements to the effect that the
> > email is being sent so you should be seeing the same unless you have
> logging
> > configured to output very little.
> >
> > cowper
> >
> >
> >
> > On Thu, Feb 18, 2010 at 8:14 AM, lakshmi  wrote:
> > > Hi Sreekanth,
> >
> > > Thanks for your reply.Admin address means with which we enter in to
> > > admin console.Isn't it.
> > > That is my e-mail address, right.Even  that too not working.can you
> > > tell me clearly,please.
> >
> > > On Feb 18, 12:12 pm, Sreekanth Raju  wrote:
> > > > in order to send mail in app engine, from address should be either
> admin
> > > or
> > > > developer email id
> >
> > > --
> > > 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.- Hide
> quoted text -
> >
> > - Show quoted text -
>
> --
> 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] Editing records in datastore (using JAVA)

2010-02-18 Thread Alexander Arendar
Hi Manjoor,

if you are learning JDO you should read this article:
http://code.google.com/appengine/docs/java/datastore/creatinggettinganddeletingdata.html
There is a small part on updating the objects.

On Thu, Feb 18, 2010 at 5:55 PM, Manjoor  wrote:

> I have been searching for sample java program to add, edit and delete
> records. I found many example showing how to add and delete records
> but not a single about editing. Do anyone have a sample source link to
> show how to edit a record ???
>
> --
> 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: Editing records in datastore (using JAVA)

2010-02-19 Thread Alexander Arendar
Hi Manjoor,

you should also call after all these pm.close() and you'll see the result :)
JDO persist the object really at the moment when you are closing the
persistence manager.

On Fri, Feb 19, 2010 at 7:44 AM, Manjoor  wrote:

> Thanks for the reply but it does not work. Have a look at this.
>
> I have checked it in debugger, It successfuly fetch desired record.
> but after changing it does not saved. No error :(
>
>  SMSUser u = pm.getObjectById(SMSUser.class,tu.UserId);
>u.ContractPerson =
> req.getParameter("ContractPerson");
>u.Company = req.getParameter("Company");
>u.Address = req.getParameter("Address");
>u.Phone = req.getParameter("Phone");
>pm.makePersistent(u);
>
>
> On Feb 19, 12:15 am, Jake  wrote:
> > The Google App Engine instructions focus on JDO for the datastore
> > implementation.  JDO doesn't have the traditional "update" function.
> > You either modify it and close the persistence manager that returned
> > the object (it knows it changed and updates accordingly) or you just
> > persist the object again with the same ID to overwrite it.
> >
> > See:
> http://code.google.com/appengine/docs/java/datastore/creatinggettinga...
> >
> > I believe JPA has an update feature, but if you're new to it I suggest
> > JDO since it has better documentation in GAE.
> >
> > Jake
> >
> > On Feb 18, 10:55 am, Manjoor  wrote:
> >
> >
> >
> > > I have been searching for sample java program to add,editand delete
> > > records. I found many example showing how to add and delete records
> > > but not a single about editing. Do anyone have a sample source link to
> > > show how toedita record ???- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> 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] Can not fetch record from DB

2010-02-27 Thread Alexander Arendar
second instance of the setFilter() method is the problem.
rephrase it to setFilter("userLogin == vLogin && password == vPassword")
seems like each time you call setFilter() it clears the previously set
filters

On Sat, Feb 27, 2010 at 5:34 PM, Andriy Andrunevchyn wrote:

> The first I store UserModel to DB
> Then I try getting user and my method(see below) return null but I
> check db and there is stored object
> I don't know what a problem
> Help!
> My method
> public UserModel getUserByLoginAndPassword(String login, String
> password) {
>PersistenceManager pm = getPersistenceManager();
>Query getUserQuery = pm.newQuery(UserModel.class);
>getUserQuery.setFilter("userLogin == vLogin");
>getUserQuery.setFilter("password == vPassword");
>getUserQuery.declareParameters("String vLogin, String
> vPassword");
>
>UserModel result = null;
>try {
>List list = (List)
> getUserQuery.execute(
>login, password);
>if (!list.isEmpty()) {
>result = list.get(0);
>}
>} finally {
>getUserQuery.closeAll();
>releasePersistenceManager(pm);
>}
>return result;
>}
>
> --
> 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] Session Management on GAE

2010-11-22 Thread Alexander Arendar
Hi all,

It's pretty disappointing to hear this, really...
Session management is quite fundamental task.
The excuse that the app may already be non-existing when container needs to
call the sessionDestroyed() is not an excuse. I do understand that
distributed environment adds a complexity, but anyway...

Stephen, thank you for explanation though.

Sincerely,
Alex

On Mon, Nov 22, 2010 at 8:39 PM, Stephen Johnson wrote:

> From what I know you don't get sessionDestroyed. I believe there's a couple
> of issues with notification of a destroyed session and the most significant
> one would be that there's no guarantee that an instance of your application
> will even be running (1.4.0 will allow reserved instances but that isn't out
> yet.) Other issues would be that since this is a distributed environment
> which instance should receive sessionDestroyed. GAE would have to implement
> this one their backend. I believe sessions currently are just created by the
> Servlet Context of an instance when necessary and that instance's
> sessionCreated is the one that is executed.
>
> You however can query the _ah_SESSION table to see if a given session is
> still active or has expired.
>
> On Mon, Nov 22, 2010 at 9:32 AM, Sergiy Arendar <7ser...@gmail.com> wrote:
>
>> Hi, I have a problem:
>> In my application I'm using HttpSessionListener to manage sessions.
>> Here is the class:
>>
>> package com.sergiyarendar.listeners;
>>
>> import java.util.logging.Logger;
>> import javax.servlet.http.HttpSessionEvent;
>> import javax.servlet.http.HttpSessionListener;
>> import com.sergiyarendar.services.CounterService;
>>
>> public class SessionListener implements HttpSessionListener{
>>private static final Logger log =
>> Logger.getLogger(SessionListener.class.getName());
>>private static int sessionNumber;
>>public void sessionCreated(HttpSessionEvent se){
>>log.info("Session Created");
>>sessionNumber = CounterService.getSessionNumber();
>>sessionNumber++;
>>CounterService.setSessionNumber(sessionNumber);
>>}
>>public void sessionDestroyed(HttpSessionEvent se){
>>log.info("Session Destroyed");
>>sessionNumber = CounterService.getSessionNumber();
>>sessionNumber--;
>>CounterService.setSessionNumber(sessionNumber);
>>}
>> }
>>
>> This is what I have in web.xml file:
>>
>> 
>>
>>  com.sergiyarendar.listeners.SessionListener> class>
>> 
>>
>> The problem is that public void sessionCreated(HttpSessionEvent se)
>> method is invoked if a new session is created, BUT public void
>> sessionDestroyed(HttpSessionEvent se) method is never invoked. I'm
>> setting the timeout for the sessions using setMaxInactiveInterval(120)
>> method when the session begin.
>>
>> Can anyone say me what is the problem? Is it a GAE bug, or some thing
>> is wrong with my code? Please, it is very important, becouse whithout
>> sessionDestroyed() method I can't do any tasks of session management
>> when the session is destroyed.
>>
>> --
>> 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] Session Management on GAE

2010-11-22 Thread Alexander Arendar
Hi Stephen,

Would also be great if you write such limitations somewhere in the
documentation.
Or maybe it is already described but I missed the link. In such case please
drop the link.

Sincerely,
Alex

On Mon, Nov 22, 2010 at 8:39 PM, Stephen Johnson wrote:

> From what I know you don't get sessionDestroyed. I believe there's a couple
> of issues with notification of a destroyed session and the most significant
> one would be that there's no guarantee that an instance of your application
> will even be running (1.4.0 will allow reserved instances but that isn't out
> yet.) Other issues would be that since this is a distributed environment
> which instance should receive sessionDestroyed. GAE would have to implement
> this one their backend. I believe sessions currently are just created by the
> Servlet Context of an instance when necessary and that instance's
> sessionCreated is the one that is executed.
>
> You however can query the _ah_SESSION table to see if a given session is
> still active or has expired.
>
>
> On Mon, Nov 22, 2010 at 9:32 AM, Sergiy Arendar <7ser...@gmail.com> wrote:
>
>> Hi, I have a problem:
>> In my application I'm using HttpSessionListener to manage sessions.
>> Here is the class:
>>
>> package com.sergiyarendar.listeners;
>>
>> import java.util.logging.Logger;
>> import javax.servlet.http.HttpSessionEvent;
>> import javax.servlet.http.HttpSessionListener;
>> import com.sergiyarendar.services.CounterService;
>>
>> public class SessionListener implements HttpSessionListener{
>>private static final Logger log =
>> Logger.getLogger(SessionListener.class.getName());
>>private static int sessionNumber;
>>public void sessionCreated(HttpSessionEvent se){
>>log.info("Session Created");
>>sessionNumber = CounterService.getSessionNumber();
>>sessionNumber++;
>>CounterService.setSessionNumber(sessionNumber);
>>}
>>public void sessionDestroyed(HttpSessionEvent se){
>>log.info("Session Destroyed");
>>sessionNumber = CounterService.getSessionNumber();
>>sessionNumber--;
>>CounterService.setSessionNumber(sessionNumber);
>>}
>> }
>>
>> This is what I have in web.xml file:
>>
>> 
>>
>>  com.sergiyarendar.listeners.SessionListener> class>
>> 
>>
>> The problem is that public void sessionCreated(HttpSessionEvent se)
>> method is invoked if a new session is created, BUT public void
>> sessionDestroyed(HttpSessionEvent se) method is never invoked. I'm
>> setting the timeout for the sessions using setMaxInactiveInterval(120)
>> method when the session begin.
>>
>> Can anyone say me what is the problem? Is it a GAE bug, or some thing
>> is wrong with my code? Please, it is very important, becouse whithout
>> sessionDestroyed() method I can't do any tasks of session management
>> when the session is destroyed.
>>
>> --
>> 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] Session Management on GAE

2010-11-23 Thread Alexander Arendar
thank you Stephen :) you really helped

On Tue, Nov 23, 2010 at 6:31 PM, Stephen Johnson wrote:

> Hi Alexander,
> I'm sorry but I don't work for Google (however I did stay at a Holiday Inn
> Express last night) so I can't write it in the docs this information and I
> don't know that it's documented anywhere. Also note that the _ah_SESSION
> table does not remove expired sessions, you will need to clean up this
> yourself.
> Stephen
>
> On Mon, Nov 22, 2010 at 12:43 PM, Alexander Arendar <
> alexander.aren...@gmail.com> wrote:
>
>> Hi Stephen,
>>
>> Would also be great if you write such limitations somewhere in the
>> documentation.
>> Or maybe it is already described but I missed the link. In such case
>> please drop the link.
>>
>> Sincerely,
>> Alex
>>
>> On Mon, Nov 22, 2010 at 8:39 PM, Stephen Johnson 
>> wrote:
>>
>>> From what I know you don't get sessionDestroyed. I believe there's a
>>> couple of issues with notification of a destroyed session and the most
>>> significant one would be that there's no guarantee that an instance of your
>>> application will even be running (1.4.0 will allow reserved instances but
>>> that isn't out yet.) Other issues would be that since this is a distributed
>>> environment which instance should receive sessionDestroyed. GAE would have
>>> to implement this one their backend. I believe sessions currently are just
>>> created by the Servlet Context of an instance when necessary and that
>>> instance's sessionCreated is the one that is executed.
>>>
>>> You however can query the _ah_SESSION table to see if a given session is
>>> still active or has expired.
>>>
>>>
>>> On Mon, Nov 22, 2010 at 9:32 AM, Sergiy Arendar <7ser...@gmail.com>wrote:
>>>
>>>> Hi, I have a problem:
>>>> In my application I'm using HttpSessionListener to manage sessions.
>>>> Here is the class:
>>>>
>>>> package com.sergiyarendar.listeners;
>>>>
>>>> import java.util.logging.Logger;
>>>> import javax.servlet.http.HttpSessionEvent;
>>>> import javax.servlet.http.HttpSessionListener;
>>>> import com.sergiyarendar.services.CounterService;
>>>>
>>>> public class SessionListener implements HttpSessionListener{
>>>>private static final Logger log =
>>>> Logger.getLogger(SessionListener.class.getName());
>>>>private static int sessionNumber;
>>>>public void sessionCreated(HttpSessionEvent se){
>>>>log.info("Session Created");
>>>>sessionNumber = CounterService.getSessionNumber();
>>>>sessionNumber++;
>>>>CounterService.setSessionNumber(sessionNumber);
>>>>}
>>>>public void sessionDestroyed(HttpSessionEvent se){
>>>>log.info("Session Destroyed");
>>>>sessionNumber = CounterService.getSessionNumber();
>>>>sessionNumber--;
>>>>CounterService.setSessionNumber(sessionNumber);
>>>>}
>>>> }
>>>>
>>>> This is what I have in web.xml file:
>>>>
>>>> 
>>>>
>>>>  com.sergiyarendar.listeners.SessionListener>>> class>
>>>> 
>>>>
>>>> The problem is that public void sessionCreated(HttpSessionEvent se)
>>>> method is invoked if a new session is created, BUT public void
>>>> sessionDestroyed(HttpSessionEvent se) method is never invoked. I'm
>>>> setting the timeout for the sessions using setMaxInactiveInterval(120)
>>>> method when the session begin.
>>>>
>>>> Can anyone say me what is the problem? Is it a GAE bug, or some thing
>>>> is wrong with my code? Please, it is very important, becouse whithout
>>>> sessionDestroyed() method I can't do any tasks of session management
>>>> when the session is destroyed.
>>>>
>>>> --
>>>> 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
>>&g