Calling setText or setContent multiple times on BodyPart clears headers
Are you supposed to be able to re-use a MimeMessage, changing the body parts and sending it multiple times?
When I try the following, the content-type and content-transfer-encoding headers are stripped from the html body part:
MimeMessage msg = new MimeMessage(Session.getDefaultInstance(System.getProperties()));
msg.setFrom(new InternetAddress("[email protected]"));
msg.setSubject("TEST");
msg.setRecipient(Message.RecipientType.TO, new InternetAddress("[email protected]"));
final MimeMultipart multipart = new MimeMultipart();
final MimeBodyPart htmlPart = new MimeBodyPart();
htmlPart.setText("<html><body>This is an html part</body></html>", null, "html");
multipart.addBodyPart(htmlPart);
msg.setContent(multipart);
Transport.send(msg);
// now call setText on the html part and send the message again
htmlPart.setText("<html><body>This is another html part, overwriting the first</body></html>", null, "html");
Transport.send(msg);I end up with a message that looks like this:
Content-Type: multipart/mixed;
boundary="----=_Part_0_10496062.1211756263858"
Date: Sun, 25 May 2008 18:59:42 -0400
------=_Part_0_10496062.1211756263858
X-TESTHEADER: test
<html><body>This is another html part, overwriting the first</body></html>
------=_Part_0_10496062.1211756263858--Which renders as plain-text in my browser. I know I can re-create the entire MimeMessage and body parts, but my real-world example is significantly more complicated. Another way to get it to work is to explicitly set the content-type and content-transfer-encoding headers on the HTML part after changing the content. I'm not sure what to set the content-transfer-encoding to, however (I'd like this to work for multiple encodings)
Call msg.saveChanges() before Transport.send(msg).
Similar Messages
-
Call the owning VI multiple times
Hi all,
I'm trying to call the owning VI multiple times and wasn't sure if it's possible.I trying to call the same VI within a VI with different condition.
I have this VI as a template with reentrant enabled (VI_1), and inside the loop, it will call another instance of this template (call it VI_2) and wait until called VI (VI_2) completes and proceed to next action. The problem is wait until done doesn't wait although I set it to True. Can someone tell me what I'm doing wrong? or even this is possible.
Thank you in advance.
Solved!
Go to Solution.
Attachments:
VIT_Reentrant.png 18 KBSo the VI is calling itself?
If so you can drop the VI onto it's own diagram if it's set to reentrant in LabVIEW version 2009 and later.
Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas
LabVIEW, programming like it should be! -
Whenever I receive a call, I push "answer" and it just stays there. It stops ringing, but doesn't complete the answering process. I push again, and it may or may not connect. Usually a third time and it will connect. Same when I hang up. I usually just have to wait for the other person to disconnect.
That's the Voice Over Feature.
Tap the Settings icon once to select it and then Double Tap on the Settings icon to activate it.
Use 3 fingers to scroll down to General, tap it once again to select it, and then twice to activate it.
Again use 3 fingers to scroll down to Accessibility, again tap once to select, then twice to activate.
Tap on Voice Over once to select it, and twice to actvate it and then tap once on Voice Over, and then tap twice to turn it off. -
Introspector calling the Base Class multiple times
Hi
I am having a Java Bean C (which extends B which in turn extends A) ...and each of these Classes have the BeanInfo classes .. ABeanInfo , BBeanInfo , CBeanInfo....
And i had written my beaninfos such a way that they are optimised by extending the basebeaninfo and calling super.getPropertyDescriptors and adding them to the Descriptoirs of extra methods like
Class A
private String name;
public void getName()
Class B extends A
private String city ;
public void getCity
class ABeanInfo extends SimpleBeanInfo
public PropertyDescriptors[] getPropertyDescriptors()
// Got the property descriptor for name
// return by forming array
My Class B bean info will look like this
class BBeanInfo extends ABeanInfo
public PropertyDescriptors[] getPropertyDescriptors()
PropertyDescriptors[] baseDesc = super.getPropertyDescriptors();
// Get the property descriptor for City
// Club the base class desc and the new ones added
// return by forming array
But when i use Introspector.getBeanInfo(B.class) , the A.getPropertyDescriptors method is getting called twice (One internally by the introspector and the other when my super.get...)
How can this be avoided ?? Ofcourse after the first time , the introspector is caching the instances of BeanInfos...
If this is the implicit behaviour , can i change my BeanInfo classses in such a way that it won't get calledWhy is this a problem?
-
Call Same Web Service Multiple Times
Hello All,
Just wondering if there are any issues calling the same web service more than once within a single form?
Basically what I'm trying to do is use an LDAP web service that returns a user name at different status levels. (i.e. user1 who starts the form process, and then again at user2 who is reviewing the form - pre-populating their names)
Since the web service is already bound to the first set of fields at level 1, I created a new data connection to the same web service to run at the next level. Problem is, I'm not getting any errors OR any results.
Do I need to just re-create the web service with another name?
Thanks.Multiple calls work fine for me.
Just create a new data connection and that's it. -
Calling a servlets multiple times from a servlet
Hi All,
Advanced Thanks,
I have a servlet which calls another servlet to display some records. Second servlet will access some data from XML files and forwards to a JSP file. What i want is I need to call the second servlet multiple times from the the first servlet. I used RequestDispatcher to call the servlet but I can call only one time after a an exceptions is occurred like cannot forward after response is committed.
I need this scenario in the saem way because each time second servlet is called I am forwarding response to user each time records are accessed based on the request value.
request.getRequestDispatcher("sample").forward(request, response);
Any one please give me a suggestion?
Thanks in advanceWhat are those servlets supposed to do? Sounds like that they are doing too much, e.g. acting like business classes or utility classes or so. Refactor your code.
-
ADOBE FORM-static-called multiple times - data on different pages
Hi Experts,
I am calling an adobe form multiple times for each employee inside a loop.
The layout is less than half the page.
For each employee inside the loop when calling the ADOBE form it is triggering a new page.
I want to continue the printing in the same page.
Is this possible? Please advice.That is bc ADF life cicle... Is always executing 2 times...
-
Getter is called multiple times
Hi All,
I my JSF page i am using one foreach which will read elements from an ArrayList. ArrayList is present in one PagesFlowSope-Bean.
I am facing problem that, the getter for ArrayList is called multiple times.I want to restrict that,is there any way for doing this.
Thanks in advance,Your getter gets called every time the component/page gets rendered/refreshed. If you feel that it refreshes too many times, check the partial triggers on that component or its parent. Just a thought, to avoid any logic getting called in your getter multiple times, if possible, put a empty or null check on your attribute and initialize it only if it is null/empty. In that way even if it gets called multiple times your logic to populate your ArrayList doesn't fire everytime.
Good luck ! -
Jnlp file called multiple times
We're trying to pass HTTP parameters to our JNLP file (which is created by a .jsp file). When we run webstart from the command line (or a a web page), it seems like the JNLP file gets called multiple times. The first time our parameters are there, after that they are not. Why does webstart call the JNLP file multiple times? Has anyone else seen this.
We're running Tomcat 4.x on Linux.
From the command line we typed:
javaws "http://localhost/helloWorld.jsp?hello=1&world=2"
Tomcat Output:
DEBUG: hello=1&world=2
DEBUG: null
DEBUG: null
DEBUG: null
DEBUG: null
DEBUG: null
DEBUG: null
DEBUG: null
JSP File:
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page contentType="application/x-java-jnlp-file" %>
<?xml version="1.0" encoding="utf-8"?>
<jnlp
spec="1.0+"
codebase="http://localhost"
href="http://localhost/helloWorld.jsp">
<information>
<title>Hello World</title>
<vendor>Nobody</vendor>
<application-desc>Hello World Application</application-desc>
</information>
<resources>
<j2se version="1.3+"/>
<jar href="lib/helloWorld.jar" main="true"/>
</resources>
<application-desc main-class="test.HelloWorldApp"/>
</jnlp>
<% System.out.println("DEBUG: " + request.getQueryString()); %>
Hello World Source:
package test;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class HelloWorldApp {
public static void main(String[] args) {
JFrame frame = new JFrame("Hello World");
frame.getContentPane().add(new JLabel("Hello World", JLabel.CENTER), BorderLayout.CENTER);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
frame.setSize(200,150);
frame.setVisible(true);
}I am seeing this exact same problem, also creating the JNLP via a JSP. Any input would be greatly appreciated.
-
JPA Lifecycle events file multiple times
I am using EclipseLink and the JPA lifecycle events like @PrePersist and @PostLoad. These events are being called multiple times during a persist cycle. When I looked at the code multiple EclipseLink events are mapped to each of the JPA events. There are also being called by 2 different functions.
I have had to create local variables to detect multiple calls and not process multiple times. Is this going to change in future?Can you open a bug against EclipseLink and provide the information you have found.
Enter Bug link.
Doug -
Calling stored procedure multiple times in the JDBC receiver
Hi,
I am calling the stored procedure(SP) to update a DB table in the JDBC receiver.
SP has 10 input parameters, and SP can receive one value for each parameter at a time.
In my case, i will have multiple rows to insert using SP.i.e multiple values for each parameter.
Its working correctly for a single value for each parameter, but when i have multiple values i want to call the SP multiples times.
Is this possible and how?
Thanks,
Varghese.Varghese,
I think you can have multiple statements in the JDBC Adapter's XML, as in http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm.
Here the StatementName1 node can be inserted into your JDBC XML as often as you want.
Kind regards,
Koen -
Finalize() method being called multiple times for same object?
I got a dilly of a pickle here.
Looks like according to the Tomcat output log file that the finalize method of class User is being called MANY more times than is being constructed.
Here is the User class:
package com.db.multi;
import java.io.*;
import com.db.ui.*;
import java.util.*;
* @author DBriscoe
public class User implements Serializable {
private String userName = null;
private int score = 0;
private SocketImage img = null;
private boolean gflag = false;
private Calendar timeStamp = Calendar.getInstance();
private static int counter = 0;
/** Creates a new instance of User */
public User() { counter++;
public User(String userName) {
this.userName = userName;
counter++;
public void setGflag(boolean gflag) {
this.gflag = gflag;
public boolean getGflag() {
return gflag;
public void setScore(int score) {
this.score = score;
public int getScore() {
return score;
public void setUserName(String userName) {
this.userName = userName;
public String getUserName() {
return userName;
public void setImage(SocketImage img) {
this.img = img;
public SocketImage getImage() {
return img;
public void setTimeStamp(Calendar c) {
this.timeStamp = c;
public Calendar getTimeStamp() {
return this.timeStamp;
public boolean equals(Object obj) {
try {
if (obj instanceof User) {
User comp = (User)obj;
return comp.getUserName().equals(userName);
} else {
return false;
} catch (NullPointerException npe) {
return false;
public void finalize() {
if (userName != null && !userName.startsWith("OUTOFDATE"))
System.out.println("User " + userName + " destroyed. " + counter);
}As you can see...
Every time a User object is created, a static counter variable is incremented and then when an object is destroyed it appends the current value of that static member to the Tomcat log file (via System.out.println being executed on server side).
Below is the log file from an example run in my webapp.
Dustin
User Queue Empty, Adding User: com.db.multi.User@1a5af9f
User Dustin destroyed. 0
User Dustin destroyed. 0
User Dustin destroyed. 0
User Dustin destroyed. 0
User Dustin destroyed. 0
USER QUEUE: false
INSIDE METHOD: false
AFTER METHOD: false
User Dustin destroyed. 1
User Dustin destroyed. 1
User Dustin destroyed. 1
User Dustin destroyed. 1
USER QUEUE: false
INSIDE METHOD: false
AFTER METHOD: false
User Dustin destroyed. 2
User Dustin destroyed. 2
User Dustin destroyed. 2
User Dustin destroyed. 2
User Dustin destroyed. 2
User Dustin destroyed. 2
User Dustin destroyed. 2
User Dustin destroyed. 2
USER QUEUE: false
INSIDE METHOD: false
AFTER METHOD: false
User Dustin destroyed. 3
User Dustin destroyed. 3
User Dustin destroyed. 3
User Dustin destroyed. 3
User Dustin destroyed. 3
User Dustin destroyed. 3
User Dustin destroyed. 3
User Dustin destroyed. 3
User Dustin destroyed. 3
USER QUEUE: false
INSIDE METHOD: false
AFTER METHOD: false
User Dustin destroyed. 4
User Dustin destroyed. 4
User Dustin destroyed. 4
User Dustin destroyed. 4
User Dustin destroyed. 4
User Dustin destroyed. 4
User Dustin destroyed. 4
User Dustin destroyed. 4
User Dustin destroyed. 4
USER QUEUE: false
INSIDE METHOD: false
AFTER METHOD: false
User Dustin destroyed. 5
User Dustin destroyed. 5
User Dustin destroyed. 5
User Dustin destroyed. 5
User Dustin destroyed. 5
User Dustin destroyed. 5
User Dustin destroyed. 5
User Dustin destroyed. 5
User Dustin destroyed. 5
USER QUEUE: false
INSIDE METHOD: false
AFTER METHOD: false
User Dustin destroyed. 6
User Dustin destroyed. 6
User Dustin destroyed. 6
User Dustin destroyed. 6
User Dustin destroyed. 6
User Dustin destroyed. 6
User Dustin destroyed. 6
User Dustin destroyed. 6
User Dustin destroyed. 6
User Dustin destroyed. 6
Joe
USER QUEUE: false
INSIDE METHOD: false
AFTER METHOD: false
User Dustin pulled from Queue, Game created: Joe
User Already Placed: Dustin with Joe
User Dustin destroyed. 7
User Dustin destroyed. 7
User Dustin destroyed. 7
User Dustin destroyed. 7
User Dustin destroyed. 7
User Dustin destroyed. 7
User Dustin destroyed. 7
User Dustin destroyed. 7
User Dustin destroyed. 7
User Dustin destroyed. 7
INSIDE METHOD: false
INSIDE METHOD: false
USER QUEUE: true
INSIDE METHOD: false
INSIDE METHOD: false
User Dustin destroyed. 9
User Joe destroyed. 9
User Dustin destroyed. 9
User Dustin destroyed. 9
User Dustin destroyed. 9
User Dustin destroyed. 9
INSIDE METHOD: true
INSIDE METHOD: false
USER QUEUE: true
INSIDE METHOD: false
INSIDE METHOD: false
INSIDE METHOD: true
INSIDE METHOD: false
USER QUEUE: true
INSIDE METHOD: false
INSIDE METHOD: false
It really does seem to me like finalize is being called multiple times for the same object.
That number should incremement for every instantiated User, and finalize can only be called once for each User object.
I thought this was impossible?
Any help is appreciated!Thanks...
I am already thinking of ideas to limit the number of threads.
Unfortunately there are two threads of execution in the servlet handler, one handles requests and the other parses the collection of User objects to check for out of date timestamps, and then eliminates them if they are out of date.
The collection parsing thread is currently a javax.swing.Timer thread (Bad design I know...) so I believe that I can routinely check for timestamps in another way and fix that problem.
Just found out too that Tomcat was throwing me a ConcurrentModificationException as well, which may help explain the slew of mysterious behavior from my servlet!
The Timer thread has to go. I got to think of a better way to routinely weed out User objects from the collection.
Or perhaps, maybe I can attempt to make it thread safe???
Eg. make my User collection volatile?
Any opinions on the best approach are well appreciated. -
Function used in view definition is called multiple times
I am trying to write a view that boils down to the following statement:
SELECT val, val FROM (
SELECT SYS_GUID() val
FROM dual
Against my expectation, this calls SYS_GUID() twice, resulting in two different values for val.
I've written it here as inline view, but it must be a regular view in reality. Is there any way to construct this view so that SYS_GUID is called only once, even if the resulting value is then selected multiple times? Naively, I'd like to assign the result of SYS_GUID to a variable and then select the value of this variable. However, this does not seem possible in a view.
New to Oracle PL/SQL. This works as expected in SQL Server T-SQL.
Thanks for any help or insight you can provide.
-- Brianbrianberns wrote:
WHERE ROWNUM = 1 fixed the problem, although I have no idea why. Thank you!It's an unofficial way of preventing view merging.
The inline view in your original code is being eliminated and the query transformed to:
SELECT SYS_GUID(),SYS_GUID()
FROM dualIn some circumstances the optimiser couldn't do that if the inline view contains a predicate on the ROWNUM pseudocolumn so the transformation is disabled.
However the official way of doing this is with the NO_MERGE hint so I would definitely use NO_MERGE if it works (which it seems to), in case the optimiser gets smarter and disables the ROWNUM workaround in a future release. -
Generic Data Source is calling multiple times in RSA3
[color:red}<Moderator Message: This topic has alread been discussed a lot of times. Additionally there are weblogs related to it. Please search the forums and/or the blogs for this issue>
Hi experts,
I have the requirement to get data from Generic Data Sources with function Module,
after finishing the FM I have checked in extact checker(RSA)
in the internal table I_T_DATA is displays 281 records,
but in RSA3 it shows 112560 records, I found that the FM is calling multiple time by executing one time in RSA3.
1.what would be the problem
2.where is the porblem is it in FM coding or any other places to check.
<removed by moderator>
Regards
Vijay
Edited by: Siegfried Szameitat on Feb 3, 2009 11:45 AMHi Savita,
I don't understand clearly from your reply regarding flow you transported and what all you transported.
You need to first transport objects in R/3 and import them.
Then transport Infoprovider, Datasource in BI assuming depenedent Infoare Infoobject, application component already transported.
Then transport your Infosource, Update rule, Transfer rules, Infopackage.
Hope you understood.
Ravi -
In the middle of an update, it call closed. Itunes keeps saying that it's not installed, even though ive tried reinstalling multiple times. All my iphone is doing it showing the ituns symbol and a charger. How can I fix this???
Hi lepyykko,
If I understand your question, you are trying to update your iPhone, but you are seeing an error message that iTunes for Windows is not installed, is that right? The first step is to get iTunes successfully installed on your computer. Then backup the iPhone before updating the iOS software.
Are you seeing any error messages when you try to install iTunes for Windows?
If you can't install or update iTunes for Windows - Apple Support
https://support.apple.com/en-us/HT201668
Are you able to update your iPhone wirelessly?
Update the iOS software on your iPhone, iPad, and iPod touch - Apple Support
https://support.apple.com/en-us/HT204204
Before you update
Back up your device to iCloud.
Update your device wirelessly
The easiest way to update your device is wirelessly, also called “over the air.” Here’s how:
Plug in your device to a power source.
Tap Settings > General > Software Update.
Tap Download and Install. Updates might download automatically while your device is connected to Wi-Fi and a power source.
Tap Install, or tap Later to install the update later. If you use a passcode, you'll need to enter it before installing the update.
If you can't update or restore your iPhone, iPad, or iPod touch - Apple Support
https://support.apple.com/en-us/HT201263
I hope this information helps ....
- Judy
Maybe you are looking for
-
ok, I used the search function and had a hard time understanding how to do things and I don't think any of the posts answered my question. Right now, I am working on an assignment that makes me figure out the quadratic formula. I am having trouble wi
-
How do I use an iSight iMac to send video messages?
I love the computer, but Knowledge base says the built in iSight won't work with iMovie HD to capture video. Is there another way I can make and send video emails or messages that can be emailed using an iSight iMac?
-
MSI X48C Platinum and DDR3 corsair 2x4 GB @ 1600mhz WILL IT WORK??
Hi , I truly appreciate the mere existence of this forum . my system is : PSU : Corsair 650HX CPU : Intel Core2Duo E6750 GPU : Geforce GTX 260 RAM : (currently 2x1gig DDR2 @ 667 Mhz) and i just bought 2x4gb dims of DDR3 ram (corsair vengeance) it doe
-
Is it possible to import a music library from one computer to anouter with out a flash drive or eny other forms of music storage?
-
Open & executin a c prg in server & tranfer output to client
Please tell me how to execute a C program inside a Java program. That is, inside a server program in Java, and transfer the output of that program to the client and display it there... if you can with sample program Tel me...