How to seperate email body from a rendered thread through IMAP? - jakarta-mail

I am fetching emails using IMAP but when we render a particular message body along with it fetches all replies/conversation along with it. I want to separate those messages and also want to separate a particular message body with a signature as well.
what I received right now
What I want to achieve
HTML body for first mail i.e. receieved mail
"<div style=\"padding-bottom: 20px;\"></div><div><html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<title></title>\n</head>\n<body>\n<div dir=\"ltr\">\n<div>Hey Bhavin,<br />\n<br /></div>\nThis is LA TEST 01 to test threads for Letter<br clear=\"all\" />\n<div>\n<div><br />\n--<br />\n<div dir=\"ltr\" class=\"gmail_signature\" data-smartmail=\n\"gmail_signature\">\n<div dir=\"ltr\">\n<div>\n<div dir=\"ltr\">----------<br />\n<span style=\"font-family:georgia,serif\"><font size=\"2\">Thanks &\nRegards</font><br /></span></div>\n<div>Stack<br /></div>\n<div dir=\"ltr\"><span style=\"font-family:georgia,serif\"><font size=\n\"2\"><i><br /></i></font></span></div>\n</div>\n</div>\n</div>\n</div>\n</div>\n</div>\n</body>\n</html>\n</div>"
HTML body for second mail i.e. reply
"<div style=\"padding-bottom: 20px;\"></div><div><html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<title></title>\n</head>\n<body>\n<div class=\"ydp462b3c77yahoo-style-wrap\" style=\n\"font-family: verdana, helvetica, sans-serif; font-size: 13px;\">\n<div>\n<div dir=\"ltr\" data-setdir=\"false\">Hi Stack,<br />\n<br />\nThanks for the info. Let me do the test for LA TEST 01 from my side\nas well.<br /></div>\n<div><br /></div>\n<div class=\"ydp462b3c77signature\">\n<div style=\n\"font-family:verdana, helvetica, sans-serif;font-size:13px;\">\n--<br />\n<div><font size=\"2\">Thanks & Regards</font></div>\n<div><b>Bhavin Bhadani</b></div>\n<div id=\"ydp267338c6yui_3_16_0_ym19_1_1469425690897_2386\">\n<font size=\"2\"><i>iOS Developer </i></font><font face=\n\"Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif\"><br />\n</font></div>\n<div><font size=\"2\"><i><b>skype:</b>\nbhavi</i></font></div>\n</div>\n</div>\n</div>\n<div><br /></div>\n<div><br /></div>\n</div>\n<div id=\"yahoo_quoted_4513314037\" class=\"yahoo_quoted\">\n<div style=\n\"font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;\">\n<div>On Wednesday, 23 June, 2021, 12:09:22 pm IST, Stack Help\n<stackh#gmail.com> wrote:</div>\n<div><br /></div>\n<div><br /></div>\n<div>\n<div id=\"yiv6922098475\">\n<div dir=\"ltr\">\n<div>Hey Bhavin,<br />\n<br /></div>\nThis is LA TEST 01 to test threads for Letter<br clear=\"all\" />\n<div>\n<div><br />\n--<br />\n<div dir=\"ltr\" class=\"yiv6922098475gmail_signature\">\n<div dir=\"ltr\">\n<div>\n<div dir=\"ltr\">----------<br />\n<span style=\"font-family:georgia, serif;\"><font style=\n\"background-color: inherit;\" size=\"2\">Thanks &\nRegards</font><br /></span></div>\n<div>Stack<br /></div>\n<div dir=\"ltr\"><span style=\n\"font-family:georgia, serif;\"><font style=\n\"background-color: inherit;\" size=\n\"2\"><i><br /></i></font></span></div>\n</div>\n</div>\n</div>\n</div>\n</div>\n</div>\n</div>\n</div>\n</div>\n</div>\n</body>\n</html>\n</div>"
I am using MailCore 2 for iOS and JavaMail for Android.

Related

React production build differs from development | polyfill does not run

I've run npx create-react-app . and imported clip-path manually. Development build works without a problem, but the production one doesn't seem to work. Issue is the same on IE11 and Edge44
Steps to reproduce:
npx create-react-app .
add "ie 11" to browserslist in package.json for prod and dev
npm i react-app-polyfill
in index.js add import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';
Grab shapes-polyfill.js from css-shapes-polyfill and insert script in .index.html > head, and also add browser polyfill.
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser-polyfill.min.js"></script>
<script src='shapes-polyfill.js'></script>
include <style> in index.html > head
<style>
#polygon-shape-outside {
width: 200px;
height: 200px;
float: left;
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200px' height='200px'><polygon points='0,0 142,33 89,141 0,200' fill='rgba(0,0,255, 0.25)'/></svg>");
shape-outside: polygon(0px 0px, 142px 33px, 89px 141px, 0px 200px);
}
</style>
Insert div in App
<div style={{
width: 400,
fontSize: 10,
background: 'grey'
}}>
<div id="polygon-shape-outside"></div>
<p>Pelicans are a genus of large water birds comprising the family Pelecanidae. They are characterised by a long beak and large throat pouch used for catching prey and draining water from the scooped up contents before swallowing. They have predominantly pale plumage, the exceptions being the Brown and Peruvian Pelicans. The bills, pouches and bare facial skin of all species become brightly coloured before the breeding season. The eight living pelican species have a patchy global distribution, ranging latitudinally from the tropics to the temperate zone, though they are absent from interior South America as well as from polar regions and the open ocean. Fossil evidence of pelicans dates back at least 30 million years, to the remains of a beak very similar to that of modern species recovered from Oligocene strata in France.</p>
</div>
The image didn't show in IE because of IE is strict to SVG. You can refer to this Codepen Blog for details and here are the points:
Most browsers are lenient about the charset= string, but it's required for Internet Explorer. That means you need to use ;charset=utf8, instead of ;utf8,.
You will have to percent-encode characters that aren't URL-safe. For example, <svg> to %3Csvg%3E. You can minimize the amount of percent encoding that needs to be done by using single quotes ' instead of double quotes ".
According to this, I changed some parts of your code in <style> of index.html:
#polygon-shape-outside {
width: 200px;
height: 200px;
float: left;
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200px' height='200px'%3E%3Cpolygon points='0,0 142,33 89,141 0,200' fill='rgba(0,0,255, 0.25)'/%3E%3C/svg%3E");
shape-outside: polygon(0px 0px, 142px 33px, 89px 141px, 0px 200px);
}
Then it can run well in dev mode in all browsers.
About the difference between dev mode and prod mode: add data-shape-outside="polygon(0px 0px, 142px 33px, 89px 141px, 0px 200px)" in <div id="polygon-shape-outside">. Then the content will wrap around the image and the page runs well and exactly the same in both modes and in all browsers.

The request to API call datastore_v3.Put() was too large. using Objectify (DataStore) and not uploading files

I get the following error.
com.google.apphosting.api.ApiProxy$RequestTooLargeException: The
request to API call datastore_v3.Put() was too large.
I am using Objectify 4.0 and not uploading any file. I am using the DataStore for my app, but the only item above 1Mb is a _values blob in _ah_SESSION entity.
The images of the console are in:
http://goo.gl/qP7v7U
I dont know how to troubleshoot the issue and even when the error has been asked before, my problem is that I am not using files and I am actually using the datastore.
EDIT: Testing again, it seems to break in a Delete operation. Here's the log.
W 12:37:39.798 /editarContrato.jsf
com.google.apphosting.api.ApiProxy$RequestTooLargeException: The request to API call datastore_v3.Put() was too large.
at com.google.apphosting.utils.runtime.ApiProxyUtils.convertApiError(ApiProxyUtils.java:42)
at com.google.apphosting.runtime.ApiProxyImpl$AsyncApiFuture.success(ApiProxyImpl.java:497)
at com.google.apphosting.runtime.ApiProxyImpl$AsyncApiFuture.success(ApiProxyImpl.java:411)
at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher$1.runInContext(RpcStub.java:856)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:444)
at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:220)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:308)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:300)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:441)
at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher.runCallback(RpcStub.java:894)
at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher.rpcFinished(RpcStub.java:904)
at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher.success(RpcStub.java:883)
at com.google.net.rpc3.impl.client.RpcClientInternalContext.runCallbacks(RpcClientInternalContext.java:1130)
at com.google.net.rpc3.impl.client.RpcClientInternalContext.finishRpcAndNotifyApp(RpcClientInternalContext.java:1030)
at com.google.net.rpc3.impl.client.RpcNetChannel.afterFinishingActiveRpc(RpcNetChannel.java:1459)
at com.google.net.rpc3.impl.client.RpcNetChannel.finishRpc(RpcNetChannel.java:1280)
at com.google.net.rpc3.impl.client.RpcNetChannel.handleResponse(RpcNetChannel.java:2995)
at com.google.net.rpc3.impl.client.RpcNetChannel.messageReceived(RpcNetChannel.java:2731)
at com.google.net.rpc3.impl.client.RpcNetChannel.access$2900(RpcNetChannel.java:175)
at com.google.net.rpc3.impl.client.RpcNetChannel$TransportCallback.receivedMessage(RpcNetChannel.java:3922)
at com.google.net.rpc3.impl.client.RpcChannelTransportData$TransportCallback.receivedMessage(RpcChannelTransportData.java:669)
at com.google.net.rpc3.impl.wire.RpcBaseTransport.receivedMessage(RpcBaseTransport.java:457)
at com.google.apphosting.runtime.udrpc.UdrpcTransport$ClientAdapter.receivedMessage(UdrpcTransport.java:577)
at com.google.apphosting.runtime.udrpc.UdrpcTransport.dispatchPacket(UdrpcTransport.java:386)
at com.google.apphosting.runtime.udrpc.UdrpcTransport.readPackets(UdrpcTransport.java:283)
at com.google.apphosting.runtime.udrpc.UdrpcTransport$1.run(UdrpcTransport.java:100)
at com.google.net.eventmanager.AbstractFutureTask$Sync.innerRun(AbstractFutureTask.java:260)
at com.google.net.eventmanager.AbstractFutureTask.run(AbstractFutureTask.java:121)
at com.google.net.eventmanager.EventManagerImpl.runTask(EventManagerImpl.java:594)
at com.google.net.eventmanager.EventManagerImpl.internalRunWorkerLoop(EventManagerImpl.java:1011)
at com.google.net.eventmanager.EventManagerImpl.runWorkerLoop(EventManagerImpl.java:892)
at com.google.net.eventmanager.WorkerThreadInfo.runWorkerLoop(WorkerThreadInfo.java:161)
at com.google.net.eventmanager.EventManagerImpl$WorkerThread.run(EventManagerImpl.java:1879)
F 12:37:39.801 Uncaught exception from servlet
com.google.apphosting.api.ApiProxy$RequestTooLargeException: The request to API call datastore_v3.Put() was too large.
at com.google.apphosting.utils.runtime.ApiProxyUtils.convertApiError(ApiProxyUtils.java:42)
at com.google.apphosting.runtime.ApiProxyImpl$AsyncApiFuture.success(ApiProxyImpl.java:497)
at com.google.apphosting.runtime.ApiProxyImpl$AsyncApiFuture.success(ApiProxyImpl.java:411)
at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher$1.runInContext(RpcStub.java:856)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:444)
at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:220)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:308)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:300)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:441)
at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher.runCallback(RpcStub.java:894)
at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher.rpcFinished(RpcStub.java:904)
at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher.success(RpcStub.java:883)
at com.google.net.rpc3.impl.client.RpcClientInternalContext.runCallbacks(RpcClientInternalContext.java:1130)
at com.google.net.rpc3.impl.client.RpcClientInternalContext.finishRpcAndNotifyApp(RpcClientInternalContext.java:1030)
at com.google.net.rpc3.impl.client.RpcNetChannel.afterFinishingActiveRpc(RpcNetChannel.java:1459)
at com.google.net.rpc3.impl.client.RpcNetChannel.finishRpc(RpcNetChannel.java:1280)
at com.google.net.rpc3.impl.client.RpcNetChannel.handleResponse(RpcNetChannel.java:2995)
at com.google.net.rpc3.impl.client.RpcNetChannel.messageReceived(RpcNetChannel.java:2731)
at com.google.net.rpc3.impl.client.RpcNetChannel.access$2900(RpcNetChannel.java:175)
at com.google.net.rpc3.impl.client.RpcNetChannel$TransportCallback.receivedMessage(RpcNetChannel.java:3922)
at com.google.net.rpc3.impl.client.RpcChannelTransportData$TransportCallback.receivedMessage(RpcChannelTransportData.java:669)
at com.google.net.rpc3.impl.wire.RpcBaseTransport.receivedMessage(RpcBaseTransport.java:457)
at com.google.apphosting.runtime.udrpc.UdrpcTransport$ClientAdapter.receivedMessage(UdrpcTransport.java:577)
at com.google.apphosting.runtime.udrpc.UdrpcTransport.dispatchPacket(UdrpcTransport.java:386)
at com.google.apphosting.runtime.udrpc.UdrpcTransport.readPackets(UdrpcTransport.java:283)
at com.google.apphosting.runtime.udrpc.UdrpcTransport$1.run(UdrpcTransport.java:100)
at com.google.net.eventmanager.AbstractFutureTask$Sync.innerRun(AbstractFutureTask.java:260)
at com.google.net.eventmanager.AbstractFutureTask.run(AbstractFutureTask.java:121)
at com.google.net.eventmanager.EventManagerImpl.runTask(EventManagerImpl.java:594)
at com.google.net.eventmanager.EventManagerImpl.internalRunWorkerLoop(EventManagerImpl.java:1011)
at com.google.net.eventmanager.EventManagerImpl.runWorkerLoop(EventManagerImpl.java:892)
at com.google.net.eventmanager.WorkerThreadInfo.runWorkerLoop(WorkerThreadInfo.java:161)
at com.google.net.eventmanager.EventManagerImpl$WorkerThread.run(EventManagerImpl.java:1879)
Any help appreciated.
The AppStat error stack
#2998ms datastore_v3.RunQuery real=7ms api=0ms cost=0 billed_ops=[]
Stack:
com.google.appengine.tools.appstats.Recorder:276 makeAsyncCall()
com.google.apphosting.api.ApiProxy:199 makeAsyncCall()
com.google.appengine.api.datastore.DatastoreApiHelper:82 makeAsyncCall()
com.google.appengine.api.datastore.QueryRunnerV3:36 runQuery()
com.google.appengine.api.datastore.PreparedQueryImpl:32 runQuery()
com.google.appengine.api.datastore.PreparedQueryImpl:61 asQueryResultIterator()
com.googlecode.objectify.impl.engine.QueryEngine$ChunkingToRefIterator:100 <init>()
com.googlecode.objectify.impl.engine.QueryEngine$1:64 iterator()
com.googlecode.objectify.util.TranslatingQueryResultIterable:28 iterator()
com.googlecode.objectify.util.TranslatingQueryResultIterable:11 iterator()
com.googlecode.objectify.util.ResultProxy$1:26 translate()
com.googlecode.objectify.util.ResultProxy$1:22 translate()
com.googlecode.objectify.util.ResultTranslator:21 nowUncached()
com.googlecode.objectify.util.ResultCache:30 now()
com.googlecode.objectify.util.ResultProxy:52 invoke()
com.sun.proxy.$Proxy16:164 toArray()
co.gov.fonada.planeacion.mb.ContratoMB:67 fillContratos()
#4218ms memcache.Get real=71ms api=0ms cost=0 billed_ops=[]
Stack:
com.google.appengine.tools.appstats.Recorder:276 makeAsyncCall()
com.google.apphosting.api.ApiProxy:199 makeAsyncCall()
com.google.apphosting.api.ApiProxy:138 makeAsyncCall()
com.google.appengine.api.memcache.MemcacheServiceApiHelper:95 makeAsyncCall()
com.google.appengine.api.memcache.AsyncMemcacheServiceImpl:475 doGetAll()
com.google.appengine.api.memcache.AsyncMemcacheServiceImpl:436 getIdentifiables()
com.google.appengine.api.memcache.MemcacheServiceImpl:59 getIdentifiables()
com.googlecode.objectify.cache.EntityMemcache:215 getAll()
com.googlecode.objectify.cache.CachingAsyncDatastoreService:253 get()
com.googlecode.objectify.impl.engine.LoadEngine$Round:172 fetchPending()
com.googlecode.objectify.impl.engine.LoadEngine$Round:118 execute()
com.googlecode.objectify.impl.engine.LoadEngine:258 execute()
com.googlecode.objectify.impl.engine.QueryEngine$ChunkingToRefIterator:152 advanceBatch()
com.googlecode.objectify.impl.engine.QueryEngine$ChunkingToRefIterator:105 <init>()
com.googlecode.objectify.impl.engine.QueryEngine$1:64 iterator()
com.googlecode.objectify.util.TranslatingQueryResultIterable:28 iterator()
com.googlecode.objectify.util.TranslatingQueryResultIterable:11 iterator()
com.googlecode.objectify.util.ResultProxy$1:26 translate()
com.googlecode.objectify.util.ResultProxy$1:22 translate()
com.googlecode.objectify.util.ResultTranslator:21 nowUncached()
com.googlecode.objectify.util.ResultCache:30 now()
com.googlecode.objectify.util.ResultProxy:52 invoke()
com.sun.proxy.$Proxy16:164 toArray()
co.gov.fonada.planeacion.mb.ContratoMB:67 fillContratos()
New Edit:
I've discovered a big string in memcache, with _ahs* key, which is supposed to be a session variable. I think thats the variable thats getting too big. The text includes a copy of the HTML for "debug" and copyright disclaimers of a bunch of products.
The whole text is [clic here]
This is part of the text:
> pppppt6mainAccordion:formPago:dataPagos:modelInputFebrero2016uq~uq~uq~ppppuq~q~q~ �q~!q~$q~%q~ �pppppt6mainAccordion:formPago:dataPagos:modelInputFebrero2015uq~uq~uq~ppppuq~q~q~ �q~!q~$q~%q~ �pppppt6mainAccordion:formPago:dataPagos:modelInputFebrero2018uq~uq~uq~ppppuq~q~q~ �q~!q~$q~%q~ �pppppt6mainAccordion:formPago:dataPagos:modelInputFebrero2017uq~uq~uq~ppppuq~q~q~ �q~!q~$q~%q~ �pppppt%mainAccordion:formPago:dataPagos:ajaxuq~uq~uq~sq~Ssq~Ww#{pagoMB.buttonCrear}uq~Yq~[ppxwDB/formContrato.xhtml #806,33 actionListener="#{pagoMB.buttonCrear}"xsq~Ww'#{pagoMB.buttonCrear}java.lang.Voiduq~Yppxppppxxxtfacelets.ui.DebugOutputsr'com.sun.faces.facelets.tag.ui.UIDebug$2#E�#� -xq~
?#wt
1427384717777|9<!--
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
may not use this file except in compliance with the License. You can
obtain a copy of the License at
https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
or packager/legal/LICENSE.txt. See the License for the specific
language governing permissions and limitations under the License.
When distributing the software, include this License Header Notice in each
file and include the License file at packager/legal/LICENSE.txt.
GPL Classpath Exception:
Oracle designates this particular file as subject to the "Classpath"
exception as provided by Oracle in the GPL Version 2 section of the License
file that accompanied this code.
Modifications:
If applicable, add the following below the License Header, with the fields
enclosed by brackets [] replaced by your own identifying information:
"Portions Copyright [year] [name of copyright owner]"
Contributor(s):
If you wish your version of this file to be governed by only the CDDL or
only the GPL Version 2, indicate your decision by adding "[Contributor]
elects to include this software in this distribution under the [CDDL or GPL
Version 2] license." If you don't indicate a single choice of license, a
recipient has the option to distribute your version of this file under
either the CDDL, the GPL Version 2 or to extend the choice of license to
its licensees as provided above. However, if you add GPL Version 2 code
and therefore, elected the GPL Version 2 license, then the option applies
only if the new code is made subject to such option by the copyright
holder.
This file incorporates work covered by the following copyright and
permission notice:
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Debug - /editarContrato.xhtml</title>
<style type="text/css">
body, div, span, td, th, caption { font-family: 'Trebuchet MS', Verdana, Arial, Sans-Serif; font-size: small; }
ul, li, pre { padding: 0; margin: 0; }
h1 { color: #090; }
h2, h2 span { font-size: large; color: #339; }
h2 a { text-decoration: none; color: #339; }
.grayBox { padding: 8px; margin: 10px 0; border: 1px solid #CCC; background-color: #f9f9f9; }
#view { color: #090; font-weight: bold; font-size: medium; }
#tree, #vars { display: none; }
code { font-size: medium; }
#tree dl { color: #006; }
#tree dd { margin-top: 2px; margin-bottom: 2px; }
#tree dt { border: 1px solid #DDD; padding: 4px; border-left: 2px solid #666; font-family: "Courier New", Courier, mono; font-size: small; }
.uicText { color: #999; }
table { border: 1px solid #CCC; border-collapse: collapse; border-spacing: 0px; width: 100%; text-align: left; }
td { border: 1px solid #CCC; }
thead tr th { padding: 2px; color: #030; background-color: #F9F9F9; }
tbody tr td { padding: 10px 6px; }
Using #BalusC "poor man's debugging" approach for Listen and debug JSF lifecycle phases, I found out the error after END PHASE RENDER_RESPONSE 6.
Still dont know whats making my app to write these files to the storage.
Any help greatly appreciated.
1MB limit applies to all Datastore entities. You need to break down your large entity into smaller pieces.
Note that session is backed up by both Memcache and the Datastore, and both of them have this 1MB limit for individual entities. Make sure that all entities you put in a session are well below this limit.

Calling Google Apps Script as webapp from AppEngine returns 405

I have issues when I try to call a GAPPS script that is published as a webapp. I am trying to call this service from AppEngine. I am doing a POST method to this script with a JSON Payload. Urlfetch options are set to follow redirects and a timeout of 30 secs. The script is publicly available and open to anonymous users.
On my local GAE development machine, the URLFetch response from the script is 200, and all is fine.
When I move to production, the script gets executed but returns errors and an HTML page.
I have follow redirects on on URLFetch and I have set the deadline to 30secs.
status response : 405
response text :
<!DOCTYPE html><html lang="en" ><head><meta name="description" content="Web word processing, presentations and spreadsheets"><link rel="shortcut icon" href="//ssl.gstatic.com/docs/common/drive_favicon1.ico"><title>Google Drive -- Page Not Found</title><link href="//fonts.googleapis.com/css?family=Open+Sans:300" rel="stylesheet" type="text/css"><style>/* Copyright 2014 Google Inc. All Rights Reserved. */
.goog-inline-block{position:relative;display:-moz-inline-box;display:inline-block}* html .goog-inline-block{display:inline}*:first-child+html .goog-inline-block{display:inline}#drive-logo{color:#91959c;font-family:"Open Sans",Arial,sans-serif;font-size:27px;font-weight:300;position:absolute;text-shadow:0 1px 1px white;white-space:nowrap}#drive-logo img{padding:0 0.4em 0 0;position:relative;top:2px;vertical-align:middle}#drive-logo a{color:#91959c;text-decoration:none}#drive-logo span.goog-inline-block{margin-top:2px;vertical-align:top}</style><style type="text/css">body {background-color: #fff; font-family: Arial,sans-serif; font-size: 13px; margin: 0; padding: 0;}a, a:link, a:visited {color: #112ABB;}</style><style type="text/css">.errorMessage {font-size: 12pt; font-weight: bold; line-height: 150%;}</style></head><body><div style="margin: auto; max-width: 750px;"><div style="margin: 80px 40px 20px 40px; position:relative; "><div style="position: absolute; top: -80px;"><h1 id="drive-logo"><img src="//www.google.com/images/logos/google_logo_41.png" width="116" height="41" alt="Google logo" ><span class="goog-inline-block">Drive</span></h1></div><div align="center"><p class="errorMessage" style="padding-top: 50px">Sorry, the file you have requested does not exist.</p><p> Please check the address and try again. </p><div style="background: #F0F6FF; border: 1px solid black; margin-top: 35px; padding: 10px 125px; width: 300px;"><p><strong>Get stuff done with Google Drive</strong></p><p>Apps in Google Drive make it easy to create, store and share online documents, spreadsheets, presentations and more.</p><p>Learn more at drive.google.com/start/apps.</p></div></div></div></div></body></html>
response header:Expires=Fri, 01 Jan 1990 00:00:00 GMT
response header:X-XSS-Protection=1; mode=block
response header:Alternate-Protocol=443:quic,p=0.02
response header:Set-Cookie=NID=67=KSieONzrWKqWVEt8E4M2rUo_2nooEJ6qrh80LXTppGKYQux2iGFN-BHoqn7r5Yn0F4WaYtTbXDa6y2iAa3FtRBMAn6qf526lmPkZZek7nSQUvCv4wvthsDsL4P11Yx;Domain=.googleusercontent.com;Path=/;Expires=Tue, 02-Jun-2015 23:39:38 GMT;HttpOnly
response header:X-Google-Cache-Control=remote-fetch
response header:Server=GSE
response header:Cache-Control=no-cache, no-store, max-age=0, must-revalidate
response header:Pragma=no-cache
response header:X-Content-Type-Options=nosniff
response header:X-Frame-Options=SAMEORIGIN
response header:Date=Mon, 01 Dec 2014 23:39:38 GMT
response header:P3P=CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
response header:Allow=HEAD, GET
response header:x-chromium-appcache-fallback-override=disallow-fallback
response header:Via=HTTP/1.1 GWA
response header:Content-Type=text/html; charset=utf-8
The funny - no so much - thing is that the script WORKS NEVERTHELESS most of the time but not always or not for all users.
You can see that thet response header says Allow=HEAD, GET but I implemented doPOst in my script.
Nevertheless, I have tried solving this problem by rewriting the whole things to work with GET and a parameter but I am running into similar issues !
Long story short : works perfectly and with status response 200 on GAE local development server, faulty responses and unstable behavior when deployed to GAE>
GAS is very picky when running as webapp. Sometimes it helps to put the script into a public folder on Google Drive.

An image to be displayed inline in a JavaMail created message shows up twice in Apple Mail – but not Outlook?

An image to be displayed inline in a JavaMail created message shows up twice in Apple Mail – but not Outlook?
EmailMaster sends a test email message that includes:
1) an image sent with the email to be displayed inline in the title when the message is opened
2) a link to an image that has to be downloaded from a remote URL after the message is displayed.
The goal is for the message to be fully rendered when it is opened (owl). Not require the reader download it before seeing full message.
The code below works perfectly when the message is opened in a client like Outlook.
-- the Owl image displayed in line when its opened, and
-- the underline must be downloaded.
When AppleMail opens the message the Owl is displayed twice. The screen show:
-- the owl as a standalone image,
-- then the message with the owl correctly displayed in the Title.
I can’t post a screen shot, but I put a screen shot of the AppleMail screen at
http://america-3.org/images/shot.jpg
Can anyone point me to the cause of the problem? Or a solution?
HTML code added as one MimeBodyPart.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="cid:fonts" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.text-blue-12 {font-family: Verdana, Arial, Helvetica, sans-serif;
text-decoration: none; font-weight: normal;
font-size:12pt; color: #0F0F0F}
body { margin: 0; padding: 0; background-color: #1A4576; width: 480px;}
tr {width:100%; background-color: white;}
-->
</style>
</head>
<body>
<table width='480px' cellspacing='0' cellpadding='6' class='text-blue-12' align="center">
<tr><td style='text-align: center;'>
Hello! <img src='cid:owl'>
</td></tr>
<tr><td style='text-align: center;'>
<img align="center" alt="Shadow" class="kmImage"
src="https://d3k81ch9hvuctc.cloudfront.net/assets/email/bottom_shadow_444.png"
width="600" style="border: 0; height: auto; line-height: 100%;
outline:none; text-decoration: none; max-width: 100%; padding-bottom: 0;
display: inline; vertical-align: bottom" />
</td></tr>
<tr><td>
This is test # 1005. The Table should be a 480px wide and centered.
If not there is a problem.
</td></tr>
<tr><td>
Yours truly,
GLB
</td></tr>
</table>
</body>
</html>
Extract of Java Class I use to test JavaMail code
public class EmailMaster {
/* JavaMail attempts to use IPv6 to connect. Windows IPv4.
* The error message will be "Network Unreachable: Connect.
* To fix it, I ran this code from the command window
* setx _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true
* I tried to set _JAVA_OPTIONS as an environment variable but that didn't
* work.
*/
/* the constructor instantiates EmailMaster.
* It parses a ".properties" text file that provides the everything
* needed to define a message:
* -- send from, reply to, subject etc. Strings
* -- local paths to one or more files:
* .. a text file containing the to addresses.
* .. the HTML file that holds the message body,
* .. one of more images to be displayed inline
* in the HTML message body. I used one.
* .. one or more files to be attached to the msg. I used one.
*/
/* then it calls sendEmail() to read through the list of addresses
* and sends an individual email to each address*/
sendEmail () {
/*this section of code is done once. */
Session session = Session.getInstance(this.sessionParameters);
SMTPTransport tr = new SMTPTransport(session, new URLName (host));
tr.connect(...); // this is successful
/* the method loops through this section for every to address provided*/
Message msg = new MimeMessage(session);
msg.setReplyTo(this.replyToAddress);// read from properties file
msg.setSentDate(new java.util.Date());// read from properties file
msg.setSubject(this.subject);// read from properties file
msg.setFrom(this.fromAddress);// read from properties file
msg.setRecipient(RecipientType.TO, singleToAddress);// read from properties file
MimeMultipart mmp = new MimeMultipart();
/* add a MimeBodyPart for each image be displayed inline the HTML text */
for (MimeBodyPart part : this.imagesBodyParts.values()) {
mmp.addBodyPart(part);
/* add a MimeBodyPart for each HTML page in the message. */
for (MimeBodyPart part : this.attachmentBodyParts.values()) {
mmp.addBodyPart(part);
}
mmp.addBodyPart(this.msgPart);
msg.setContent(mmp);
msg.saveChanges();
tr.sendMessage(msg, msg.getAllRecipients());
}
}
There's a limit to how much control you have over how mail readers display messages. In the end, you may not be able to accomplish what you're trying to do with all mail readers. That said, there's some issues with the code you posted...
You've got a double nested "for" loop that first adds an image body part, then adds a bunch of attachment (html?) body parts, then sends the message, then adds more of both to the same message, then sends the message again, and so on. Surely this isn't what you intended.
If you want the message to include a single html part and some image parts that are referenced by the html part, you need to create a multipart/related message, and the image parts need Content-ID headers. This JavaMail FAQ entry will point you in the right direction.
Finally, you should never be calling the constructor for SMTPTransport directly. Instead, you should use the Session.getTransport method.

CSS3PIE border-radius does not compute :(

Hey all. I've done tons of searching and still nothing. My element has the following CSS and the PIE.htc file is definatly in the correct folder. Still no curvey corners in IE6-8 :(
#nav {
width:500px;
border:2px solid #eee;
-moz-border-radius: 10px;
border-radius: 10px;
behavior: url(/PIE.htc);
position:relative;
z-index: 0;
}
Check that your PIE.htc file is being served with the correct HTTP content-type header. It needs to be "text/x-component", but some servers do not have this set up correctly and send something like "text/plain" or "text/html" instead; IE will ignore the behavior file if this is the case.
More suggestions can be found at http://css3pie.com/documentation/known-issues/

Resources