[appengine-java] Re: Gql4J, gql for appengine java sdk
Hi all, I've been doing the same almost two years ago ! The GQL (and also extended GQL) parser is a part of DAO generator project: http://code.google.com/p/audao/ The documentation you can find here: http://audao.spoledge.com/doc-gae-features.html#gqlparser http://audao.spoledge.com/doc-gae-features.html#gqlext Vaclav On Nov 17, 4:22 pm, Max thebb...@gmail.com wrote: Hi all, I am actually a bit surprised after realized that no query language is supported on datastore low level API directly. So I spend some time to migrate GQL to Java SDK and just deployed one version tohttp://code.google.com/p/gql4j/ Here is the usage DatastoreService? http://code.google.com/p/gql4j/w/edit/DatastoreService datastore = DatastoreServiceFactory? http://code.google.com/p/gql4j/w/edit/DatastoreServiceFactory.getDatastoreService(); GqlQuery? http://code.google.com/p/gql4j/w/edit/GqlQuery gql = new GqlQuery? http://code.google.com/p/gql4j/w/edit/GqlQuery(SELECT * WHERE ANCESTOR IS KEY(:1, :2) LIMIT 100 OFFSET 1000, Person, Amy); IterableEntity result = datastore.prepare(gql.query()).asIterable(gql.fetchOptions()); Simply download jar to your project and try it! No maven repo is setup for this one but there is a workaround documented on project homepage. Any feedback is welcome! Cheers, Max -- 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: Facing problem while xsl transformation
Hello, have you put XSLT implementation jar(s) to WEB-INF/lib ?? For example xalan.jar. Vaclav On Apr 12, 8:49 am, amitingle...@gmail.com amitingle...@gmail.com wrote: Hi All, I'm getting Prematureend of file while xsl transform JAVA CODE: // load xslt fromxsltFilePath url = getClass().getClassLoader().getResource(xsltFilePath); BufferedInputStream bis3= new BufferedInputStream(url.openStream()); TransformerFactory transformerFactory = TransformerFactory.newInstance(); // create xslt Template Templates template = transformerFactory.newTemplates(new StreamSource(bis3)); // Create Transformer Transformer transformer = template.newTransformer(); transformer.transform( new StreamSource(bis), new StreamResult( xhtmlContent)); Error: :54:36,762 ERROR [STDERR] SystemId Unknown; Line #-1; Column #-1; Premature end of file. XSL : ?xml version=1.0 encoding=UTF-8? xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform; version=1.0 xmlns:mx=http://www.w3.org/2005/Atom; xsl:template match=/ html head titleReal's HowTo/title /head body table border=1 tr thTitleamit/th thLink/th /tr xsl:for-each select=mx:feed/mx:entry tr td xsl:value-of select=mx:title / /td td xsl:value-of select=mx:published / /td /tr /xsl:for-each /table /body /html /xsl:template /xsl:stylesheet XML: ?xml version=1.0 encoding=UTF-8 ? - feed xmlns=http://www.w3.org/2005/Atom; xmlns:clearspace=http://www.jivesoftware.com/xmlns/clearspace/rss; xmlns:dc=http://purl.org/ dc/elements/1.1/ titleSprint Community: Space Polls - Android/title link rel=alternate href=http://community.sprint.com/baw/ poll.jspa?containerType=14container=2130 / subtitleList of polls/subtitle idhttp://community.sprint.com/baw/poll.jspa? containerType=14container=2130/id generator uri=http://jivesoftware.com/products/clearspace/; version=4.5.4.1Jive SBS/generator updated2010-02-08T17:30:00Z/updated dc:date2010-02-08T17:30:00Z/dc:date dc:languageen/dc:language - entry titleWhat's Valuable/title link rel=alternate href=http://community.sprint.com/baw/ poll.jspa?poll=1062 / - author namewengla02/name uri/people/wengla02/uri emailnoreply-b...@sprint.com/email /author updated2010-02-08T17:30:00Z/updated published2010-02-08T17:30:00Z/published summary type=html / dc:date2010-02-08T17:30:00Z/dc:date clearspace:dateToText1 year, 2 months ago/clearspace:dateToText clearspace:objectType0/clearspace:objectType /entry /feed -- 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: Any GqlQuery example for Java?
Hello Peter, the reason for this is that the standard Google API does not provide runtime library for parsing GQL in Java. But you can try 3rd party library for parsing GQL in Java: http://audao.spoledge.com/doc-gae-features.html#gqlparser or you can even use extended GQL parser allowing also INSERT/UPDATE/ DELETE statements and nested queries: http://audao.spoledge.com/doc-gae-features.html#gqlext Best regards, Vaclav On Apr 13, 12:14 am, Peter ptr...@gmail.com wrote: Folks, I found quite a few Python examples for GqlQuery but couldn't find any for Java. Can someone point me in the right direction? For starters, what is the namespace to import? Thank you in advance for your help. Regards, Peter -- 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: mapreduce - passing filters
Hi, the open-source Java GQL parser (based on ANTLR) you can found here: http://code.google.com/p/audao/wiki/ExtendedGQLParser Vaclav On Nov 24, 7:46 pm, Nacho Coloma icol...@gmail.com wrote: One other thought: instead of adding a GQL interpreter, you might just add a hook for loading a class provided by the user. That class would implement a Filter interface with a method that takes a Configuration and returns a Query object so in your example, mailing and timestamp would get passed in as Configuration parameters and a query object corresponding to the GQL statement you put would be built by a Filter class provided by the user. It would act kind of like a templating language for building queries. Make sense/sound like a good idea? Actually, Filter would be simpler to implement and GQL can be added later as a concrete Filter implementation if someone is still missing it (I doubt it). It also solves the problem of specifying the type of arguments. BTW, arguments should be passed in as request parameters, not configuration attributes (like timestamp greater than or process all comments by user X for example). This means that Filter may need encapsulated access to some methods of AppEngineJobContext.request. It seems that it can be implemented in a couple of hours. I will still wait for 1.4.0, though. On Nov 18, 7:01 am, Nacho Coloma icol...@gmail.com wrote: I'm not entirely sure I understand the scope of the proposed patch. Are you thinking about adding filters at the DatastoreRecordReader level? It's not entirely clear to me that that provides a benefit over just applying the filter at the start of the map() function. Totally willing to believe I'm missing something, though. The map() filter runs against your quota. This is OK for once-only tasks such as schema upgrades, but Mappers can also be used for repetitive tasks such as mailing, data cleanup, etc. For these cases, being able to work on a subset of data is important (process only user accounts with mailing enabled, for example). The biggest problem to resolve is how to specify the filter clause in mapreduce.xml. I am considering implementing a GQL parser as simple as possible, and inject servlet request parameters. Something like: property namemapreduce.mapper.inputformat.datastoreinputformat.query/name valueselect * from users where mailing=:value1 and timestamp=:value2/value /property This implies porting the GQL implementation from python to Java, or implementing an ANTLR-based parser. I feel like I am reinventing the wheel, so any suggestion to use something that exists (or aim to a simpler design) is welcome. On a logistical note, for nontrivial contributions, we require a CLA from either you or your employer (depending on who owns the copyright for your work) before we can accept significant contributions. The relevant forms are at: http://code.google.com/legal/individual-cla-v1.0.html andhttp://code.google.com/legal/corporate-cla-v1.0.html. Feel free to email me privately if this is an issue. No problem with that. Regards, Nacho. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: How can i allow user to download a zip file?
Just call the method addStream( name_of_the_folder ): OutputStream os = zipStreamOutput.addStream( zipfolder/ subfolder ); Vaclav On Oct 23, 7:32 pm, Bit Liner bitli...@gmail.com wrote: How can i add a folder to the zipStreamOutput? I cannot write bytes that represents a folder, is there a way to do it? On Sep 16, 9:07 am, Vaclav Bartacek vaclav.barta...@spolecne.cz wrote: Look at ZipStreamOutput class from:http://code.google.com/p/audao/source/browse/#svn/trunk/modules/embed... The usage in GAE or generally in servlets is as simple as following: private void responseAsZipStream( HttpServletResponse response ) throws IOException { // prepare buffers: ByteArrayOutputStream bos = new ByteArrayOutputStream(); ZipStreamOutput output = new ZipStreamOutput( bos ); byte[] buf = new byte[4096]; // now create the ZIP archive as you want: OutputStream os1 = output.addStream( file1.txt ); // write to the output stream 1 , but do not close it - ZipStreamOutput does it itself: os1.write( whatever ); os1.flush(); OutputStream os2 = output.addStream( file2.txt ); // write to the output stream 2 , but do not close it - ZipStreamOutput does it itself: os2.write( whatever ); os2.flush(); // finish the ZIP stream: output.finish(); // now pass it as the HTTP response: byte[] data = bos.toByteArray(); response.setContentType( application/zip ); response.setContentLength( data.length ); response.setHeader( Content-Disposition, inline; filename= + filename.zip); response.getOutputStream().write( data ); } This works on gae - I use it at audao.spoledge.com Vaclav On Sep 15, 3:19 am, Bit Liner bitli...@gmail.com wrote: My app creates dinamically two files so that then the users can download these files in one zip file. But i have problem in implementing this operations. Some suggestion to help me? Library, if gae supports this operations, etc. (i have tried to use gaeVfs, but i have met problems: i cannot write the content of a file on the response, so i can download the file but its content is empty ) -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: GQL query in Datastore viewer different from API query ???
In JDO you probably need to use the method contains() if testing members of collections. http://www.datanucleus.org/products/accessplatform_1_1/jdo/jdoql_methods.html Vaclav On Sep 28, 4:20 pm, Ice13ill andrei.fifi...@gmail.com wrote: I executed a GQL query to test for some results in Datastore viewer: SELECT * FROM DbLaw where keyWordsList='leg' and keyWordsList='24' it worked OK. The same query using JDO: Query text: SELECT FROM biz.ebas.server.DbTest WHERE keyWordsList=='leg' keyWordsList=='24' Threw this exception: The built-in indices are not efficient enough for this query and your data. Please add a composite index for this query.. An index is missing but we are unable to tell you which one due to a bug in the App Engine SDK. If your query only contains equality filters you most likely need a composite index on all the properties referenced in those filters. How can this be possible ??? Low-level speaking, aren't the same Queries ? the same datastores ? What is the problem ? -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: How can i allow user to download a zip file?
Look at ZipStreamOutput class from: http://code.google.com/p/audao/source/browse/#svn/trunk/modules/embed/src/java/com/spoledge/audao/generator The usage in GAE or generally in servlets is as simple as following: private void responseAsZipStream( HttpServletResponse response ) throws IOException { // prepare buffers: ByteArrayOutputStream bos = new ByteArrayOutputStream(); ZipStreamOutput output = new ZipStreamOutput( bos ); byte[] buf = new byte[4096]; // now create the ZIP archive as you want: OutputStream os1 = output.addStream( file1.txt ); // write to the output stream 1 , but do not close it - ZipStreamOutput does it itself: os1.write( whatever ); os1.flush(); OutputStream os2 = output.addStream( file2.txt ); // write to the output stream 2 , but do not close it - ZipStreamOutput does it itself: os2.write( whatever ); os2.flush(); // finish the ZIP stream: output.finish(); // now pass it as the HTTP response: byte[] data = bos.toByteArray(); response.setContentType( application/zip ); response.setContentLength( data.length ); response.setHeader( Content-Disposition, inline; filename= + filename.zip); response.getOutputStream().write( data ); } This works on gae - I use it at audao.spoledge.com Vaclav On Sep 15, 3:19 am, Bit Liner bitli...@gmail.com wrote: My app creates dinamically two files so that then the users can download these files in one zip file. But i have problem in implementing this operations. Some suggestion to help me? Library, if gae supports this operations, etc. (i have tried to use gaeVfs, but i have met problems: i cannot write the content of a file on the response, so i can download the file but its content is empty ) -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: How to do update Statement in GQL for Java
Try GQLExt java library: http://audao.spoledge.com/doc-gae-features.html#gqlext Vaclav On Aug 26, 5:10 am, TP Project TP Project tpmpproj...@gmail.com wrote: Hi can any1 teach me how to use update statement in GQL?? 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-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: Reindex unindexed properties
You can use low level datastore API or GQLExt library at http://code.google.com/p/audao/ which you can use as follows: UPDATE MyEntity SET myproperty=myproperty Vaclav On 30 čnc, 21:06, Lucian Baciu lucianba...@gmail.com wrote: I just did: incremented a property with 1 (other than the unindexed property which is a Key), then put the entity back to the datastore but still unindexed On Fri, Jul 30, 2010 at 9:43 PM, Ikai L (Google) ika...@google.com wrote: You may need to make a small change before re-putting it. On Fri, Jul 30, 2010 at 11:35 AM, Lucian Baciu lucianba...@gmail.comwrote: I have an entity with an unindexed property that I now need to index. So, I've iterated over all entities retrieved each one and then updated back to the datastore (touch each one (fetch it then put it). However, the unindexed property is still unindexed, if I run a query on that specific property I get no results. How can I index a previously unindexed property? Thank you, Lucian -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2B 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 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.comgoogle-appengine-java%2B unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: Regarding GQL
Hello, you can find free Java GQL library at http://audao.spoledge.com/doc-gae-features.html#gqlparser or you can even use extended GQL syntax (allowing INSERT, UPDATE, DELETE, nested queries, many additional functions etc): http://audao.spoledge.com/doc-gae-features.html#gqlext The libs are part of the project AuDAO - Java DAO Generator, which is hosted at http://code.google.com/p/audao/ Vaclav On Jul 1, 3:15 pm, MANISH DHIMAN manisd...@gmail.com wrote: Hi Google Guys I have following queries regarding G Q L and Data Store. + Is it possible in G A E to use parametrised query. If not is there any plan for such support in near future. + How to use G Q L in a Java class. -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Memcache namespace - setNamespace() deprecated in 1.3.4
In SDK 1.3.4 the method MemcacheService.setNamespace(String ns) was deprecated. Instead of that one should use MemcacheServiceFactory.getMemcacheService(String ns). When using the new one, the name of the namespace is validated against pattern, but this validation is not done when calling the old (deprecated) method: String namespace = TEST:One; MemcacheService msOld = MemcacheServiceFactory.getMemcacheService(); // deprecation warning by compiler, but OK at runtime: msOld.setNamespace( namespace ); // no warning by compiler, but throws exception at runtime: MemcacheService msNew = MemcacheServiceFactory.getMemcacheService( namespace ); The exception is: java.lang.IllegalArgumentException: Namespace 'TEST:One' does not match pattern '[0-9A-Za-z._-]{0,100}'. I think that this behaviour should be documented in low-level API at least. Thanks Vaclav -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: Manually create entity table and add rows using the dashboard.
Try Extended GQL parser and simple 'gqlext.jsp' tool - http://code.google.com/p/audao/wiki/ExtendedGQLParser You can execute INSERT, SELECT, UPDATE and DELETE commands. The full documentation is at http://audao.spoledge.com/doc-gae-features.html#gqlext Vaclav On Jun 11, 6:02 am, mar_novice mariocape1...@gmail.com wrote: Is there a way to use the dashboard dataviewer to manually create an entity table and add entities in it? So far, what I know is I can add an entity in a given kind if there are already existing entities of that kind. What if I am about to add the very first entity of that kind? -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: appengine unaware code!
As for the datastore - you can create abstract DAO layer which hides the actual implementation. Try AuDAO tool (http://audao.spoledge.com) to generate an abstract DAO layer + implementation for GAE, MySQL or Oracle DBs. However, if you want to optimize the code and also due to several restrictions on GAE's datastore (queries, transactions and keys), even the abstract DAO layer will differ for GAE and e.g. MySQL implementations (e.g. in GAE it can be more efficient to use multi- value fields = Lists than to decompose the entity (table) into more entities (tables)). Vaclav On May 22, 12:35 am, aijazzz aija...@gmail.com wrote: Hi, I was looking to some examples to start my work on google appengine application and found out that I have to use appengine related code in source. For example, in a database example I found this, import com.google.appengine.api.datastore.Key; I am wondering if there is a way I can keep my code clean so that I can use same code in another environment? Please suggest. Thanks. regards, Ijaz -- 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.
[appengine-java] Re: Paypal integration with app engine?
The only way I found and successfully use is the PayPal Button (saved on the server + 'custom' attribute) + IPN mechanism (over SSL) to receive transaction statuses. Other ways could not be probably implemented now due to the current GAE restrictions - mainly: you cannot add a new JCE provider now. Vaclav On May 3, 7:47 am, shamel shame...@gmail.com wrote: How to integrate paypal with app engine?? i have got many errors when integrating this. main exceptions are org.xml.sax.SAXNotSupportedException:http://xml.org/sax/features/external-general-entities at org.apache.xerces.framework.XMLParser.setExternalGeneralEntities(XMLParser.java: 486) at org.apache.xerces.framework.XMLParser.setFeature(XMLParser.java: 1298) at org.apache.xerces.parsers.SAXParser.setFeature(SAXParser.java:578) at org.apache.xerces.jaxp.SAXParserImpl.setFeatures(SAXParserImpl.java: 150) ... please help me as fast as possible??? -- 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.
[appengine-java] Re: Datastore - entities with package names
I've created a Java GQL parser which allows you to quote kind and property names, so your query would be written: SELECT * FROM 'my.package.myEntity' The description of the parser and link to download source or binary is here: http://audao.spoledge.com/doc-gae-features.html#gqlparser An example of a simple datastore viewer is here: http://vaclavb.blogspot.com/2010/02/google-app-engine-data-viewer-gql-java.html Vaclav On May 1, 1:42 am, madthanu madth...@gmail.com wrote: I have my entity class inside a seperate Java package, so the full class name of the entity is something like my.package.myEntity How do you use GQL to do a select when the class name is this? The following did not work: SELECT * FROM my.package.myEntity Thanks, Thanu -- 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.
[appengine-java] Re: including data file in JAR
Better way is to use getClass().getResourceAsStream for accessing files packed in jars or for acccessing files located directly in the war you can use the following (in a servlet): ServletContext ctx = getServletContext(); InputStream is = ctx.getResourceAsStream( resourceName ); Do not forget to declare the data file as the resource file in appengine-web.xml (if it is located outside of the WEB-INF directory): resource-files include path=/resources/data-file.csv / /resource-files Vaclav On Apr 18, 4:00 am, Philip Tucker ptuc...@gmail.com wrote: I have a data file I need to access on the server. If I include it in my source path on the client I can load it via ClassLoader.getSystemResourceAsStream. But this breaks on the server (I'm not sure if the eclipse plugin is even deploying it). What's the best way to do this? I don't want to incur a DB hit if I can avoid it, and it's too much data to embed in a class (~4MB). -- 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.
[appengine-java] Re: Is it necessary on deployment server to explicitly call HttpSession.setAttribute?
Sessions are stored in a Memcache and that's the reason of the behaviour you described. The Memcache low-level API documentation says: The values returned from this API are mutable copies from the cache; altering them has no effect upon the cached value itself until assigned with one of the put methods. Likewise, the methods returning collections return mutable collections, but changes do not affect the cache. Imagine that the session object is not stored only on one server machine, but it needs to be distributed across all machines currenlty serving your application. So you must tell google app engine to re- distribute your modified session object. Vaclav On Apr 18, 4:19 am, Thomas mylee...@gmail.com wrote: I have a class which has a counter field. public Class Foo implements Serializable { private static final long serialVersionUID = 1L; private int counter = 0; // getter and setter omitted for simplicity } And in my program I put a Foo instance into HttpSession. HttpSession session = request.getSession(true); Foo foo = (Foo)session.getAttribute(foo); if (foo==null) { foo = new idv.Foo(); session.setAttribute(foo, foo);} else foo.setCounter(foo.getCounter()+1); // continue processing with foo If session.setAttribute is executed, the session (and foo) is serialized correctly and I can get the correct counter value at the next request. But the counter value never gets increased at subsequent requests. If I move the session.setAttribute call to behind the if-else block to force execution in every request, the counter value increases correctly. if (foo==null) foo = new idv.Foo(); else foo.setCounter(foo.getCounter()+1); session.setAttribute(foo, foo); I didn't see any doc about this. Is it a bug or a feature? -- 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.
[appengine-java] Re: problem with jsp:include page=/WEB-INF/includes/Item1.html /
I had exactly the same problem.and I also renamed the fragments from *.html to *.jsp to make it working. The .jsp suffix is no problem for me. The J2EE documentation says about the RequestDispatcher interface (which is actually used for jsp:include and jsp:forward): This interface is intended to wrap servlets, but a servlet container can create RequestDispatcher objects to wrap any type of resource. so it is unclear whether it is a bug or feature. Vaclav On Mar 24, 9:10 pm, powell...@gmail.com powell...@gmail.com wrote: Within a jsp page, I am trying to use jsp:include page=/WEB-INF/ includes/Item1.html / . My problem is the Item1.html file is never included. It will only get included if I rename it to Item1.jsp. The include works fine in Jetty but not when deployed to appengine. I tried listing Item1.html as a resource file in the appengine-web.xml but this had no effect. Any suggestions? Dave -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: Is there any lib (UI front-end and servlet backend) for editing datastore?
Hello, I do not think a library can exist, rather a set of JSP pages or servlets. The operations you listed are exactly the operations provided by the low-level datastore API. But you forgot to mention also dynamic search operation, which is not directly provided by the API. So I created a GQL dynamic parser and a sample data viewer which you can find here: http://vaclavb.blogspot.com/2010/02/google-app-engine-data-viewer-gql-java.html Vaclav On Mar 24, 4:49 am, Trung gwtdevelo...@gmail.com wrote: Hi, Is there any lib for editing datastore? Similar to Datastore Viewer with some additional features. Editing means: + New entity: create a empty entity + Delete existing entity + Add a property to entity + Remove a property from entity + Change a property's value 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.