[appengine-java] Re: DisplayTag JSP
If you have any objects in that resultset which are lazily loaded, then closing the entity manager before you've looped through the resultset will produce an exception and the route to the data store to retrieve the data has been closed. You have two options: 1) Aggressively fetch the data which you're looping through, so that all data is retrieved from the data store before you iterate over it. 2) Close the entity manager after you've looped through the required data. On Nov 16, 3:51 am, YONG wrote: > Hi, I want to know what is the different of this code when compiling > and execute in GAE. > > <% > EntityManager em = EMF.getInstance().createEntityManager(); > List users = (List) em.createQuery( > "SELECT FROM " + > User.class.getName()).getResultList(); > request.setAttribute("rs", users); > em.close(); > %> > > sort="list" pagesize="10" class="display"> > headerClass="sortable" /> > headerClass="sortable" /> > > > > > > > The above code is giving error code HTTP 500. However, when I change > to > > <% > EntityManager em = EMF.getInstance().createEntityManager(); > List users = (List) em.createQuery( > "SELECT FROM " + > User.class.getName()).getResultList(); > request.setAttribute("rs", users); > // em.close(); // just comment this line and move it down > %> > > sort="list" pagesize="10" class="display"> > headerClass="sortable" /> > headerClass="sortable" /> > > > > > > > <% > em.close(); > %> > > Then the JSP is running and show the result in displaytag table. > > Anyone can explain why? -- 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=.
[appengine-java] Re: Connecting to Development Server via Local Network
Ikai, Thank you, I missed that when reading the docs... Peter On Nov 10, 11:35 pm, "Ikai L (Google)" wrote: > Peter, > > By default the development server only binds to 127.0.0.1 and will only > answer requests directed to that address. You can change the default > behavior so it binds to 0.0.0.0 and listens on all addresses by passing in > the --address= flag when you start up the server. This is documented here: > > http://code.google.com/appengine/docs/java/tools/devserver.html > > For instance, if you are using Eclipse, you would add "--address=0.0.0.0" to > your program arguments under the Run Configuration/Debug Configuration menu. > > Ikai > > On Fri, Nov 6, 2009 at 3:10 AM, Peter Hulsen wrote: > > > Is it possible to connect to the development server via a remote > > machine on my local network? Thanks. > > > Peter > > -- > Ikai Lan > Developer Programs Engineer, Google 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=.
[appengine-java] Won't get values of an array inside POJO
Hi all, I don't know why for any kind of array (List or Object[]) inside my Pojo app engine fails to get correct values and get always null. I already check out at local dataviewer, and as a matter fact values seems to be saved succesfull. Anyone can help me? 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=.
[appengine-java] Email .csv attachment in UTF-8 charset
Hi all, I am trying to send an email with an attachment having Content-Type "text/comma-separated-values; charset=UTF-8". The attachment is sent, but it comes out in encoding base64(US-ASCII). I do something like this: import javax.mail.Multipart; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMultipart; // ... String htmlBody;// ... String attachmentData; // ... Multipart mp = new MimeMultipart(); MimeBodyPart htmlPart = new MimeBodyPart(); htmlPart.setContent(htmlBody, "text/html"); mp.addBodyPart(htmlPart); MimeBodyPart attachment = new MimeBodyPart(); attachment.setFileName("data.csv"); attachment.setContent(attachmentData, "text/comma-separated- values; charset=UTF-8"); mp.addBodyPart(attachment); message.setContent(mp); But the attachment comes out in us-ascii. I've als tried with setting headers, but to no avail. I probably need to approach this differently. So, any pointers greatly appreciated. Thanks! Robert -- 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=.
[appengine-java] Re: Won't get values of an array inside POJO
Perhaps you don't have it in the fetch plan? as per the DataNucleus docs, or many many posts on this forum -- 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=.
[appengine-java] XMPP and JID
Hello I am using XMPP API. It looks that JID of a google account user does not remain constant. If a user is using gmail, then his JID is mai...@gmail.com/gmail.SOME_NO and when he is using gtalk JID is mai...@gmail.com/talk.SOME_DIFF_NO. I need to have something (for example mail id) which remains constant every time a user uses my website. I didn't find any function to extract constant part of JID. I tried using Users Service of Google App engine by including import com.google.appengine.api.users.User; import com.google.appengine.api.users.UserService; import com.google.appengine.api.users.UserServiceFactory;*** *but user remains null. Is their any way to get constant part from all Types of JID's. * *Regards Sahil* * -- 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=.
[appengine-java] case sensitivity
Is there any way to perform a JDO query on google app engine using a case insensitive string comparison? e.g. For example, Query query = pm.newQuery(User.class, "userName.toLowerCase() == user && password == pass"); query.declareParameters("String user, String pass"); query.setUnique(true); User user = (User) query.execute(userName.toLowerCase(), password); Of course GAE does not support the usage of toLowerCase() in the filter string. There's probably a terribly simple way to do this that I'm just not aware of. -- 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=.
[appengine-java] Re: updating object doesn't work anymore
Anyone? -- 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=.
[appengine-java] Re: Delete task queue
OK, seems like a bug to me. Does it make sense to file an issue for this as it is experimental feature or shall I wait until it is more mature? Peter On Nov 13, 9:20 am, Peter Ondruska wrote: > Ikai, the application id is kaibo-www > > On 11 lis, 22:31, Peter Ondruska wrote: > > > > > Ikai, I have updated_queues (queue.xml follows) but thequeueis still > > there. > > > > > http://www.w3.org/2001/XMLSchema-instance"; > > xsi:noNamespaceSchemaLocation="http://googleappengine.googlecode.com/ > > svn/trunk/java/docs/queue.xsd"> > > > > > > > On 10 lis, 23:58, "Ikai L (Google)" wrote: > > > > Peter, > > > > Were you able todeletethe taskqueue? One thing you can try is using the > > > "update_queue" command line tool with your XML file: > > > > ./appengine-java-sdk/bin/appcfg.sh update_queues myapp/war > > > > This is described > > > here:http://code.google.com/appengine/docs/java/config/queue.html > > > > This should take a few minutes to propagate. > > > > Ikai > > > > On Tue, Nov 10, 2009 at 8:24 AM, Peter Ondruska > > > wrote: > > > > > Actually I am not sure, so I deleted the other version. But thisqueue > > > > still exists. I will wait one more day. Thanks > > > > > On 9 lis, 23:41, victor wrote: > > > > > You might have a previous version of the app that still refers to the > > > > > oldqueue.Deletethose versions. > > > > > > On Nov 9, 7:29 am, Peter Ondruska wrote: > > > > > > > I have defined taskqueueusingqueue.xml but later decided not to use > > > > > > it. It still appears inqueuelist in app engine. How do Ideletethis > > > > > > taskqueue? Uploadingqueue.xml with empty ? Thanks, > > > > > > Peter > > > > -- > > > Ikai Lan > > > Developer Programs Engineer, Google 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=.
[appengine-java] Re: Email .csv attachment in UTF-8 charset
Hi, As an another way. How about this technique ? 1. import import javax.mail.util.ByteArrayDataSource; import javax.activation.DataHandler; import javax.activation.DataSource; 2.modify //attachment.setContent(attachmentData, "text/comma-separated-values; charset=UTF-8"); ByteArrayDataSource byteArrayDataSource = new ByteArrayDataSource (attachmentData, "text/comma-separated-values; charset=UTF-8"); attachment.setDataHandler(new DataHandler(byteArrayDataSource)); 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=.
Re: [appengine-java] case sensitivity
The recommended approach is to store the userName in all lower case, as an additional field/column, and then do the toLowerCase on the incoming parameter user name when you do the query and use that field/column that was stored in lower case. Kris wrote: > Is there any way to perform a JDO query on google app engine using a > case insensitive string comparison? e.g. > > For example, > Query query = pm.newQuery(User.class, "userName.toLowerCase() == > user && password == pass"); > query.declareParameters("String user, String pass"); > query.setUnique(true); > User user = (User) query.execute(userName.toLowerCase(), > password); > > Of course GAE does not support the usage of toLowerCase() in the > filter string. > > There's probably a terribly simple way to do this that I'm just not > aware of. > > -- > > 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=. > > -- 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=.
[appengine-java] Embedded objects come back null in unit tests
Hi All, I have followed the instructions on how to create the appropriate classes for JUnit testing and have a fairly simple object hierarchy. I have one class that includes a few embedded objects, they are all correctly annotated with JDO annotations (i have compared them directly to the example jdo classes that ship with GAE). I create an instance of the parent object, set all the fields including the embedded ones, then used the PersistenceManager to make the instance persisted. When i query for all instances of the class, I get back the right number of instances, the non-embedded fields are there, but all of the embedded fields have null values. I also tried writing a simple test using the AddressBookEntry class, and see the same behavior when looking in the debugger, that code is as follows: @Test public void testAddy(){ AddressBookUtils.insertNew ("John","Doe","Hart","CT","8448445"); PersistenceManager pm = PMF.get().getPersistenceManager(); Query q = pm.newQuery(AddressBookEntry.class); List l = (List) q.execute(); } Anyone have any pointers on how to resolve this? 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=.
[appengine-java] EntityGroup getting all children of a parent
Hello, I tried to do a little test and wrote two classes: @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Tenant { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private String name; public Tenant(String name){ this.name = name; } public String getName(){ return this.name; } public void setKey(Key key) { this.key = key; } public Key getKey(){ return this.key; } } and @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Account { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private String name; @Persistent private String description; @Persistent private String address; ... } I generate a set of Accounts, which belong to a tenant with this code: PersistenceManager pm = PMF.get().getPersistenceManager(); KeyFactory.Builder keyBuilder = new KeyFactory.Builder (Tenant.class.getSimpleName(), "TenantX121"); Key key = keyBuilder.getKey(); Tenant tenant = new Tenant("TenantX121"); tenant.setKey(key); pm.makePersistent(tenant); for(int i = 1; i < 1001; i++){ keyBuilder = new KeyFactory.Builder(Tenant.class.getSimpleName (), "TenantX121"); keyBuilder.addChild(Account.class.getSimpleName(), "acctid"+i); Key acckey = keyBuilder.getKey(); Account acct = new Account(name, description, address, ...); acct.setKey(acckey); pm.makePersistent(acct); } Now I want to query all Accounts that belong to a tenant: PersistenceManager pm = PMF.get().getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { tx.begin(); Key k = KeyFactory.createKey(Tenant.class.getSimpleName(), "TenantX121"); //Tenant e = pm.getObjectById(Tenant.class, k); Query query = pm.newQuery(Account.class); query.setFilter("Key == keyParam"); query.declareParameters("Key keyParam"); List accounts = (List)query.execute(k); But unfortunately this doesn't work. In the documentation http://code.google.com/appengine/docs/java/datastore/transactions.html example they query on parent-pk, but it is not clear, what parent-pk is (is it an attribute or a metadatafield). Of course I also tried to query on parent-pk, but whatever I do, I receive this error: javax.jdo.JDOException: Key at org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException (NucleusJDOHelper.java:475) ... NestedThrowablesStackTrace: Key org.datanucleus.exceptions.ClassNotResolvedException: Key at org.datanucleus.util.Imports.resolveClassDeclaration(Imports.java: 194) I've also tried to add @Persistent @Extension(vendorName="datanucleus", key="gae.parent-pk", value="true") private Key customerKey; to my Accountclass, but this would only be used if I would like appengine to generate the Primarykey of the child objects itself I suppose. What am I doing wrong? -- 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=.
[appengine-java] How to design data model
Hi, I am developing the following app: user logs in and see list of items, e.g. list of cars. Each item has a few parameters, for car item it can be speed, color and manufacturer. User can add, edit and delete items. Most importantly, user can change the item type - so for example he can modify the car type in this way: remove speed parameter and add price and weight parameters. Users should also be able to filter the items by parameters. This should be possible in my app: user creates "Books I have read" item type with Title, Date and Rating parameters, adds several books and then searches (filters) all books with rating greater than 3. How should I design the datastore data model? Is this even possible in App Engine? 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=.
[appengine-java] JDO not saved (commit) when using spring @ModelAttribute
Dear All I use JDO with spring and when i add @ModelAttribute("countries") All things go fine except the data not saved without any exception When query from another datastore @Controller public class PortController { private static final String FORM_MODEL_KEY = "ports"; private static final String FORM_UPDATE_KEY = "port/Edit"; private static final String REDIRECT_LIST_VIEW_KEY = "redirect:/port/ home.htm" ; @Autowired private PortDAO portDAO; @Autowired private CountryDAO countryDAO; public PortController() {} @InitBinder protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { binder.registerCustomEditor(String.class, new StringTrimmerEditor(false)); binder.registerCustomEditor (com.xesolution.domain.Country.class, new CountryEditor(countryDAO)); } @RequestMapping(value="/port/home.htm") public ModelMap list() { return new ModelMap(FORM_MODEL_KEY,portDAO.readAll()); } @RequestMapping(value="/port/new.htm") public ModelAndView create(){ Port port = new Port(); return new ModelAndView(FORM_UPDATE_KEY,FORM_MODEL_KEY,port); } @RequestMapping(value="/port/update.htm") public ModelAndView update(@RequestParam("id") String id) { Port result = portDAO.read(id); return new ModelAndView(FORM_UPDATE_KEY,FORM_MODEL_KEY, result); } @RequestMapping(value="/port/save.htm", method = RequestMethod.POST) public ModelAndView save(@ModelAttribute(FORM_MODEL_KEY) Port port, BindingResult result, SessionStatus status) { new PortValidator().validate(port, result); if (result.hasErrors()) { return new ModelAndView(FORM_UPDATE_KEY, FORM_MODEL_KEY, port); } else { portDAO.persist(port); return new ModelAndView(FORM_UPDATE_KEY, FORM_MODEL_KEY, port); return new ModelAndView(REDIRECT_LIST_VIEW_KEY, list()); } } @ModelAttribute("countries") public List populateCountry() { //this make data not saved return countryDAO.readAll(); //But this make the data saved //return portDAO.readAll(); } public void setPortDAO(PortDAO portDAO) { this.portDAO = portDAO; } } and this is jsp line which display the form select -- 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=.
[appengine-java] how to find list of subscribed users for XMPP service?
Can I get all contacts those subscribed to my application? -- 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=.
[appengine-java] Datastore: is numeric ID unique for all entities of one type?
Good day. As far as documentation states, "The key value includes the key of the entity group parent (if any) and either the app-assigned string ID or the system-generated numeric ID. To create the object with an app- assigned string ID, you create the Key value with the ID and set the field to the value. To create the object with a system-assigned numeric ID, you leave the key field null." Is this the id that can be accessed via Key#getId() call? I assume it is. My main question is: is this numeric ID guaranteed to be unique for all entities of the same type? If yes, how do you retrieve the entity using this id? I tried using PersistenceManager#getObjectById(), but it does not find my entity. I guess this is related to the fact that my entity is child in an entity group, thus its keys' string representation would not be "MyClass (10)" (which is created when I use KeyFactory to create key from an entity type and a numeric ID) but "MyParent(20)/MyClass(10)". Thanks in advance, Evgeny. -- 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=.
[appengine-java] Re: batik
I would like to know the answer to this too as I can't seem to make it work. Best wishes, Dan On Nov 7, 8:53 pm, black_13 wrote: > Can the batik library for svg be used with the GAE java? > regards, > black_13 -- 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=.
Re: [appengine-java] Re: Can't send mail with attachment using JavaMail API
I couldn't reproduce your exact error, but I was able to put together a working example of an inbound email handler to relay messages. I'm going to expand the documentation about processing inbound emails. Here's some working code: http://pastie.org/701517 Does this example help any? Code is also pasted below, but it'll be easier for you to look at the Pastie. import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletException; import javax.mail.*; import javax.mail.util.ByteArrayDataSource; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.InternetAddress; import javax.activation.DataHandler; import java.io.IOException; import java.io.InputStream; import java.util.logging.Logger; import java.util.Properties; public class MailHandlerServlet extends HttpServlet { private static final Logger log = Logger.getLogger(MailHandlerServlet.class.getName()); private static final String RECIPIENT = "recipi...@gmail.com"; private static final String SENDER = "sen...@google.com"; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Properties props = new Properties(); Session session = Session.getDefaultInstance(props, null); try { MimeMessage message = new MimeMessage(session, request.getInputStream()); Object content = message.getContent(); // You could also probably just use message.getInputStream() here // and avoid the conditional type check if (content instanceof String) { log.info("Received a string"); } else if (content instanceof InputStream) { // My somewhat limited testing indicates that this is always getting returned as an // InputStream InputStream inputStream = (InputStream) content; ByteArrayDataSource inboundDataSource = new ByteArrayDataSource(inputStream, message.getContentType()); Multipart inboundMultipart = new MimeMultipart(inboundDataSource); // Set the body with whatever text you want Multipart outboundMultipart = new MimeMultipart(); MimeBodyPart messageBodyPart = new MimeBodyPart(); messageBodyPart.setText("Set your body here"); outboundMultipart.addBodyPart(messageBodyPart); // Loop over the multipart message coming in and // append them to the outbound Multipart object for (int i = 0; i < inboundMultipart.getCount(); i++) { BodyPart part = inboundMultipart.getBodyPart(i); /* The content-disposition header is optional: http://www.ietf.org/rfc/rfc1806.txt This header specifies the filename and type of a MIME part. */ if(part.getDisposition() == null) { // This is just a plain text email } else { // We have something interesting. Let's parse it. // Create a new ByteArrayDataSource with this part MimeBodyPart inboundMimeBodyPart = (MimeBodyPart) part; InputStream is = part.getInputStream(); ByteArrayDataSource mimePartDataSource = new ByteArrayDataSource(is, inboundMimeBodyPart.getContentType()); // Create a new outbound MimeBodyPart and set this as the handler MimeBodyPart outboundMimeBodyPart = new MimeBodyPart(); outboundMimeBodyPart.setDataHandler(new DataHandler(mimePartDataSource)); outboundMimeBodyPart.setFileName(inboundMimeBodyPart.getFileName()); outboundMultipart.addBodyPart(outboundMimeBodyPart); } } message.setContent(outboundMultipart); } message.setFrom(new InternetAddress(SENDER, "Relay account")); message.setRecipient(Message.RecipientType.TO, new InternetAddress(RECIPIENT, "Recipient")); Transport.send(message); } catch (MessagingException e) { throw new ServletException(e); } } } On Sat, Nov 14, 2009 at 1:11 AM, mably wrote: > Hi Ikai, have you been able to reproduce my "Converting attachment > data failed" exception ? > > I'm still stuck on this strange bug. > > Thanx for your help. > > On 11 nov, 00:00, mably wrote: > > Of course, here is below my email relay servlet class. What I'm > > willing to do is to hide my customers email addresses by relaying > > email to them via
[appengine-java] Re: case sensitivity
I'm more concerned about the proper way to do this generically. I can't realistically store duplicates of every string based field that I may want to search for. On Nov 16, 11:36 am, Rusty Wright wrote: > The recommended approach is to store the userName in all lower case, as an > additional field/column, and then do the toLowerCase on the incoming > parameter user name when you do the query and use that field/column that was > stored in lower case. > > > > Kris wrote: > > Is there any way to perform a JDO query on google app engine using a > > case insensitive string comparison? e.g. > > > For example, > > Query query = pm.newQuery(User.class, "userName.toLowerCase() == > > user && password == pass"); > > query.declareParameters("String user, String pass"); > > query.setUnique(true); > > User user = (User) query.execute(userName.toLowerCase(), > > password); > > > Of course GAE does not support the usage of toLowerCase() in the > > filter string. > > > There's probably a terribly simple way to do this that I'm just not > > aware of. > > > -- > > > 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=. -- 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=.
Re: [appengine-java] Re: Singleton / Single Thread / Table Lock
I agree that developing for concurrency is incredibly difficult, though I'm of the opinion that Map/Reduce is powerful because of its accessibility. It's certainly not trivial to try to reduce a computation of a large dataset to Map/Reduce, but my hope is that as the feature becomes available, we'll have enough examples from the community to cover the 90/10 case for most developers and their background computation needs. Ikai On Fri, Nov 13, 2009 at 8:55 PM, tsp...@tangiblesoftware.com < tsp...@tangiblesoftware.com> wrote: > I like the concept of MapReduce, however, I think it might be easier > to borrow a page from Apple with the Grand Central Dispatch released > in Snow Leopard. The hardest part would be implement a usable tool / > framework in Java which many developers could leverage and understand. > Especially, in my experience, most developers do not write thread safe > code by default which is a fundamental tenant to both GCD and > MapReduce. > > Tim > > On Nov 13, 4:55 pm, "Ikai L (Google)" wrote: > > Thanks for the feedback, Tim. It sounds to me like what you are looking > for > > is MapReduce support. There's an feature in our issue tracker for this: > > > > http://code.google.com/p/googleappengine/issues/detail?id=112 > > > > Map/Reduce would be a great fit for our model since the work could be > > transparently distributed among your application instances. App Engine > > definitely favors the approach you describe of breaking a big job into > > smaller pieces and reassembling the data, but currently this is up to the > > developer to manage and build. > > > > On Thu, Nov 12, 2009 at 8:26 AM, tsp...@tangiblesoftware.com < > > > > > > > > > > > > tsp...@tangiblesoftware.com> wrote: > > > Ikai, > > >This is not really a relational data question. It is a summary > data > > > question. To give a brief overview on my approach; here is the history > > > over the past 20 years on my approach to summary information: > > > > >1. Calculate the summary information on the fly per user > request. > > > Very database intensive and potentially slow performance for the user. > > >2. Create summary data tables which the application can read > very > > > quickly, use database triggers to create/update the summary values. > > > Improved user experience, but has a penalty at write time and requires > > > developers to know two tools (database triggers and application > > > language). > > >3. Same approach as number 2, but create/update the summary > values > > > in the application code. Reduces maintenance headaches by having a > > > single tool, makes the write performance a little worse because now > > > the transaction spans computers/servers. Since servers are cheap and > > > developers are not, this became the preferred approach. > > >4. Avoid the possible create/search of step two/three and assume > a > > > summary record exists at time of write. Increases performance by > > > eliminating the check for a summary record at each write, downside; > > > need an asynchronous process to pre-create all possible summary > > > records and prune ones which never were used after a reasonable time. > > > > > Depending on the requirements, I prefer the first or forth choice > > > (mostly read to write ratio is what matters). However, it is hard to > > > create a long running process via the existing toolset and constraints > > > provided by GAE. Because of this, I was falling back to the third > > > option; which was the basis for my original question. (I am looking > > > into trying to break the process into many 30 seconds or less tasks, > > > but it is not looking like a practical solution yet. This is another > > > reason we need to get support for long running batch processes within > > > GAE.) > > > > > Tim > > > > > On Nov 10, 5:44 pm, "Ikai L (Google)" wrote: > > > > Tim, > > > > > > It really depends on what you're doing. One of the challenges of > > > developing > > > > on a distributed store like the App Engine data store is adjusting > the > > > way > > > > you approach persistence for objects. For instance, suppose you store > > > > favorite colors per application user. The canonical way of solving > this > > > > problem in a relational environment is to normalize the color data > and > > > > create a lock around inserting each individual new color. In App > Engine's > > > > environment, we would likely recommend that you take advantage of > data > > > store > > > > list properties as a much more performant alternative to data > > > normalization: > > > > App Engine will handle all the indexing for you. > > > > > > If you are working with objects in parent/child relationships and > require > > > > transactional integrity, you should take a look at our documentation > > > > describing Entities and Entity Groups: > > >http://code.google.com/appengine/docs/java/datastore/transactions.html. > > > > > > On Fri, Nov 6, 2009 at 12:12 PM, tsp...@tangiblesoftware.com < >
Re: [appengine-java] Re: Delete task queue
Peter, File a bug if you can. Even though it's experimental, it's been released to the public and we can use all the help we can get when prioritizing issues. Thanks! On Mon, Nov 16, 2009 at 7:52 AM, Peter Ondruska wrote: > OK, seems like a bug to me. Does it make sense to file an issue for > this as it is experimental feature or shall I wait until it is more > mature? Peter > > On Nov 13, 9:20 am, Peter Ondruska wrote: > > Ikai, the application id is kaibo-www > > > > On 11 lis, 22:31, Peter Ondruska wrote: > > > > > > > > > Ikai, I have updated_queues (queue.xml follows) but thequeueis still > > > there. > > > > > > > > http://www.w3.org/2001/XMLSchema-instance"; > > > xsi:noNamespaceSchemaLocation="http://googleappengine.googlecode.com/ > > > svn/trunk/java/docs/queue.xsd"> > > > > > > > > > > > On 10 lis, 23:58, "Ikai L (Google)" wrote: > > > > > > Peter, > > > > > > Were you able todeletethe taskqueue? One thing you can try is using > the > > > > "update_queue" command line tool with your XML file: > > > > > > ./appengine-java-sdk/bin/appcfg.sh update_queues myapp/war > > > > > > This is described here: > http://code.google.com/appengine/docs/java/config/queue.html > > > > > > This should take a few minutes to propagate. > > > > > > Ikai > > > > > > On Tue, Nov 10, 2009 at 8:24 AM, Peter Ondruska < > peter.ondru...@gmail.com>wrote: > > > > > > > Actually I am not sure, so I deleted the other version. But > thisqueue > > > > > still exists. I will wait one more day. Thanks > > > > > > > On 9 lis, 23:41, victor wrote: > > > > > > You might have a previous version of the app that still refers to > the > > > > > > oldqueue.Deletethose versions. > > > > > > > > On Nov 9, 7:29 am, Peter Ondruska > wrote: > > > > > > > > > I have defined taskqueueusingqueue.xml but later decided not to > use > > > > > > > it. It still appears inqueuelist in app engine. How do > Ideletethis > > > > > > > taskqueue? Uploadingqueue.xml with empty ? > Thanks, > > > > > > > Peter > > > > > > -- > > > > Ikai Lan > > > > Developer Programs Engineer, Google 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=. > > > -- Ikai Lan Developer Programs Engineer, Google 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=.
[appengine-java] Re: EntityGroup getting all children of a parent
> Query query = pm.newQuery(Account.class); > org.datanucleus.exceptions.ClassNotResolvedException: Key > at org.datanucleus.util.Imports.resolveClassDeclaration(Imports.java: As the message says ... "Key" is not resolved to be a class. It certainly isn't a field, but you do have a field with lowercase "k" if that is what you meant to type. -- 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=.
[appengine-java] Re: EntityGroup getting all children of a parent
sorry, was just a typo. of course it is query.setFilter("key == keyParam"); but the error is the same On Nov 16, 10:15 pm, datanucleus wrote: > > Query query = pm.newQuery(Account.class); > > org.datanucleus.exceptions.ClassNotResolvedException: Key > > at > > org.datanucleus.util.Imports.resolveClassDeclaration(Imports.java: > > As the message says ... "Key" is not resolved to be a class. It > certainly isn't a field, but you do have a field with lowercase "k" if > that is what you meant to type. -- 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=.
Re: [appengine-java] 500 Internal Server Error, when update appl
Have you been able to update this application? On Wed, Nov 11, 2009 at 11:53 PM, Jackroz wrote: > Hi Team, > > Last two day i can't update appl, what is wrong? > > Please see detail log: > > Unable to update: > java.io.IOException: Error posting to URL: > > http://appengine.google.com/api/appversion/cloneblobs?app_id=aapcore&version=2&; > 500 Internal Server Error > > Server Error (500) > A server error has occurred. > >at com.google.appengine.tools.admin.ServerConnection.send > (ServerConnection.java:143) >at com.google.appengine.tools.admin.ServerConnection.post > (ServerConnection.java:81) >at com.google.appengine.tools.admin.AppVersionUpload.send > (AppVersionUpload.java:427) >at com.google.appengine.tools.admin.AppVersionUpload.cloneFiles > (AppVersionUpload.java:293) >at > com.google.appengine.tools.admin.AppVersionUpload.beginTransaction > (AppVersionUpload.java:255) >at com.google.appengine.tools.admin.AppVersionUpload.doUpload > (AppVersionUpload.java:98) >at com.google.appengine.tools.admin.AppAdminImpl.update > (AppAdminImpl.java:56) >at com.google.appengine.tools.admin.AppCfg$UpdateAction.execute > (AppCfg.java:521) >at com.google.appengine.tools.admin.AppCfg.(AppCfg.java:130) >at com.google.appengine.tools.admin.AppCfg.(AppCfg.java:58) >at com.google.appengine.tools.admin.AppCfg.main(AppCfg.java:54) > com.google.appengine.tools.admin.AdminException: Unable to update app: > Error posting to URL: > http://appengine.google.com/api/appversion/cloneblobs?app_id=aapcore&version=2&; > 500 Internal Server Error > > Server Error (500) > A server error has occurred. > >at com.google.appengine.tools.admin.AppAdminImpl.update > (AppAdminImpl.java:62) >at com.google.appengine.tools.admin.AppCfg$UpdateAction.execute > (AppCfg.java:521) >at com.google.appengine.tools.admin.AppCfg.(AppCfg.java:130) >at com.google.appengine.tools.admin.AppCfg.(AppCfg.java:58) >at com.google.appengine.tools.admin.AppCfg.main(AppCfg.java:54) > Caused by: java.io.IOException: Error posting to URL: > > http://appengine.google.com/api/appversion/cloneblobs?app_id=aapcore&version=2&; > 500 Internal Server Error > > Server Error (500) > A server error has occurred. > >at com.google.appengine.tools.admin.ServerConnection.send > (ServerConnection.java:143) >at com.google.appengine.tools.admin.ServerConnection.post > (ServerConnection.java:81) >at com.google.appengine.tools.admin.AppVersionUpload.send > (AppVersionUpload.java:427) >at com.google.appengine.tools.admin.AppVersionUpload.cloneFiles > (AppVersionUpload.java:293) >at > com.google.appengine.tools.admin.AppVersionUpload.beginTransaction > (AppVersionUpload.java:255) >at com.google.appengine.tools.admin.AppVersionUpload.doUpload > (AppVersionUpload.java:98) >at com.google.appengine.tools.admin.AppAdminImpl.update > (AppAdminImpl.java:56) >... 4 more > > -- > > 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=. > > > -- Ikai Lan Developer Programs Engineer, Google 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=.
[appengine-java] Re: Can't send mail with attachment using JavaMail API
Hi Ikai, thanx for you help. I've copy pasted your code on my webapp (webwinewatch), I've no error but the mail isn't correctly relayed, all attachements are removed. I've just modified the sender, from and recipient lines : message.setSender(new InternetAddress("@gmail.com", "Relay account")); message.setFrom(message.getSender()); message.setRecipient(Message.RecipientType.TO, message.getSender()); Do you have any clue ? You can test it, sending an email to : contact- t...@webwinewatch.appspotmail.com Thanx again for your help. On 16 nov, 21:35, "Ikai L (Google)" wrote: > I couldn't reproduce your exact error, but I was able to put together a > working example of an inbound email handler to relay messages. I'm going to > expand the documentation about processing inbound emails. Here's some > working code:http://pastie.org/701517 > > Does this example help any? Code is also pasted below, but it'll be easier > for you to look at the Pastie. > > import javax.servlet.http.HttpServlet; > import javax.servlet.http.HttpServletRequest; > import javax.servlet.http.HttpServletResponse; > import javax.servlet.ServletException; > import javax.mail.*; > import javax.mail.util.ByteArrayDataSource; > import javax.mail.internet.MimeMessage; > import javax.mail.internet.MimeMultipart; > import javax.mail.internet.MimeBodyPart; > import javax.mail.internet.InternetAddress; > import javax.activation.DataHandler; > import java.io.IOException; > import java.io.InputStream; > import java.util.logging.Logger; > import java.util.Properties; > > public class MailHandlerServlet extends HttpServlet { > private static final Logger log = > Logger.getLogger(MailHandlerServlet.class.getName()); > private static final String RECIPIENT = "recipi...@gmail.com"; > private static final String SENDER = "sen...@google.com"; > > protected void doPost(HttpServletRequest request, HttpServletResponse > response) throws ServletException, IOException { > Properties props = new Properties(); > Session session = Session.getDefaultInstance(props, null); > try { > MimeMessage message = new MimeMessage(session, > request.getInputStream()); > > Object content = message.getContent(); // You could also > probably just use message.getInputStream() here > // and avoid the > conditional type check > > if (content instanceof String) { > log.info("Received a string"); > } else if (content instanceof InputStream) { > // My somewhat limited testing indicates that this is always > getting returned as an > // InputStream > > InputStream inputStream = (InputStream) content; > ByteArrayDataSource inboundDataSource = new > ByteArrayDataSource(inputStream, message.getContentType()); > Multipart inboundMultipart = new > MimeMultipart(inboundDataSource); > > // Set the body with whatever text you want > Multipart outboundMultipart = new MimeMultipart(); > MimeBodyPart messageBodyPart = new MimeBodyPart(); > messageBodyPart.setText("Set your body here"); > outboundMultipart.addBodyPart(messageBodyPart); > > // Loop over the multipart message coming in and > // append them to the outbound Multipart object > for (int i = 0; i < inboundMultipart.getCount(); i++) { > BodyPart part = inboundMultipart.getBodyPart(i); > /* > The content-disposition header is optional: > http://www.ietf.org/rfc/rfc1806.txt > > This header specifies the filename and type of > a MIME part. > */ > if(part.getDisposition() == null) { > // This is just a plain text email > } else { > // We have something interesting. Let's parse it. > > // Create a new ByteArrayDataSource with this part > MimeBodyPart inboundMimeBodyPart = (MimeBodyPart) > part; > InputStream is = part.getInputStream(); > ByteArrayDataSource mimePartDataSource = new > ByteArrayDataSource(is, inboundMimeBodyPart.getContentType()); > > // Create a new outbound MimeBodyPart and set this > as the handler > MimeBodyPart outboundMimeBodyPart = new > MimeBodyPart(); > outboundMimeBodyPart.setDataHandler(new > DataHandler(mimePartDataSource)); > > outboundMimeBodyPart.setFileName(inboundMimeBodyPart.getFileName()); > outboundMultipart.addBodyPart(outboundMimeBodyPart); > > } > > } > message.setContent
[appengine-java] jdo autorefer table
Hello, I have an entity and I want to menage some contacts, so I think to include a list of contact in the entity, the list of contats are a list of PrimiryKey of other User. It is all ok eccept whene I try to delete a contact. I don't receive error, but the contact will not delete. this is the user: class UserDAO { @Persistent @PrimaryKey private String emailKey; @Persistent(serialized = "true") private List contacts; // in the list other emailKey... } in the business class @Override public void removeContact(User user, User contact) { PersistenceManager pm = PMF.get().getPersistenceManager(); try { UserDAO userDao = pm.getObjectById(UserDAO.class, user.getEmailKey ()); userDao.getContacts().remove(contact.getEmailKey()); pm.makePersistent(userDao); } finally { pm.close(); } } I don't understand where is the mistake... (the similar method addContact work fine...) thanks! Ale -- 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=.
Re: [appengine-java] JDO : setting filter ! MyList.contains(\"tag") OR MyList.doesnotcontains(\"tag")
Yes. You will be able do queries on List properties using standard equality and inequality filters. You can read more about how to do queries here: http://code.google.com/appengine/docs/java/datastore/queriesandindexes.html On Fri, Nov 13, 2009 at 3:15 AM, Prashant wrote: > Hi, > > is there any way to filter entities for not containing a tag like * ! > MyList.contains(\"tag") *OR* MyList.doesnotcontains(\"tag")* > > 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=. > -- Ikai Lan Developer Programs Engineer, Google 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=.
Re: [appengine-java] Problems with large request/response headers
Matt, This looks like it may be a JeTTy issue: http://jira.codehaus.org/browse/JETTY-336 That being said, I'm curious as to what data you are storing in the cookie. Less than 1.5% of sites pass cookies larger than 1501 bytes, and there are performance implications for passing large amounts of cookies: http://yuiblog.com/blog/2007/03/01/performance-research-part-3 Is this data you can store in the session instead? On Fri, Nov 13, 2009 at 12:05 PM, Matthew McGinty wrote: > I'm using the GAE Java Dev Server (i.e. Jetty). > When I request a page that sends a large amount of cookie data to the > browser and then re-request the page (so that the browser sends the > cookies back to the server) I get this stacktrace: > > == > Nov 13, 2009 6:35:13 PM com.google.apphosting.utils.jetty.JettyLogger > warn > WARNING: handle failed > java.io.IOException: FULL head >at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:276) >at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205) >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) > == > > The behavior I see is that the browser receives what seems to be a > completely empty response body, and the access log does not show the > request at all (likely because the request/response protocol was > halted when the exception occured). If I configure my browser to send > its requests through a diagnostic proxy tool, I can see that the > request headers being sent are about 5k total. But the response takes > 2-3 minutes to come. Once it does, the proxy tool shows me only > response headers (no response body): > > === > HTTP/1.1 200 OK > Content-Type: text/html; charset=utf-8 > Expires: Thu, 01 Jan 1970 00:00:00 GMT > Set-Cookie: = > Set-Cookie: = > Set-Cookie: = > Transfer-Encoding: chunked > Server: Jetty(6.1.x) > === > > which I suppose explains why the browser renders it as an empty > response. > > I found a clue here: > > > http://mail-archives.apache.org/mod_mbox/geronimo-dev/200711.mbox/%3c8189103.1194033655205.javamail.j...@brutus%3e > > I've confirmed that if I delete the cookies from my browser and re- > request... the problem does not occur for that request. > In other words the problem only occurs when the browser is sending a > large amount of request headers (In my case cookies it already > received from a previous request to the test page). > > However the solution given is to switch from Jetty to Tomcat, which is > not something that can be done when using GAE Java Dev server. > So... does anyone know if the Jetty that's bundled with GAE Java Dev > Server can be configured to use a larger buffer for the *request* > headers? > And if so... how? > > A JVM System property perhaps... passed in the WEB-INF/appengine- > web.xml file? > > I also ran the same test/request on regular (non-Google App Engine) > Jetty (v 6.1.16) and get the same observed behavior (empty response > received) however the stacktrace is quite different suggesting that > the problem is now with the size of the buffer used for the *response* > headers: > > = > java.lang.ArrayIndexOutOfBoundsException: 4096 >at org.mortbay.io.ByteArrayBuffer.poke(ByteArrayBuffer.java: > 268) >at org.mortbay.io.AbstractBuffer.put(AbstractBuffer.java:456) >at org.mortbay.jetty.HttpFields$Field.put(HttpFields.java: > 1384) >at org.mortbay.jetty.HttpGenerator.completeHeader > (HttpGenerator.java:523 > ) >at org.mortbay.jetty.HttpConnection.commitResponse > (HttpConnection.java:6 > 11) >at org.mortbay.jetty.HttpConnection$Output.flush > (HttpConnection.java:946 > ) >at org.mortbay.jetty.AbstractGenerator$OutputWriter.flush > (AbstractGenera > tor.java:733) >at java.io.PrintWriter.flush(Unknown Source) > = > > I once again configured my browser to send all its requests through my > diagnostic proxy tool. > The tool shows me that the response that comes from Jetty (after 2-3 > minutes) is: > > > HTTP/1.1 413 FULL head > Connection: close > Server: Jetty(6.1.16) > > > The 413 Response status code means "Request Entity Too Large" and the > HTTP spec says that the server may close the connection in that case. > > Once again I used my proxy tool to confirm that the size of the > request headers is about 5k. > In all cases it is a simple GET request so there is no request body > (i.e. payload). > > Can't Jetty take more than 5k of request headers??? > > -- > > 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,
Re: [appengine-java] Querying sub objects with JDOQL in GAE/J
Can you post the queries you have attempted as well as the errors? On Tue, Nov 10, 2009 at 10:40 PM, enthusiast wrote: > > I have a very basic question about JDOQL with GAE/J. Hope someone can > shine light on this: > > I have modeled two persistent objects Employee and ContactInfo such > that Employee contains an instance of ContactInfo, as follows: > > ContactInfo.java > > import com.google.appengine.api.datastore.Key; > // ... imports ... > > @PersistenceCapable(identityType = IdentityType.APPLICATION) > public class ContactInfo { >@PrimaryKey >@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) >private Key key; > >@Persistent >private String city; > >// ... > } > > > Employee.java > > import ContactInfo; > // ... imports ... > > @PersistenceCapable(identityType = IdentityType.APPLICATION) > public class Employee { >@PrimaryKey >@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) >private Key key; > >@Persistent >private Integer salary; > >@Persistent >private ContactInfo contactInfo; > >Integer getSalary() { >return salary; >} > >void setSalary(Integer salary) { >this.salary = salary; >} > >ContactInfo getContactInfo() { >return contactInfo; >} > >void setContactInfo(ContactInfo contactInfo) { >this.contactInfo = contactInfo; >} > >// ... > } > > I am able to create instances of Employee with relevant ContactInfo > objects. However, I am not able to query for Employee which uses a > field on the ContactInfo object. E.g. If I want to retrieve only those > employees whose salary > 1 AND ContactInfo.city == "New York", how > do I construct such a query? > > If I just want to query on the field in the Employee object, I get the > results, but when I use a field in the sub-object of Employee (i.e. > ContactInfo) I get an error. > > Any help??? > --~--~-~--~~~---~--~~ > 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 > -~--~~~~--~~--~--~--- > > -- Ikai Lan Developer Programs Engineer, Google 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=.
Re: [appengine-java] child object's get orphaned
It's possible to orphan a child object, but only if you delete the parent entity. The reason is that the parent path information is stored in the key of the child object: http://code.google.com/appengine/docs/java/datastore/queriesandindexes.html On Sun, Nov 15, 2009 at 9:28 PM, ascetik wrote: > Is is possible to update a child object directly(never calling the > parent) and still reliably keep the 'owned one to many' relationship? > I have been doing this on one of my apps and then noticed that the > children will sometimes become orphaned from the parent. I'm trying to > track down the problem but it occurred to me that this may be messing > up the index or something strange like that. > > Does this make sense or should i elaborate more? > > the structure is similar to: > > public class UserObj { > @PrimaryKey > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > private Long id; >@Persistent >private List Vehicles; >public Long getId() { >return id; >} >public void setId(Long id) { >this.id = id; >} >public List getVehicles() { >return Vehicles; >} >public void setVehicles(List vehicles) { >Vehicles = vehicles; >} > > } > > > > later on I update one of the VehicleObj's based on a search without > ever instantiating the parent UserObj and every so often i loose a > vehicle that should be attached to the UserObj. It's still in the > datastore just orphaned. > > This may not be the problem but i thought it was a good place to start > tracking it down. > > -- > > 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=. > > > -- Ikai Lan Developer Programs Engineer, Google 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=.
[appengine-java] Re: jdo autorefer table
Solved. I remove the (serialized = "true") from the list and add pm.detacheCopy when I return data from the entity user. Now it's work fine. On Nov 16, 11:14 pm, ale wrote: > Hello, > I have an entity and I want to menage some contacts, so I think to > include a list of contact in the entity, the list of contats are a > list of PrimiryKey of other User. > It is all ok eccept whene I try to delete a contact. I don't receive > error, but the contact will not delete. > > this is the user: > > class UserDAO { > > @Persistent > @PrimaryKey > private String emailKey; > > @Persistent(serialized = "true") > private List contacts; // in the list other emailKey... > > } > > in the business class > > @Override > public void removeContact(User user, User contact) { > PersistenceManager pm = PMF.get().getPersistenceManager(); > try { > UserDAO userDao = pm.getObjectById(UserDAO.class, > user.getEmailKey > ()); > userDao.getContacts().remove(contact.getEmailKey()); > pm.makePersistent(userDao); > } finally { > pm.close(); > } > > } > > I don't understand where is the mistake... (the similar method > addContact work fine...) > > thanks! > > Ale -- 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=.
Re: [appengine-java] Re: case sensitivity
http://groups.google.com/group/google-appengine-java/search?group=google-appengine-java&q=lowercase+query&qt_g=Search+this+group Kris wrote: > I'm more concerned about the proper way to do this generically. I > can't realistically store duplicates of every string based field that > I may want to search for. > > > On Nov 16, 11:36 am, Rusty Wright wrote: >> The recommended approach is to store the userName in all lower case, as an >> additional field/column, and then do the toLowerCase on the incoming >> parameter user name when you do the query and use that field/column that was >> stored in lower case. >> >> >> >> Kris wrote: >>> Is there any way to perform a JDO query on google app engine using a >>> case insensitive string comparison? e.g. >>> For example, >>>Query query = pm.newQuery(User.class, "userName.toLowerCase() == >>> user && password == pass"); >>>query.declareParameters("String user, String pass"); >>>query.setUnique(true); >>>User user = (User) query.execute(userName.toLowerCase(), >>> password); >>> Of course GAE does not support the usage of toLowerCase() in the >>> filter string. >>> There's probably a terribly simple way to do this that I'm just not >>> aware of. >>> -- >>> 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=. > > -- > > 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=. > > -- 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=.
Re: [appengine-java] JDO not saved (commit) when using spring @ModelAttribute
http://static.springsource.org/spring/docs/3.0.0.RC1/javadoc-api/org/springframework/orm/jdo/support/OpenPersistenceManagerInViewFilter.html That's the 3.0.0.rc1 version of the docs but it's probably the same for 2.5.6. Ibrahim Hamza wrote: > Dear All > I use JDO with spring > and when i add @ModelAttribute("countries") > All things go fine except the data not saved without any exception > When query from another datastore > > > @Controller > public class PortController { > > private static final String FORM_MODEL_KEY = "ports"; > > private static final String FORM_UPDATE_KEY = "port/Edit"; > > private static final String REDIRECT_LIST_VIEW_KEY = "redirect:/port/ > home.htm" ; > > @Autowired > private PortDAO portDAO; > @Autowired > private CountryDAO countryDAO; > > public PortController() {} > > > > @InitBinder > protected void initBinder(HttpServletRequest request, > ServletRequestDataBinder binder) throws Exception { > binder.registerCustomEditor(String.class, new > StringTrimmerEditor(false)); > binder.registerCustomEditor > (com.xesolution.domain.Country.class, new CountryEditor(countryDAO)); > > } > > @RequestMapping(value="/port/home.htm") > public ModelMap list() { > return new ModelMap(FORM_MODEL_KEY,portDAO.readAll()); > } > @RequestMapping(value="/port/new.htm") > public ModelAndView create(){ > Port port = new Port(); > return new ModelAndView(FORM_UPDATE_KEY,FORM_MODEL_KEY,port); > } > @RequestMapping(value="/port/update.htm") > public ModelAndView update(@RequestParam("id") String id) { > Port result = portDAO.read(id); > return new ModelAndView(FORM_UPDATE_KEY,FORM_MODEL_KEY, result); > } > > > @RequestMapping(value="/port/save.htm", method = RequestMethod.POST) > public ModelAndView save(@ModelAttribute(FORM_MODEL_KEY) Port port, > BindingResult result, SessionStatus status) { > > new PortValidator().validate(port, result); > if (result.hasErrors()) > { > return new ModelAndView(FORM_UPDATE_KEY, FORM_MODEL_KEY, > port); > } > else > { > portDAO.persist(port); > return new ModelAndView(FORM_UPDATE_KEY, FORM_MODEL_KEY, port); > return new ModelAndView(REDIRECT_LIST_VIEW_KEY, list()); > } > } > > @ModelAttribute("countries") > public List populateCountry() { > //this make data not saved > return countryDAO.readAll(); > //But this make the data saved > //return portDAO.readAll(); > } > > public void setPortDAO(PortDAO portDAO) { > this.portDAO = portDAO; > } > } > and this is jsp line which display the form select > itemValue="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=. > > -- 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=.
Re: [appengine-java] JDO not saved (commit) when using spring @ModelAttribute
Forgot to add; here's how I used it in my web.xml: OpenPersistenceManagerInViewFilter org.springframework.orm.jdo.support.OpenPersistenceManagerInViewFilter OpenPersistenceManagerInViewFilter /* The other thing you could do is use the persistenceManager's detachCopy method on anything you're sending out to the web view layer. Ibrahim Hamza wrote: > Dear All > I use JDO with spring > and when i add @ModelAttribute("countries") > All things go fine except the data not saved without any exception > When query from another datastore > > > @Controller > public class PortController { > > private static final String FORM_MODEL_KEY = "ports"; > > private static final String FORM_UPDATE_KEY = "port/Edit"; > > private static final String REDIRECT_LIST_VIEW_KEY = "redirect:/port/ > home.htm" ; > > @Autowired > private PortDAO portDAO; > @Autowired > private CountryDAO countryDAO; > > public PortController() {} > > > > @InitBinder > protected void initBinder(HttpServletRequest request, > ServletRequestDataBinder binder) throws Exception { > binder.registerCustomEditor(String.class, new > StringTrimmerEditor(false)); > binder.registerCustomEditor > (com.xesolution.domain.Country.class, new CountryEditor(countryDAO)); > > } > > @RequestMapping(value="/port/home.htm") > public ModelMap list() { > return new ModelMap(FORM_MODEL_KEY,portDAO.readAll()); > } > @RequestMapping(value="/port/new.htm") > public ModelAndView create(){ > Port port = new Port(); > return new ModelAndView(FORM_UPDATE_KEY,FORM_MODEL_KEY,port); > } > @RequestMapping(value="/port/update.htm") > public ModelAndView update(@RequestParam("id") String id) { > Port result = portDAO.read(id); > return new ModelAndView(FORM_UPDATE_KEY,FORM_MODEL_KEY, result); > } > > > @RequestMapping(value="/port/save.htm", method = RequestMethod.POST) > public ModelAndView save(@ModelAttribute(FORM_MODEL_KEY) Port port, > BindingResult result, SessionStatus status) { > > new PortValidator().validate(port, result); > if (result.hasErrors()) > { > return new ModelAndView(FORM_UPDATE_KEY, FORM_MODEL_KEY, > port); > } > else > { > portDAO.persist(port); > return new ModelAndView(FORM_UPDATE_KEY, FORM_MODEL_KEY, port); > return new ModelAndView(REDIRECT_LIST_VIEW_KEY, list()); > } > } > > @ModelAttribute("countries") > public List populateCountry() { > //this make data not saved > return countryDAO.readAll(); > //But this make the data saved > //return portDAO.readAll(); > } > > public void setPortDAO(PortDAO portDAO) { > this.portDAO = portDAO; > } > } > and this is jsp line which display the form select > itemValue="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=. > > -- 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=.
[appengine-java] Ancestor queries in JPQL? / Getting "Key of parameter value does not have a parent"
Test app to reproduce: http://ancestortest.latest.duh-test.appspot.com/ Source code: http://ancestortest.latest.duh-test.appspot.com/src/ancestortest/AncestorTestServlet.java http://ancestortest.latest.duh-test.appspot.com/src/ancestortest/UserAccount.java http://ancestortest.latest.duh-test.appspot.com/src/ancestortest/UserAccountModification.java This sample code basically creates two UserAccount objects and attaches a UserAccountModification to one of them. Then, a query (which, unless the datastore is really slow, should return an empty list): = Query q = em.createQuery("select m from UserAccountModification m where m.modTime < :newest and m.owner = :owner order by modTime desc"); q.setParameter("newest", System.currentTimeMillis() - 1L); q.setParameter("owner", user1); List mods = q.getResultList(); = I get the following exception: javax.persistence.PersistenceException: SELECT FROM UserAccountModification m WHERE m.modTime < :newest and m.owner = :owner ORDER BY modTime desc: Key of parameter value does not have a parent. at org.datanucleus.jpa.NucleusJPAHelper.getJPAExceptionForNucleusException (NucleusJPAHelper.java:264) at org.datanucleus.jpa.JPAQuery.getResultList(JPAQuery.java:179) at ancestortest.AncestorTestServlet.doGet(AncestorTestServlet.java: 46) I must be missing something here. The docs for GAE talk about ensuring the use of ancestor filters when inside a transaction, for instance, and there's the ANCESTOR IS operator in GQL. However, I can't seem to figure out how properly to express this in JPQL (as "ANCESTOR IS" is a syntax error there), and there's no docs that I can find on doing this in JPA. The query is meant to find UserAccountModification objects all residing under a given "owner", which happens to be the ancestor of those objects. Is there a proper expression for this using JPQL? -- 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=.
Re: [appengine-java] 500 Internal Server Error, when update appl
The problem is not fixed , i can't upload update. The happened only with my account? On Mon, Nov 16, 2009 at 11:59 PM, Ikai L (Google) wrote: > Have you been able to update this application? > > On Wed, Nov 11, 2009 at 11:53 PM, Jackroz wrote: > >> Hi Team, >> >> Last two day i can't update appl, what is wrong? >> >> Please see detail log: >> >> Unable to update: >> java.io.IOException: Error posting to URL: >> >> http://appengine.google.com/api/appversion/cloneblobs?app_id=aapcore&version=2&; >> 500 Internal Server Error >> >> Server Error (500) >> A server error has occurred. >> >>at com.google.appengine.tools.admin.ServerConnection.send >> (ServerConnection.java:143) >>at com.google.appengine.tools.admin.ServerConnection.post >> (ServerConnection.java:81) >>at com.google.appengine.tools.admin.AppVersionUpload.send >> (AppVersionUpload.java:427) >>at com.google.appengine.tools.admin.AppVersionUpload.cloneFiles >> (AppVersionUpload.java:293) >>at >> com.google.appengine.tools.admin.AppVersionUpload.beginTransaction >> (AppVersionUpload.java:255) >>at com.google.appengine.tools.admin.AppVersionUpload.doUpload >> (AppVersionUpload.java:98) >>at com.google.appengine.tools.admin.AppAdminImpl.update >> (AppAdminImpl.java:56) >>at com.google.appengine.tools.admin.AppCfg$UpdateAction.execute >> (AppCfg.java:521) >>at com.google.appengine.tools.admin.AppCfg.(AppCfg.java:130) >>at com.google.appengine.tools.admin.AppCfg.(AppCfg.java:58) >>at com.google.appengine.tools.admin.AppCfg.main(AppCfg.java:54) >> com.google.appengine.tools.admin.AdminException: Unable to update app: >> Error posting to URL: >> http://appengine.google.com/api/appversion/cloneblobs?app_id=aapcore&version=2&; >> 500 Internal Server Error >> >> Server Error (500) >> A server error has occurred. >> >>at com.google.appengine.tools.admin.AppAdminImpl.update >> (AppAdminImpl.java:62) >>at com.google.appengine.tools.admin.AppCfg$UpdateAction.execute >> (AppCfg.java:521) >>at com.google.appengine.tools.admin.AppCfg.(AppCfg.java:130) >>at com.google.appengine.tools.admin.AppCfg.(AppCfg.java:58) >>at com.google.appengine.tools.admin.AppCfg.main(AppCfg.java:54) >> Caused by: java.io.IOException: Error posting to URL: >> >> http://appengine.google.com/api/appversion/cloneblobs?app_id=aapcore&version=2&; >> 500 Internal Server Error >> >> Server Error (500) >> A server error has occurred. >> >>at com.google.appengine.tools.admin.ServerConnection.send >> (ServerConnection.java:143) >>at com.google.appengine.tools.admin.ServerConnection.post >> (ServerConnection.java:81) >>at com.google.appengine.tools.admin.AppVersionUpload.send >> (AppVersionUpload.java:427) >>at com.google.appengine.tools.admin.AppVersionUpload.cloneFiles >> (AppVersionUpload.java:293) >>at >> com.google.appengine.tools.admin.AppVersionUpload.beginTransaction >> (AppVersionUpload.java:255) >>at com.google.appengine.tools.admin.AppVersionUpload.doUpload >> (AppVersionUpload.java:98) >>at com.google.appengine.tools.admin.AppAdminImpl.update >> (AppAdminImpl.java:56) >>... 4 more >> >> >> -- >> >> 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=. >> >> >> > > > -- > Ikai Lan > Developer Programs Engineer, Google 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=. > -- Best regards, Yakov Liskoff Mobile: 972-54-4512963 Email: jrozn...@gmail.com Web: http://www.vcomm.co.nr IM: jackobl (Skype) - The contents of this email and any attachments are confidential. It is intended for the named recipient(s) only. - -- 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=.
[appengine-java] Re: Can't send mail with attachment using JavaMail API
In fact standards attachments works. But it's not what I'm trying do do. I'm need to relay HTML messages with inline images and this is still not working. Is it a kind of limitation of GAE or is it supposed to work ? Thanx for your help. François On 16 nov, 23:09, mably wrote: > Hi Ikai, thanx for you help. > > I've copy pasted your code on my webapp (webwinewatch), I've no error > but the mail isn't correctly relayed, all attachements are removed. > > I've just modified the sender, from and recipient lines : > > message.setSender(new InternetAddress("@gmail.com", "Relay > account")); > message.setFrom(message.getSender()); > message.setRecipient(Message.RecipientType.TO, message.getSender()); > > Do you have any clue ? > > You can test it, sending an email to : contact- > t...@webwinewatch.appspotmail.com > > Thanx again for your help. > > On 16 nov, 21:35, "Ikai L (Google)" wrote: > > > > > I couldn't reproduce your exact error, but I was able to put together a > > working example of an inbound email handler to relay messages. I'm going to > > expand the documentation about processing inbound emails. Here's some > > working code:http://pastie.org/701517 > > > Does this example help any? Code is also pasted below, but it'll be easier > > for you to look at the Pastie. > > > import javax.servlet.http.HttpServlet; > > import javax.servlet.http.HttpServletRequest; > > import javax.servlet.http.HttpServletResponse; > > import javax.servlet.ServletException; > > import javax.mail.*; > > import javax.mail.util.ByteArrayDataSource; > > import javax.mail.internet.MimeMessage; > > import javax.mail.internet.MimeMultipart; > > import javax.mail.internet.MimeBodyPart; > > import javax.mail.internet.InternetAddress; > > import javax.activation.DataHandler; > > import java.io.IOException; > > import java.io.InputStream; > > import java.util.logging.Logger; > > import java.util.Properties; > > > public class MailHandlerServlet extends HttpServlet { > > private static final Logger log = > > Logger.getLogger(MailHandlerServlet.class.getName()); > > private static final String RECIPIENT = "recipi...@gmail.com"; > > private static final String SENDER = "sen...@google.com"; > > > protected void doPost(HttpServletRequest request, HttpServletResponse > > response) throws ServletException, IOException { > > Properties props = new Properties(); > > Session session = Session.getDefaultInstance(props, null); > > try { > > MimeMessage message = new MimeMessage(session, > > request.getInputStream()); > > > Object content = message.getContent(); // You could also > > probably just use message.getInputStream() here > > // and avoid the > > conditional type check > > > if (content instanceof String) { > > log.info("Received a string"); > > } else if (content instanceof InputStream) { > > // My somewhat limited testing indicates that this is always > > getting returned as an > > // InputStream > > > InputStream inputStream = (InputStream) content; > > ByteArrayDataSource inboundDataSource = new > > ByteArrayDataSource(inputStream, message.getContentType()); > > Multipart inboundMultipart = new > > MimeMultipart(inboundDataSource); > > > // Set the body with whatever text you want > > Multipart outboundMultipart = new MimeMultipart(); > > MimeBodyPart messageBodyPart = new MimeBodyPart(); > > messageBodyPart.setText("Set your body here"); > > outboundMultipart.addBodyPart(messageBodyPart); > > > // Loop over the multipart message coming in and > > // append them to the outbound Multipart object > > for (int i = 0; i < inboundMultipart.getCount(); i++) { > > BodyPart part = inboundMultipart.getBodyPart(i); > > /* > > The content-disposition header is optional: > > http://www.ietf.org/rfc/rfc1806.txt > > > This header specifies the filename and type of > > a MIME part. > > */ > > if(part.getDisposition() == null) { > > // This is just a plain text email > > } else { > > // We have something interesting. Let's parse it. > > > // Create a new ByteArrayDataSource with this part > > MimeBodyPart inboundMimeBodyPart = (MimeBodyPart) > > part; > > InputStream is = part.getInputStream(); > > ByteArrayDataSource mimePartDataSource = new > > ByteArrayDataSource(is, inboundMimeBodyPart.getContentType()); > > > // Create a new ou