[appengine-java] Re: How can I make the session to be held open as long as the user got its browser opened?

2011-04-11 Thread Daniel
I refer to the one that defined in web.xml

session-config
session-timeout30/session-timeout
/session-config

I want to keep it open as long as the browser is opened at my page...

On Apr 10, 2:10 pm, Didier Durand durand.did...@gmail.com wrote:
 Hi,

 You should clarify what you mean by an open session: do you mean the
 http one defined by the cookie, the security one after login, etc ?

 regards

 didier

 On Apr 10, 9:35 am, Max thebb...@gmail.com wrote:

  have you tried to use memcache or simply store session into datastore?

-- 
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: How can I make the session to be held open as long as the user got its browser opened?

2011-04-11 Thread nischalshetty
You would need to specify a timeout and if there is no activity for
that time frame sessions would need to expire. To be safe about
expiring sessions and at the same time wanting to keep them alive,
what I can suggest is do this :

Put a simple ajax call on the page. Make it call your app every 20
minutes. That way the sessions would not expire. Just a suggestion,
haven't done anything like that so don't know how good a solution it
is. But to get started quick, I would definitely do this.

-Nischal

On Apr 11, 11:38 am, Daniel vedm...@gmail.com wrote:
 I refer to the one that defined in web.xml

         session-config
                 session-timeout30/session-timeout
         /session-config

 I want to keep it open as long as the browser is opened at my page...

 On Apr 10, 2:10 pm, Didier Durand durand.did...@gmail.com wrote:







  Hi,

  You should clarify what you mean by an open session: do you mean the
  http one defined by the cookie, the security one after login, etc ?

  regards

  didier

  On Apr 10, 9:35 am, Max thebb...@gmail.com wrote:

   have you tried to use memcache or simply store session into datastore?

-- 
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: Failed to compile jsp files.

2011-04-11 Thread Perun Katana
Hi Eric,

this is the cause
 An error occurred at line: -1 in the generated java file
 Caused by: java.io.IOException: Cannot run program javac.exe:

I had the same error and what helped - make sure you run appcfg
command with JDK, not just JRE.
What I did was - open the appcfg file and make sure the java is called
from a JDK (place a full path to JDK if necessary)

Hope it will resolve your issue.

Regards
   Perun


On 10 avr, 15:05, Eric Wu eric.sunlight16...@gmail.com wrote:
 My project works fine in local server. But when I upload my project to
 GAE, there is an error: How to solve the problem

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



Re: [appengine-java] Re: Failed to compile jsp files.

2011-04-11 Thread Gianni Mariani
Eric,
Is this issue related to your problem?

http://code.google.com/p/googleappengine/issues/detail?id=1226

/Gianni

On Mon, Apr 11, 2011 at 5:29 PM, Perun Katana gabec@yahoo.com wrote:

 Hi Eric,

 this is the cause
  An error occurred at line: -1 in the generated java file
  Caused by: java.io.IOException: Cannot run program javac.exe:

 I had the same error and what helped - make sure you run appcfg
 command with JDK, not just JRE.
 What I did was - open the appcfg file and make sure the java is called
 from a JDK (place a full path to JDK if necessary)

 Hope it will resolve your issue.

 Regards
Perun


 On 10 avr, 15:05, Eric Wu eric.sunlight16...@gmail.com wrote:
  My project works fine in local server. But when I upload my project to
  GAE, there is an error: How to solve the problem
 
  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-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.




-- 
Gianni Mariani
Google, Sydney

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



Re: [appengine-java] only allowing local connections to dev server?

2011-04-11 Thread Fabrizio Accatino
Perhaps a better solution:
use the --address paramater
http://code.google.com/appengine/docs/java/tools/devserver.html#Command_Line_Arguments
http://code.google.com/appengine/docs/java/tools/devserver.html#Command_Line_Arguments
  fabrizio

On Mon, Apr 11, 2011 at 7:56 AM, Fabrizio Accatino fht...@gmail.com wrote:

 I use rinetd. It's a port forwarder.
 http://www.boutell.com/rinetd/

 fabrizio (from android)
 Il giorno 10/apr/2011 19.57, Luis Montes monte...@gmail.com ha
 scritto:

  When running a java webapp in eclipse it seems that I can only connect to
  the dev jetty instance from the localhost. Is jetty fired up only bound
 to
  127.0.0.1?
 


-- 
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] JDO Unit testing with JUnit. Object with id is managed by a different ObjectManager

2011-04-11 Thread Hector
Hi everyone,

I'm trying to test a method that uses JDO and I can't figure out where
the problem is. I get this exception when I execute a test method.

org.datanucleus.exceptions.NucleusUserException: Object with id  is
managed by a different ObjectManager
at
org.datanucleus.ObjectManagerImpl.findStateManager(ObjectManagerImpl.java:
756)

@Test
public void nuevaEntidadMismoNombreTest(){

Entidad entidad = new Entidad(nombre, cif, tipo, localizacion);
Entidad entidad2 = new Entidad(nombre, cif, tipo, localizacion);

Entidad nuevaEntidad = entidadDao.crearEntidad(entidad);
Entidad nuevaEntidad2 = entidadDao.crearEntidad(entidad2);

}

The method that I use to create the Entity is.

public Entidad crearEntidad(Entidad entidad) {
PersistenceManager pm = PMF.get().getPersistenceManager();
try{
Entidad nuevaEntidad = pm.makePersistent(entidad);
return  pm.detachCopy(nuevaEntidad);
}finally{
pm.close();
}
}

For getting the PM I used the class recommended by Google

public final class PMF {
private static final PersistenceManagerFactory pmfInstance =
JDOHelper.getPersistenceManagerFactory(transactions-
optional);

private PMF() {}

public static PersistenceManagerFactory get() {
return pmfInstance;
}
}

I've also added the setting up of the datastore folowing the Google's
documentation instructions.

private final LocalServiceTestHelper dataHelper = new
LocalServiceTestHelper(new LocalDatastoreServiceTestConfig());

Can anyone tell my why I'm getting this exception?

Thanks in advance.

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



Re: [appengine-java] Re: URL Fetch java.io.IOException

2011-04-11 Thread Felipe Teixeira
Can help you ,
http://ikaisays.com/2010/06/29/using-asynchronous-urlfetch-on-java-app-engine/
..

2011/4/9 Z lrkir...@gmail.com

 I think that it might apply to ALL types of the HTTP requests (i.e GET
 and POST).

 On Apr 4, 10:20 am, Thomas Visser thomas.vis...@gmail.com wrote:
  It looks like there's a bug in the 1.4.3 development server regarding
  to POST requests. It worked for me again when I removed the Content-
  Length header parameter.
 
  On Apr 4, 3:51 pm, Peter pcsor...@gmail.com wrote:
 
 
 
 
 
 
 
   Hi
 
   I have an application running on gae and another client application
   running on a local development server.
   The client application is trying to send some params through a http
   connection an recive some respone in the same connectin.
   The client application works fine but after i change the SDK versin
   1.4.2 or higher I get an exception:
   java.io.IOException: Could not fetch URL:
 http://myserverapplication.appspot.com/something
   at
  
 com.google.appengine.api.urlfetch.URLFetchServiceImpl.convertApplicationExc
 eption(URLFetchServiceImpl.java:
   110) ..
   I got an exception when calling connection.getResponseCode();
 
   Can somebody help me?
 
   Here is my code:
 
   URL url = new URL(http://myserverapplication.appspot.com/something;);
   HttpURLConnection con;
   int responseCode = HttpURLConnection.HTTP_UNAVAILABLE;
   con = (HttpURLConnection) url.openConnection();
   con.setRequestMethod(POST);
   con.setRequestProperty(Content-Type, application/x-www-form-
   urlencoded);
   con.setRequestProperty(Content-Length,  +
   Integer.toString(urlParameters.getBytes().length));
   con.setRequestProperty(Content-Language, en-US);
   con.setUseCaches(false);
   con.setDoInput(true);
   con.setDoOutput(true);
   DataOutputStream wr = new DataOutputStream(con.getOutputStream());
   wr.writeBytes(urlParameters);
   wr.flush();
   wr.close();
   responseCode = con.getResponseCode();

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




-- 
*Felipe Teixeira*
*Desenvolvedor Java
*
IPNET - Soluções  em Informática
Tel.: 55 21 3553 2717 / 21-7805-6867
Rua Visconde de Inhaúma, 134, Sala 615
Centro - RJ - CEP: 20091-007
*http://www.ipnetsolucoes.com.br *

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



Re: [appengine-java] Re: How can I make the session to be held open as long as the user got its browser opened?

2011-04-11 Thread Khor Yong Hao
Good way, either ajax way polling in 20 minutes, or Channel API, comet way.

On Mon, Apr 11, 2011 at 2:59 PM, nischalshetty nischalshett...@gmail.comwrote:

 You would need to specify a timeout and if there is no activity for
 that time frame sessions would need to expire. To be safe about
 expiring sessions and at the same time wanting to keep them alive,
 what I can suggest is do this :

 Put a simple ajax call on the page. Make it call your app every 20
 minutes. That way the sessions would not expire. Just a suggestion,
 haven't done anything like that so don't know how good a solution it
 is. But to get started quick, I would definitely do this.

 -Nischal

 On Apr 11, 11:38 am, Daniel vedm...@gmail.com wrote:
  I refer to the one that defined in web.xml
 
  session-config
  session-timeout30/session-timeout
  /session-config
 
  I want to keep it open as long as the browser is opened at my page...
 
  On Apr 10, 2:10 pm, Didier Durand durand.did...@gmail.com wrote:
 
 
 
 
 
 
 
   Hi,
 
   You should clarify what you mean by an open session: do you mean the
   http one defined by the cookie, the security one after login, etc ?
 
   regards
 
   didier
 
   On Apr 10, 9:35 am, Max thebb...@gmail.com wrote:
 
have you tried to use memcache or simply store session into
 datastore?

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



-- 
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: User API, not logging out properly.

2011-04-11 Thread Qifan
I should probably mention that, it seem to be working using Google Account 
API, but not Federated Login.

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



Re: [appengine-java] only allowing local connections to dev server?

2011-04-11 Thread Luis Montes
That worked.  Thanks!


In case anyone else has trouble:

From eclipse, right-click on project and select Run Configurations.  Then
add --address=0.0.0.0  to Program arguments section of Arguments tab.



Luis


On Mon, Apr 11, 2011 at 2:54 AM, Fabrizio Accatino fht...@gmail.com wrote:

 Perhaps a better solution:
 use the --address paramater

 http://code.google.com/appengine/docs/java/tools/devserver.html#Command_Line_Arguments
 http://code.google.com/appengine/docs/java/tools/devserver.html#Command_Line_Arguments
   fabrizio

 On Mon, Apr 11, 2011 at 7:56 AM, Fabrizio Accatino fht...@gmail.comwrote:

 I use rinetd. It's a port forwarder.
 http://www.boutell.com/rinetd/

 fabrizio (from android)
 Il giorno 10/apr/2011 19.57, Luis Montes monte...@gmail.com ha
 scritto:

  When running a java webapp in eclipse it seems that I can only connect
 to
  the dev jetty instance from the localhost. Is jetty fired up only bound
 to
  127.0.0.1?
 

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


-- 
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] JDO - Set Entity group parent in an unowned relationship

2011-04-11 Thread Neto
Hi!

I am trying to model the following relationship

@PersistenceCapable
public class A{
@Persistent
@PrimaryKey
private String pk;

@Persistent(defaultFetchGroup = true)
@Element(dependent = true)
public LinkedListB container;
}
@PersistenceCapable
public class B {}


And finally, i have a C entity. This is an unowned realtionship because it 
is associated with a B, but not all Bs have a C entity associated.
So, i modeled like this:

public class C{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key pk; 
@Persistent
private Key keyOfB;
@Persistent
@Extension(vendorName=datanucleus, key=gae.parent-pk, value=true) 
//key=gae.parent-pk - the root entity for this entity
private Key keyOfA; 
}

My problem is the following: 
 

The ancestor of C should be B. However, if i erase the keyOfA field and put 
the extension anotation in keyOfB, when updating a B entity and creating a C 
entity in the same transaction, i will get a exception saying that the A 
entity and B entity cannot be updatee because they are not in the same 
entityt group!


Is this the wrong key? Am i doing something wrong? Any help would be great!
Note: it is necessary that the C entity is not an entity group root, as it 
needs to be in the same transaction as B.

Thanks in advance



-- 
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] Embeded + Related list raises IllegalArgumentException: out of field index: -1

2011-04-11 Thread Ronoaldo José de Lana Pereira
Sorry if it is a duplicate, but I coudn't find any solutions for this 
problem. I'm not sure if someone else solved this, and any help would be 
very helpfull.

This seems like those rare corner cases, but it happened:

Using this data models:

@Entity
public class Parent {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Extension(vendorName = datanucleus, key = gae.encoded-pk, value = 
true)
private String key;

@Extension(vendorName = datanucleus, key = gae.pk-id, value = 
true)
private Long id;

@ManyToMany(mappedBy = parent, cascade = CascadeType.ALL)
private ListChild relatedChilds = new ArrayListChild();

@Embedded
private InlineChild inlineChild;

public ListChild getRelatedChilds() {
return relatedChilds;
}

public void setRelatedChilds(ListChild relatedChilds) {
this.relatedChilds = relatedChilds;
}

public InlineChild getInlineChild() {
return inlineChild;
}

public void setInlineChild(InlineChild inlineChild) {
this.inlineChild = inlineChild;
}

public String getKey() {
return key;
}

public Long getId() {
return id;
}
}

@Entity
public class Child {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Extension(vendorName = datanucleus, key = gae.encoded-pk, value = 
true)
private String key;

@Extension(vendorName = datanucleus, key = gae.pk-id, value = 
true)
private Long id;

private String name;

@SuppressWarnings(unused)
@OneToMany
private Parent parent;

public Child(Parent parent) {
this.parent = parent;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getKey() {
return key;
}

public Long getId() {
return id;
}
}

@Embeddable
public class InlineChild {

private String name;

private Date creationDate;

private ListString urls;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public Date getCreationDate() {
return creationDate;
}

public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}

public ListString getUrls() {
return urls;
}

public void setUrls(ListString urls) {
this.urls = urls;
}

}

And this JUnit test case fails for the test #3:

public class OutOfIndexTest {

LocalServiceTestHelper helper = new LocalServiceTestHelper(
new LocalDatastoreServiceTestConfig());

@Before
public void setUp() throws Exception {
helper.setUp();
}

@After
public void tearDown() throws Exception {
helper.tearDown();
}

@Test
public void testPersistParentOnly() {
EntityManager em = EMF.get().createEntityManager();
Parent p = new Parent();
em.persist(p);
em.close();
}

@Test
public void testPersistParentWithRelatedChild() {
EntityManager em = EMF.get().createEntityManager();
Parent p = new Parent();
p.getRelatedChilds().add(new Child(p));
em.persist(p);
em.close();
}

 
@Test 
public void testPersistParentWithAllChilds() {
// This test fails, but only if the embeded has a list.
EntityManager em = EMF.get().createEntityManager();
Parent p = new Parent();
p.getRelatedChilds().add(new Child(p));
p.setInlineChild(new InlineChild());
em.persist(p);
em.close();
}

@Test
public void testAddEmbededAfterPersistAllChilds() {
EntityManager em = EMF.get().createEntityManager();
Parent p = new Parent();
p.getRelatedChilds().add(new Child(p));
em.persist(p);
em.close();

em = EMF.get().createEntityManager();
p.setInlineChild(new InlineChild());
em.merge(p);
}

}

Whith this StackTrace:

java.lang.IllegalArgumentException: out of field index :-1
at org.example.fieldindex.InlineChild.jdoProvideField(InlineChild.java)
at 
org.datanucleus.state.JDOStateManagerImpl.provideField(JDOStateManagerImpl.java:2585)
at 
org.datanucleus.state.JDOStateManagerImpl.provideField(JDOStateManagerImpl.java:2555)
at 
org.datanucleus.store.mapped.mapping.CollectionMapping.postInsert(CollectionMapping.java:91)
at 
org.datanucleus.store.mapped.mapping.EmbeddedPCMapping.postInsert(EmbeddedPCMapping.java:104)
at 
org.datanucleus.store.appengine.DatastoreRelationFieldManager.runPostInsertMappingCallbacks(DatastoreRelationFieldManager.java:217)
at 
org.datanucleus.store.appengine.DatastoreRelationFieldManager.access$200(DatastoreRelationFieldManager.java:48)
at 
org.datanucleus.store.appengine.DatastoreRelationFieldManager$1.apply(DatastoreRelationFieldManager.java:116)
at