RE: RE: Way to post form data without a form?

2001-10-09 Thread van Jaarsveld, Schalk

Susan,
I wrote a applet that uses a servlet and used the following method to pass
the form data to the applet. What the class does is takes the data passed to
it by using a property and url encodes it, it then appends the jsessionid if
it needs to and posts it to the servlet.

Hope it help.

Schalk van Jaarsveld SCJP, MCSD, MCP

Cellular: +27 (0) 82 296 8748
Phone:+27 (0) 11 763 5095 
Email:[EMAIL PROTECTED]
   


package intranet.comm;

import java.io.*;
import java.net.*;
import java.util.*;
import intranet.graphics.*;

public class IPAHttpRequest {
URL url = null;
//to manipulate graphical aspects of SwingSet2 we need a reference
there,
//this reference is also used to get values like the sessionid ect...
private SwingSet2 swingset2 = null; 

/**
 *This constructor saves a reference to the URL of the servlet to invoke
 */
public IPAHttpRequest(URL servletURL) {
System.out.println("servletURL = " + servletURL);
url = servletURL;
}

/** This method parses the Properties object that is passes in and sends
this data
 *to the servlet in its request. It returns the servlets response to the
applet.
 *
 *@param An InputStream that represents the servlets response;
 *@param props The name/value pairs that are stored in a Properites
object.
 */

public InputStream processPostRequest(Properties props) throws
IOException {
String paramString = "";
//parse the Properties object and encode the name/value
//pairs so they can be sent correctly to the servlet as POST
data.

if (props != null) { 
StringBuffer sb = new StringBuffer();
Enumeration members = props.propertyNames();

String propName = null;
String propValue = null;
System.out.println("Before the sessionid");
String sessionid = swingset2.getSessionid();
System.out.println("The sessionid is " + sessionid);

//if the sessionid is not null, meaning there is a valid
session we
//use url rewritting.
if (sessionid == null) {
while (members.hasMoreElements()) {
propName = (String) members.nextElement();
propValue = props.getProperty(propName);
sb.append(URLEncoder.encode(propName) + "=" +
URLEncoder.encode(propValue));
if (members.hasMoreElements()) {
sb.append("&");
}
}
}else {

while (members.hasMoreElements()) {
propName = (String) members.nextElement();
propValue = props.getProperty(propName);
sb.append(URLEncoder.encode(propName) + "=" +
URLEncoder.encode(propValue));
if (members.hasMoreElements()) {
sb.append("&");
}
}
sb.append("&jsessionid=" +
URLEncoder.encode(sessionid)); 
}

paramString = sb.toString();
System.out.println("paramString: " + paramString);
}
URLConnection con = url.openConnection();
   
con.setDoInput(true);
con.setDoOutput(true);

con.setUseCaches(false);

//Set the general request property
con.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");

//write the properties out as POST data

DataOutputStream out = new
DataOutputStream(con.getOutputStream());
System.out.println("out.writeBytes(paramString)");
out.writeBytes(paramString);

out.flush();
out.close();
//return the servlets response to the applet
return con.getInputStream();
}
public void setSwingSet2(SwingSet2 swingset2) {
this.swingset2 = swingset2;
}
}

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 09, 2001 9:04 PM
To: JRun-Talk
Subject: RE: RE: Way to post form data without a form?


You could always just do it the easy way and generate a page with just a
form and the form data filled in then put a javascript at the bottom of the
page that submits the form.  The user doesn't notice and it's simple.

Travis

 Original Message 
From: Mark Phelps <[EMAIL PROTECTED]>
Sent: 2001-10-09 11:16:07.0
To: JRun-Talk <[EMAIL PROTECTED]>
Subject: RE: Way to post form data without a form?

Try using the HttpURLConnection class in the java.net package.  Before
opening a connection you need to call the setRequestMethod() function and

RE: RE: Way to post form data without a form?

2001-10-09 Thread travis

You could always just do it the easy way and generate a page with just a form and the 
form data filled in then put a javascript at the bottom of the page that submits the 
form.  The user doesn't notice and it's simple.

Travis

 Original Message 
From: Mark Phelps <[EMAIL PROTECTED]>
Sent: 2001-10-09 11:16:07.0
To: JRun-Talk <[EMAIL PROTECTED]>
Subject: RE: Way to post form data without a form?

Try using the HttpURLConnection class in the java.net package.  Before
opening a connection you need to call the setRequestMethod() function and
set the method to POST.

-Original Message-
From: Susan M. Orndorff [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 08, 2001 12:32 PM
To: JRun-Talk
Subject: Way to post form data without a form?


I am using an applet to call a servlet named OrderPage which returns an html
page.  To do this I am using

URL newUrl = new
URL("https://hostname.com/store/OrderPage?Item=teaCustomer=Nancy";)
getAppletContext().showDocument(newUrl, "_self");

When I do this, the parameter string (?Item=teaCustomer=Nancy)  shows in the
address window.  I do not want these parameters to show.  I have been told
there is a way to post data like a form would, but without using a form,
that is, to do it automatically from within the program, without ANY user
interaction.   Does anyone know how this is done?   Thanks for any help...
Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=sts

~~
Get the mailserver that powers this list at http://www.coolfusion.com
Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Way to post form data without a form?

2001-10-09 Thread Mark Phelps

Try using the HttpURLConnection class in the java.net package.  Before
opening a connection you need to call the setRequestMethod() function and
set the method to POST.

-Original Message-
From: Susan M. Orndorff [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 08, 2001 12:32 PM
To: JRun-Talk
Subject: Way to post form data without a form?


I am using an applet to call a servlet named OrderPage which returns an html
page.  To do this I am using

URL newUrl = new
URL("https://hostname.com/store/OrderPage?Item=teaCustomer=Nancy";)
getAppletContext().showDocument(newUrl, "_self");

When I do this, the parameter string (?Item=teaCustomer=Nancy)  shows in the
address window.  I do not want these parameters to show.  I have been told
there is a way to post data like a form would, but without using a form,
that is, to do it automatically from within the program, without ANY user
interaction.   Does anyone know how this is done?   Thanks for any help...
Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=sts
~~
Get the mailserver that powers this list at http://www.coolfusion.com
Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: User groups

2001-10-09 Thread Christophe Coenraets

The LA CFUG web site is http://www.sccfug.org  

Also, Macromedia will be presenting JRun to the San Diego JUG on November
20.

6-8pm 
The Quality Resort in Mission Valley
875 Hotel Circle South
San Diego CA 92108
http://jug.polexis.com


Christophe

-Original Message-
From: Matthew L. Wright [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 09, 2001 12:55 PM
To: JRun-Talk
Subject: User groups


Does anyone know of any JRun or even CF / Spectra user groups in the LA area
or otherwise?

Thanks in advance.

Matt

~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



User groups

2001-10-09 Thread Matthew L. Wright

Does anyone know of any JRun or even CF / Spectra user groups in the LA area
or otherwise?

Thanks in advance.

Matt
~~
Get the mailserver that powers this list at http://www.coolfusion.com
Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Way to post form data without a form?

2001-10-09 Thread Mullee John - ZGI

> I do not want these parameters to show.

http://www.google.com/search?q=showDocument+POST&btnG=Google+Search

.

Java Tip 34: POSTing via Java
http://www.javaworld.com/javaworld/javatips/jw-javatip34.html/

Java Tip 41: POSTing via Java revisited
http://www.javaworld.com/javaworld/javatips/jw-javatip41.html.

So, just how do we display the results of a POST from an applet? Well,
there are four answers to that question. In order of increasing pain, these
are:
We can't.
Don't post.
Use a bean.
Cheat:

1.The applet POSTs information to the server just as before.
2.The server uses the POST information to generate HTML.
3.The server saves the HTML to a file on the Web server.
4.The server returns a magical key to the applet.
5.The applet encodes the key into a URL back to the server.
6.The applet instructs the browser to display a Web page by using the
generated URL in a showDocument() call.
7.The server accepts the GET request and extracts the magic key parameter.
8.The server retrieves the file associated with the magic key.
9.The server returns the HTML contents from the file to the browser.
10.The browser displays the HTML contents.


(tip 34 code)
/*

Copyright (c) Non, Inc. 1997 -- All Rights Reserved

PROJECT:JavaWorld
MODULE: Web Stuff
FILE:   Happy.java

AUTHOR: John D. Mitchell, Jul  8, 1997

REVISION HISTORY:
NameDateDescription
---
JDM 97.07.08Initial version.

DESCRIPTION:

This file shows how to POST to a web-server and get back the raw
response data.

*/


import java.awt.*;
import java.applet.*;
import java.io.*;
import java.util.*;
import java.net.*;


public class Happy extends Applet
{
private TextArea textArea = new TextArea (25, 70);

public void init ()
{
try
{
URL url;
URLConnection   urlConn;
DataOutputStreamprintout;
DataInputStream input;

// URL of CGI-Bin script.
url = new URL (getCodeBase().toString() + "env.cgi");

// URL connection channel.
urlConn = url.openConnection();

// Let the run-time system (RTS) know that we want input.
urlConn.setDoInput (true);

// Let the RTS know that we want to do output.
urlConn.setDoOutput (true);

// No caching, we want the real thing.
urlConn.setUseCaches (false);

// Specify the content type.
urlConn.setRequestProperty
("Content-Type", "application/x-www-form-urlencoded");

// Send POST output.
printout = new DataOutputStream (urlConn.getOutputStream ());

String content =
"name=" + URLEncoder.encode ("Buford Early") +
"&email=" + URLEncoder.encode ("[EMAIL PROTECTED]");

printout.writeBytes (content);
printout.flush ();
printout.close ();

// Get response data.
input = new DataInputStream (urlConn.getInputStream ());

String str;
while (null != ((str = input.readLine(
{
System.out.println (str);
textArea.appendText (str + "\n");
}

input.close ();

// Display response.
add ("Center", textArea);
}
catch (MalformedURLException me)
{
System.err.println("MalformedURLException: " + me);
}
catch (IOException ioe)
{
System.err.println("IOException: " + ioe.getMessage());
}
}   // End of method init().
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: JRun does not responds after 100 threads

2001-10-09 Thread Mullee John - ZGI

BTW have you tried turning off keep-alives?

~~
Get the mailserver that powers this list at http://www.coolfusion.com
Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: SV: JRun does not responds after 100 threads

2001-10-09 Thread Ben Groeneveld

Roar, unless you make special provisions each servlet request would be 
another thread.  Could it be that your threads (requests) are not 
exiting but blocking on some resource?  Can you throttle demand for that 
resource by including a synchronized method wrapped around that 
resource?  Just a thought.  BenG.

Johansen, Roar wrote:

>Ben Groeneveld wrote:
>
>>Makarand, are you hitting JRun thru the Netscape Webserver?  Then your 
>>problem may be with its max concurrency setting.  I have seen this with 
>>IIS as the front-end to JRun.  How many concurrent connections will your 
>>Netscape Webserver accept?  Make sure you are updating the external web 
>>server settings and not the JRun web server.  Hope that helps, BenG.
>>
>
>-
>
>Does anybody have any thoughts as to why the number of threads even rises to
>100? We are running a site that serves over 1200 pages a minute in peak
>hour, distributed among 6 unix servers. This means that any one server
>continuously serves 3-4 pages a second and does so with a minimum effort. In
>fact, any server rarely has more than 20-30 threads active at any time (we
>measure this by 'netstat -n | grep ESTABLISHED | grep number>'). However, from time to time this figure rises dramatically during
>a few seconds, often ending at the 100 threads, where it eventually locks
>up. My feeling is, you can bump the limits in JRun, NS and unix, but when
>this rise occurs, it will eventually eat up any resources you feed it. I
>personally am very interested in finding a reason for this sudden rise.
>
>
~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: JRun does not responds after 100 threads

2001-10-09 Thread Mullee John - ZGI

> From: Johansen, Roar
> I personally am very interested in finding a reason for this 
> sudden rise.

I suspect that web indexing robots are responsible.
Google, altavista, lycos, etc etc
Lookup documentation on 'robots.txt'

Also, MSIE clients can flag a bookmark for 'offline' viewing,
meaning that the pages (typically to a link-depth of 2..4) are
dowloaded to dedicated local cache.

Another side-effect of this 'offline' process is that MSIE
will typically 'check for updates', which is to say, it
will bombard your site with 'HEAD' requests (i think) or
otherwise find some way of checking if the cached pages
are up-to-date.

As far as I know MSIE respects the suggestions from robots.txt

HTH

~~
Get the mailserver that powers this list at http://www.coolfusion.com
Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists