Re: question about object pool

2001-09-28 Thread Boris Erukhimov

Looks like what you really need is to make these methods static and not
bother with object instance at all.

Jirka Vorac wrote:
> 
> Hi,
> 
> this question is not about Orion. I hope you'll answer it.
> 
> I don't know when to use object pool.
> 
> Following scenario is what I need, but I'll be hapy
> to hear more about pooling.
> I only know one reason for pooling. It is decreasing
> time of creation.
> 
> I have class providing some methods. Methods do not change
> class variables, they only read them and use parameter values.
> So I think, if I have only one obejct of this class instantiated,
> I can call this methods from various Threads without synchronization
> and it should work properly. Is it true or do I need this objects to
> be pooled?
> 
> Thank you
> 
> Jirka




Re: Test Post to Servlet Doesn't Work.

2001-07-05 Thread Boris Erukhimov

OK, I still doubt some of your code lines.

1. When you do 
out.println( "cmd=" + URLEncoder.encode( xml ) );
it is not getting exactly URL-encoded becaouse of the newline symbol
added by "println".

2. Your client sends HTTP request but there is no line in code to get
InputStream back.
That's obviously not a correct way to deal with HTTP socket and it's on
web server's (orion's here) developer mercy how to react. For instance
if there is no input socket open in certain time interval they can
simply ignore your POST request

Milton S wrote:
> 
> Thank you for your suggestion.
> 
> I just tried it but it doesn't perform a connection either. The only difference
> between what Hunter is doing in his code and mine is he is using a
> DataOutputStream and I am using a PrintWriter which shouldn't make any
> difference. He is also using the URLEncoder.encode method for both the name and
> value. All the URLEncoder.encode method does is scan the string for reserved and
> unsafe characters and replaces them with their URL encodings. This is equivalent
> to my line:
> out.println( "cmd=" + URLEncoder.encode( xml ) );
> I don't bother to encode "cmd because it doesn't have any reserved or unsafe
> characters in it. It is producing the same string value as Hunter's
> "toEncodedString()" method.
> 
> I am beginning to think I don't have Orion configured properly or my application
> deployed properly because all the code examples I see all have the same structure
> and others seem to be able to make them work.
> 
> Thank you for taking the time to look at my problem.
> 
> Milton S.
> 
> Boris Erukhimov wrote:
> 
> > It looks like you are not properly supplying arguments for "POST" method
> > The right order based on Jason Hunter book example is below:
> > To use it in your case just put your xml string into Properties object
> > as a value against "cmd" as a name
> >
> >  public static final InputStream sendPostMessage(Properties args, URL
> > destination)
> > throws IOException
> >   {
> > String argString = "";
> > if (args != null)
> > {
> > argString = toEncodedString(args);
> > }
> >
> > URLConnection con = destination.openConnection();
> >
> > // Prepare for both input and output
> > con.setDoInput(true);
> > con.setDoOutput(true);
> >
> > // Turn off caching
> > con.setUseCaches(false);
> >
> > // Work around a Netscape bug
> > con.setRequestProperty("Content-Type",
> > "application/x-www-form-urlencoded");
> >
> > // Write the arguments as post data
> > DataOutputStream out = new DataOutputStream(con.getOutputStream());
> >
> > out.writeBytes(argString);
> > out.flush();
> > out.close();
> >
> > return (con.getInputStream());
> >   }
> > /sendPostMessage
> >
> >  private static final String toEncodedString(Properties args)
> >   {
> > StringBuffer buf = new StringBuffer();
> > Enumeration names = args.propertyNames();
> > while (names.hasMoreElements())
> > {
> > String name = (String) names.nextElement();
> > String value = args.getProperty(name);
> > buf.append(URLEncoder.encode(name) + "=" + URLEncoder.encode(value));
> > if (names.hasMoreElements())
> > buf.append("&");
> > }
> > return buf.toString();
> >   }
> > toEncodedString
> >
> > Hope it helps
> > ~boris
> >
> > Milton S wrote:
> > >
> > > Orion Interest Group,
> > >
> > > I have written a Java class to test server to server communication for a
> > > servlet running on Orion 1.5.2. Nothing seems to happen when I run the
> > > class while the same URL sent from the address/location edit box on a
> > > browser works perfectly. The host URL I am using is
> > > "http://ducati:8080/petroweb/report"; where ducati is the name of my
> > > notebook, petroweb is the application name, and report is the servlet I
> > > am trying to access. Following is the code I am using to make the
> > > "POST". What should I look for to make this work?
> > >
> > > I have "System.out.println's" in my servlet code to notify the open
> > > command prompt, in w

Re: Data source for Sybase with Jconnect 5.2

2001-07-05 Thread Boris Erukhimov

Thanks Ray, Juan, Michael I've got it working.

The trick to use rught core class for pooled connection
which, thanks to you guys, happen to be
com.evermind.sql.ConnectionDataSource

Thanks again
~boris

Ray Harrison wrote:
> 
> Boris -
> Here is an example of a Sybase datasource - we use only the ejb-location but you may
> be able to find others who use the pooled-location by searching through the mailing 
>list.
> 
> Cheers
> Ray
> 
>name="MyDataSource"
>class="com.evermind.sql.ConnectionDataSource"
>location="jdbc/DefaultDS"
>pooled-location="jdbc/DefaultPooledDS"
>xa-location="jdbc/xa/DefaultXADS"
>ejb-location="jdbc/DefaultEJBDS"
>url="jdbc:sybase:Tds:hostname:8000/mydbname"
>connection-driver="com.sybase.jdbc2.jdbc.SybDriver"
>username="user"
>password="pwd"
>schema="database-schemas/sybase.xml"
>max-connections="4"
>inactivity-timeout="3600">
> 
> 
> --- Boris Erukhimov <[EMAIL PROTECTED]> wrote:
> > I'm trying to ask it second time.
> >
> > Does anyone use Jconnect 5.2 ?
> > If so could you please share your data-source.xml and access code.
> > I'm particularly interested to see how "pooled-location" works, not
> > "ejb-location".
> >
> > Thanks
> > ~boris
> >
> 
> __
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/




Re: Test Post to Servlet Doesn't Work.

2001-07-05 Thread Boris Erukhimov

It looks like you are not properly supplying arguments for "POST" method
The right order based on Jason Hunter book example is below:
To use it in your case just put your xml string into Properties object
as a value against "cmd" as a name

 public static final InputStream sendPostMessage(Properties args, URL
destination) 
throws IOException
  {
String argString = ""; 
if (args != null) 
{  
argString = toEncodedString(args);  
}

URLConnection con = destination.openConnection();

// Prepare for both input and output
con.setDoInput(true);
con.setDoOutput(true);

// Turn off caching
con.setUseCaches(false);

// Work around a Netscape bug
con.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");

// Write the arguments as post data
DataOutputStream out = new DataOutputStream(con.getOutputStream());

out.writeBytes(argString);
out.flush();
out.close();

return (con.getInputStream());
  }
/sendPostMessage


 private static final String toEncodedString(Properties args)
  {
StringBuffer buf = new StringBuffer();
Enumeration names = args.propertyNames();
while (names.hasMoreElements()) 
{
String name = (String) names.nextElement();
String value = args.getProperty(name);
buf.append(URLEncoder.encode(name) + "=" + URLEncoder.encode(value));
if (names.hasMoreElements()) 
buf.append("&");
}
return buf.toString();
  }
toEncodedString

Hope it helps
~boris

Milton S wrote:
> 
> Orion Interest Group,
> 
> I have written a Java class to test server to server communication for a
> servlet running on Orion 1.5.2. Nothing seems to happen when I run the
> class while the same URL sent from the address/location edit box on a
> browser works perfectly. The host URL I am using is
> "http://ducati:8080/petroweb/report"; where ducati is the name of my
> notebook, petroweb is the application name, and report is the servlet I
> am trying to access. Following is the code I am using to make the
> "POST". What should I look for to make this work?
> 
> I have "System.out.println's" in my servlet code to notify the open
> command prompt, in which Orion is running, of any requests received. I
> also have, in my servlet, all "GET" requests resolving to the "doPost"
> method.
> 
> My environment is Intel P850, MS Windows 2000 Professional. Sun jdks,
> Orion 1.5.2 (stable binaries).
> 
> Thank you for your help.
> 
> import java.io.*;
> import java.net.*;
> import java.util.*;
> 
> public class PostTest {
> 
>   public static void main( String args[] ){
> String xml = "" +
>  "" +
>  "SubmitJob" +
>  "aPwd" +
>  "TheProject" +
>  "pType" +
>  "stuff" +
>  "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15," +
>  "16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31," +
>  "32,33,34,35,36" +
>  "";
> 
> try{
>   URL url = new URL( "http://ducati:8080/petroweb/report?"; );
>   HttpURLConnection conn = (HttpURLConnection)url.openConnection();
> 
>   conn.setDoOutput( true );
>   conn.setRequestMethod( "POST" );
>   PrintWriter out = new PrintWriter(conn.getOutputStream() );
> 
>   out.println( "cmd=" + URLEncoder.encode( xml ) );
>   conn.connect();
>   out.flush();
>   out.close();
> }
> catch( MalformedURLException err ){
>   System.out.println( "MalformedURLException = " + err.getMessage()
> );
> }
> catch( IOException err ){
>   System.out.println( "IOException = " + err.getMessage() );
> }
>   }
> }




Data source for Sybase with Jconnect 5.2

2001-07-04 Thread Boris Erukhimov

I'm trying to ask it second time.

Does anyone use Jconnect 5.2 ?
If so could you please share your data-source.xml and access code.
I'm particularly interested to see how "pooled-location" works, not
"ejb-location".

Thanks
~boris




How to get Connection Pool working ?

2001-07-02 Thread Boris Erukhimov

Here is a second post, the first one never appeared

I'm trying to use Pooled Connection for web application.
The application does not use EJB.

Here is my a part of data-source.xml



Here is the code:

public class DbUtils
{
 private static ConnectionPoolDataSource cpds = null;
///

 static
  {
   String dbsource = "jdbc/MyPooledDS";

   try
   {
   Context ctx = new InitialContext();
   cpds = (ConnectionPoolDataSource)ctx.lookup(dbsource);

   }
   catch(Exception namExc)
{
cpds = null;
ShConst.log("Failed to get datasource", namExc);
}
  }
///
 public static java.sql.Connection getConnection() throws SQLException
 {
   return cpds.getPooledConnection().getConnection();
 }
/
}//class

Here is the exception I'm getting
java.lang.ExceptionInInitializerError: java.lang.ClassCastException:
com.evermind.sql.OrionPooledDataSource
at ExpA.DbUtils.(./ExpA/DbUtils.java:26)


which is related to the line :

cpds = (ConnectionPoolDataSource)ctx.lookup(dbsource)


What's wrong ?
I suspect a few things, but I'd really appreciate ssomebody's input
before start hacking.
Thanks
~boris




Re: Virtual Hosts - Newbie question

2001-06-08 Thread Boris Erukhimov

You need to set up your own little DNS.
I assume you're on NT otherwise as a UNIX user you'd sure knew how to do
it.
If so 

1. Open a file  \WINNT\system32\drivers\etc\Hosts
2. Below the line 
127.0.0.1   localhost

   Add a line
127.0.0.1   www.example1.com

3. Reboot

That should do it
~be

That should do it
G T wrote:
> 
> I'm not able to ping either of the 2. How do I make it point to it.
> I am able to ping local host. And I am able to run all the applications part
> of the default-web-app. Is there any thing else that needs to be done to
> point www.example1.com to my box
> 
> - Original Message -
> just to eliminate the obvious: have you made sure that
> http://www.example1.com is pointing to your box?
> (trying pinging to be certain).
> 
> Otherwise, your xml files look good.
> 
> Lance Lavandowska
> www.Brainopolis.com
> 
> - Original Message -
> From: "G T" <[EMAIL PROTECTED]>
> To: "Orion-Interest" <[EMAIL PROTECTED]>
> Sent: Friday, June 08, 2001 3:47 PM
> Subject: Virtual Hosts - Newbie question
> 
> >I followed the steps given in OrionSupport.com to set up virtual hosts but
> I
> >am still not able to run it successfully.
> >On typing www.example1.com it refuses to look into my server, instead it
> >tries to go to internet
> 
> _
> Get your FREE download of MSN Explorer at http://explorer.msn.com




HTTP server timetable-like exception

2001-05-07 Thread Boris Erukhimov

Here is a piece of my server.log below.

The setup simulates development/production environment on the same box.

There are three virtual hosts representing three would be production
sites on port 80, each one runs it's own "default" application. 
There is also default web site on port 8080 that has three corresponding
applications under development. 

Looks like there is some orion core thread throwing these exceptions in
time slices divisible by 5 minutes. Sometimes one or more get skipped
then exception occurs in 10 or 20 minutes.

My code does not have any timed tasks and it's servlet/JSP stuff only.

I'm running 1.4.8. The same thing was going on with 1.4.5, it just used
to point to a different part of orion source code.

Has anyone seen something like this ?

Thanks
~boris
...

5/7/01 2:58 AM Internal error in HttpServer
java.lang.NullPointerException
at com.evermind._kj._oa(Unknown Source)
at com.evermind._jw.run(Unknown Source)
5/7/01 3:04 AM Internal error in HttpServer
java.lang.NullPointerException
at com.evermind._kj._oa(Unknown Source)
at com.evermind._jw.run(Unknown Source)
5/7/01 3:10 AM Internal error in HttpServer
java.lang.NullPointerException
at com.evermind._kj._oa(Unknown Source)
at com.evermind._jw.run(Unknown Source)
5/7/01 3:15 AM Internal error in HttpServer
java.lang.NullPointerException
at com.evermind._kj._oa(Unknown Source)
at com.evermind._jw.run(Unknown Source)
5/7/01 3:21 AM Internal error in HttpServer
java.lang.NullPointerException
at com.evermind._kj._oa(Unknown Source)
at com.evermind._jw.run(Unknown Source)
5/7/01 3:26 AM Internal error in HttpServer
java.lang.NullPointerException
at com.evermind._kj._oa(Unknown Source)
at com.evermind._jw.run(Unknown Source)
5/7/01 3:32 AM Internal error in HttpServer
java.lang.NullPointerException
at com.evermind._kj._oa(Unknown Source)
at com.evermind._jw.run(Unknown Source)
5/7/01 3:37 AM Internal error in HttpServer
java.lang.NullPointerException
at com.evermind._kj._oa(Unknown Source)
at com.evermind._jw.run(Unknown Source)
5/7/01 3:43 AM Internal error in HttpServer
java.lang.NullPointerException
at com.evermind._kj._oa(Unknown Source)
at com.evermind._jw.run(Unknown Source)
5/7/01 3:48 AM Internal error in HttpServer
java.lang.NullPointerException
at com.evermind._kj._oa(Unknown Source)
at com.evermind._jw.run(Unknown Source)
5/7/01 3:53 AM Internal error in HttpServer
java.lang.NullPointerException
at com.evermind._kj._oa(Unknown Source)
at com.evermind._jw.run(Unknown Source)
5/7/01 3:59 AM Internal error in HttpServer
java.lang.NullPointerException
at com.evermind._kj._oa(Unknown Source)
at com.evermind._jw.run(Unknown Source)
5/7/01 4:04 AM Internal error in HttpServer
java.lang.NullPointerException
at com.evermind._kj._oa(Unknown Source)
at com.evermind._jw.run(Unknown Source)
5/7/01 4:10 AM Internal error in HttpServer
java.lang.NullPointerException
at com.evermind._kj._oa(Unknown Source)
at com.evermind._jw.run(Unknown Source)
5/7/01 4:15 AM Internal error in HttpServer
java.lang.NullPointerException
at com.evermind._kj._oa(Unknown Source)
at com.evermind._jw.run(Unknown Source)

.. and so on ...




Re: IIS, Orion, virtual host

2001-04-25 Thread Boris Erukhimov

See http://www.orionsupport.com/articles/vhosts.html

olivier wrote:
> 
> I wanted to create virtual host to avoid having to type : in the
> browser.
> I know it works if I use different ports. I was using loopback (127.0.0.1:80
> and 127.0.0.1:8080). But I would like to avoid that.
> In IIS, you can have 2 sites running on the same port, as long as they have
> 2 different addresses.
> 
> But it looks like it is something I have done wrong anyway...can't see what
> though.
> 
> Thanks,
> 
> Olivier
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Paul Medcraft
> Sent: 25 April 2001 14:16
> To: Orion-Interest
> Subject: RE: IIS, Orion, virtual host
> 
> You can't have two applications on one machine listening on the same port,
> although they could both use the same IP. Try setting them both to use x.20
> and put orion on a different port.
> 
> Paul
> 
> > -Original Message-
> > From: olivier [mailto:[EMAIL PROTECTED]]
> > Sent: 25 April 2001 13:30
> > To: Orion-Interest
> > Subject: RE: IIS, Orion, virtual host
> >
> >
> > this is the error message I have:
> > Error starting HTTP-Server: Address in use: JVM_Bind
> >
> >
> > -Original Message-
> > From: Ron White [mailto:[EMAIL PROTECTED]]
> > Sent: 25 April 2001 13:22
> > To: Orion-Interest
> > Cc: [EMAIL PROTECTED]
> > Subject: RE: IIS, Orion, virtual host
> >
> >
> > What exactly is the error message? There are a couple of
> > different ones
> > pertaining to different config files.
> >
> > Thanks,
> > Ron White
> >
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of olivier
> > Sent: Wednesday, April 25, 2001 3:51 AM
> > To: Orion-Interest
> > Subject: IIS, Orion, virtual host
> >
> >
> > Hi,
> >
> > For some reason, I have set 2 IP addresse to my machine (NT).
> > x.x.x.20 and
> > x.x.x.21. (modification in the connection setting and the hosts file)
> > I have configured IIs to use x.20, on port 80, and Orion x.21
> > on port 80.
> > Is is because the port are the same that I can't start both
> > of them at the
> > same time (they complain that the address is in use).
> >
> > Or is it possible and I don't know how to do it ???
> >
> > Thanks,
> >
> > olivier
> >
> >
> >
> 
> http://www.iii.co.uk
> Interactive Investor International is a leading UK Internet personal
> finance service that provides individuals with the capability to identify,
> compare, monitor and buy online a number of financial products and services.
> 
> Interactive Investor Trading Limited, a subsidiary of Interactive Investor
> International plc, is regulated by the SFA.




Running Orion on multiple ports

2001-04-01 Thread Boris Erukhimov

Hello,

I've tested Orion running default web site on port 8080 and some virtual
host (another web site) on port 80 simultaneously. Works perfectly. 
I hope it's a legitimate feature, not a side effect.
Does anybody know how it's handled internally ?
Is it another instance of Orion main class or JVM ?

Consider the following scenario :

There is only one single server for production and development.

Production sites are represented by virtual hosts, each one runs a
single web site. Each  sites of these only runs it's own "default" web
application. And all these sites are working under port 80.

Development is handled by default web site which runs under port 8080.
Every "default" application from production factory is mirrored by named
development application contained in default web site.

Does it make sense ?

Are HttpSessions shared across :
 a) virtual domains factory
 b) different server instances running on different ports ?


Any input would be greatly appreciated
Thanks
~boris




Off topic : Conversion HTML to a plain text

2001-03-21 Thread Boris Erukhimov

Hello everybody,

My aplication produces HTML e-mail attachment, but because of some e-mail client 
hassle I need to duplicate the content as a plain text placed in the message body.
To do this I need some quick and dirty solution to present HTML file (which is built 
already) as a plain text simular to what browser does when asked "Save as plain text". 
I can probably develop something like that using javax.swing.text.html but I hoped 
somebody did it already (?)

Thanks






Re: Capturing the output of a JSP page as HTML

2001-03-02 Thread Boris Erukhimov


We had a similar task that Andy described  and solved it in almost exactly a
way Geoff suggested.
But if I were to approach it now, I'd rather use filter and owerwrite response
object.
That saves extra HTTP connection within request processing and looks more
elegant anyway.

~boris

Geoff Marshall wrote:

> No problem, write a servelt or other JSP page that does a method='post' to
> the JSP in question.  You will have to read the output of the page into a
> variable.  Then you can write the variable to both a file and out.println.
>
> The only catch is you will have to have a class that can do a post! See the
> attatchment...
> --
>
> -Geoff Marshall, Director of Development
>
> ...
> t e r r a s c o p e  (415) 951-4944
> 54 Mint Street, Suite 110 direct (415) 625-0349
> San Francisco, CA  94103 fax (415) 625-0306
> ...
>
> > From: [EMAIL PROTECTED]
> > Reply-To: Orion-Interest <[EMAIL PROTECTED]>
> > Date: Thu, 1 Mar 2001 11:32:25 -0500
> > To: Orion-Interest <[EMAIL PROTECTED]>
> > Subject: Capturing the output of a JSP page as HTML
> >
> > Can anyone tell me if this is possible.  I have a JSP page that contains
> > information about an order that was just entered (Essentially a
> > confirmation page).  What I want to do is somehow intercept the output
> > stream inside the JSP page and write it to a file, as plain html, which I
> > will later attach to an email and send to someone.
> >
> > Thanks,
> > Andy
> >
> >
> >
>
>   
>Name: RequestBean.java
>RequestBean.javaType: Plain Text (text/plain)
>Encoding: base64





Is xerces.jar too old ?

2001-02-19 Thread Boris Erukhimov

Our application uses XML data exchange wrapped into HTTP.
It is handled by a servlet running under Orion and doing its own XML parsing and
generating.
We are using pretty convenient XML API (Jdom ) from http://www.jdom.org which I
highly recommend.
The jdom.jar bundle comes with the latest (?)  xerces.jar which I also copied
into /Orion/lib directory.
My standalone code worked fine, but after I placed it into servlet it did throw
NoSuchMethodException complaining at some xerces code.
Apparently Orion's classloader uses xerces.jar from the Orion root directory
prior to the one placed in Orion/lib directory.
Everything works fine after I replaced the old xerces.jar in the Orion root
directory with the new one which came with jdom.jar bundle.

I don't like that hack because it's an alteration to Orion distribution and hell
knows what side effects it may cause.
So, my question are :

Is there any way to force servlet in using certain library if there is some
naming conflict with the one in Orion root ?
Orion team, are you going to update xerces.jar in distribution ? Does it involve
any licensing issue ?

Thanks
~boris







Re: Client site HttpSession simulating

2001-02-06 Thread Boris Erukhimov

Thanks a lot Juan, it's working.
Is it possible for https session ?
I've also found out that URL rewriting syntax is server specific, which
means it's not part of the spec ?


"Juan Lorandi (Chile)" wrote:

> you have to postfix any URL with ";JSESSIONID="
>
> NOTE THE SEMICOLON
>
> JP
>
> > -Original Message-
> > From: Boris Erukhimov [mailto:[EMAIL PROTECTED]]
> > Sent: Lunes, 05 de Febrero de 2001 10:45
> > To: Orion-Interest
> > Subject: Client site HttpSession simulating
> >
> >
> > I have a site which stores user profile in HttpSession after
> > user gets in
> > supplying user id and password.
> > I need to provide some client site batch operation on the
> > site using standalone
> > java client.
> > I remember old servlet spec which allowed you to embed
> > session ID into URL if
> > there is no way to use cookies to handle HttpSession.
> >
> > The scenario is:
> >
> > 1. My client java program creates HttpURLConnection for the
> > site login response
> > URL with valid user ID and password.
> >
> > 2. Then client gets HTML response proving successful login.
> > According to the
> > application logic a new session has been created and client receives
> > "Set-Cookie" response header with some value like
> > "JSESSIONID=BGDBPNFMPDGO; Path=/".
> >
> > 3. Assuming JSESSIONID is a name Orion wants to identify
> > session id I include
> > JSESSIONID=BGDBPNFMPDGO into query string for my next client request.
> >
> > 4. Client gets HTML response such as in case session was not
> > established yet -
> > new session has been created.
> >
> > So, Orion does not recognize "JSESSIONID=BGDBPNFMPDGO" in
> > request pointing to
> > existing HttpSession.
> >
> > Am I missing something obvious ? Or it might be some
> > time/racing issues ?
> >
> > I need thins functionality very much. Any help would be
> > greatly appreciated
> > Thanks
> >
> > ~boris
> >
> >
> >
> >





Client site HttpSession simulating

2001-02-05 Thread Boris Erukhimov

I have a site which stores user profile in HttpSession after user gets in
supplying user id and password.
I need to provide some client site batch operation on the site using standalone
java client.
I remember old servlet spec which allowed you to embed session ID into URL if
there is no way to use cookies to handle HttpSession.

The scenario is:

1. My client java program creates HttpURLConnection for the site login response
URL with valid user ID and password.

2. Then client gets HTML response proving successful login. According to the
application logic a new session has been created and client receives
"Set-Cookie" response header with some value like
"JSESSIONID=BGDBPNFMPDGO; Path=/".

3. Assuming JSESSIONID is a name Orion wants to identify session id I include
JSESSIONID=BGDBPNFMPDGO into query string for my next client request.

4. Client gets HTML response such as in case session was not established yet -
new session has been created.

So, Orion does not recognize "JSESSIONID=BGDBPNFMPDGO" in request pointing to
existing HttpSession.

Am I missing something obvious ? Or it might be some time/racing issues ?

I need thins functionality very much. Any help would be greatly appreciated
Thanks

~boris







Re: How to specify cache time out period for images !!!!

2001-02-02 Thread Boris Erukhimov

I could not manage to prevent caching of dynamically generated images playnig with
response headers.
A simple hack is to add some dummy request parameter to the image URL, assuming it
won't break your servlet :



The image URL gets cached and is used from cache among responses
as long as cache control value stays the same.
You can provide implicit timeout changing that value after time required.

~boris


Tim Endres wrote:

> This is a very general HTTP/browser question that you might get a quicker answer
> to from a more target newsgroup, such as comp.infosystems.www.browsers, or one
> related to HTTP. However, if someone on this list has the answer, I know I sure
> would like to hear it. I wonder if have a servlet field the requests for images,
> so that it can set the proper header lines, would be enough? I don't know if
> browsers honor those headers when they are downloading images.
>
> tim.
>
> > Hi,
> >
> > We have a J2EE application developed with JSP,EJB and SQL server 2000 with
> > Orion Server.We want to cache all our jsp page  for a particular time on a
> > caching server.With HTTP Headers this is perfectly working but the  images
> > on the page it never Time out. I would like to know if there is a way to set
> > cache time out for images in Orion or JSP
> >
> > Can any body help.
> >
> > Regards
> >
> > Rajeev
> >





Re: Downloading a file via a Servlet

2001-01-29 Thread Boris Erukhimov

You may try this for download any type of file

//Ns and MSIE need different content type to force download
  if(-1 < _request.getHeader("User-Agent").indexOf("MSIE") )
  response.setContentType("message/external-body;
access-type=anon-ftp") ;
  else
  response.setContentType("application/octet-stream") ;

  response.setHeader("Content-disposition", "attachment;filename=" +
"yourfilename.ext" ) ;
  response.setContentLength(file_to_send.length());


~boris

"Van Dooren, Damian" wrote:

> I was wondering if anyone knew of a way to get around the following
> situation:
>
> We have a servlet that sends back PDFs that are stored in a database.
> Everything seems to work great but the one oddity/issue that I would like to
> solve if possible is. When someone wants to save the PDF, instead of
> viewing, it wants to save the PDF as the name of the servlet. I understand
> why this is the case, but I wonder if there is anything, perhaps in the
> content header, that I could set the actual name of the file.
>
> Any suggestions would be greatly appreciated.
>
> -
> Damian Van Dooren
> Information Technology
> The Investment Centre
> (519) 672-4389 x718
>





Re: problem invalidating servlet

2001-01-24 Thread Boris Erukhimov

I guess request.getSession() (aka request.getSession(false) ) gives you existing 
session
object.
I don't know how exactly orion implements it, but apparently there is still a valid
reference to session object after session.invalidate() is called. To supress it just 
use
request.getSession(true), it will sure create new session for you.

if (event instanceof LogoutEvent) {
 request.getSession().invalidate();
HttpSession validSession = request.getSession(true);
validSession.setAttribute(WebKeys.ModelManagerKey, mm);
}

~boris

Matt Bauer wrote:

> Indeed I was
>
> Matt
>
> Conrad Chan wrote:
>
> > I think he was trying to invalidate the existing session before setting the 
>attribute.
> >
> > Conrad
> >
> > -Original Message-
> > From: Boris Erukhimov [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 24, 2001 4:05 AM
> > To: Orion-Interest
> > Subject: Re: problem invalidating servlet
> >
> > Try this ...
> >
> > if (event instanceof LogoutEvent) {
> >  HttpSession validSession = request.getSession(true);
> >  validSession.setAttribute(WebKeys.ModelManagerKey, mm);
> > }
> >
> > ~boris
> >
> > Matt Bauer wrote:
> >
> > > I have this small bit of code that handles a log out.  What I want to do
> > > is invalidate the session and put a new on in its place.  The problem is
> > > when I try to set the attribute, I get an exception telling my the
> > > session is invalidated.  Am I missing something?
> > >
> > > if (event instanceof LogoutEvent) {
> > >  request.getSession().invalidate();
> > >  HttpSession validSession = request.getSession();
> > >  validSession.setAttribute(WebKeys.ModelManagerKey, mm);
> > > }
> > >
> > > Thanks
> > >
> > > M





Orion web site error

2001-01-24 Thread Boris Erukhimov

That's what I got after clicking on FAQ at www.orionserver.com

500 Internal Server Error

com.evermind.server.rmi.OrionRemoteException: Database error: The database is
already in use by another process
at
KeywordHome_EntityHomeWrapper73.findAll(KeywordHome_EntityHomeWrapper73.java:642)

at
com.evermind.faq.ejb.EntryManagerEJB.getKeywords(EntryManagerEJB.java:58)
at
EntryManager_StatefulSessionBeanWrapper54.getKeywords(EntryManager_StatefulSessionBeanWrapper54.java:304)

at /viewFAQ.jsp._jspService(/viewFAQ.jsp.java:70) (JSP page line 18)
at com.orionserver.http.OrionHttpJspPage.service(JAX)
at com.evermind.server.http.HttpApplication.xk(JAX)
at com.evermind.server.http.JSPServlet.service(JAX)
at com.evermind.server.http.d4.sx(JAX)
at com.evermind.server.http.d4.sv(JAX)
at com.evermind.server.http.eg.s2(JAX)
at com.evermind.server.http.eg.dp(JAX)
at com.evermind.util.f.run(JAX)
Nested exception is:
java.sql.SQLException: The database is already in use by another process
at org.hsql.Trace.getError(Trace.java:124)
at org.hsql.Trace.getError(Trace.java:115)
at org.hsql.Trace.error(Trace.java:127)
at org.hsql.Log.open(Log.java:115)
at org.hsql.Database.(Database.java:44)
at org.hsql.jdbcConnection.openStandalone(jdbcConnection.java:651)
at org.hsql.jdbcConnection.(jdbcConnection.java:524)
at org.hsql.jdbcDriver.connect(jdbcDriver.java:78)
at com.evermind.sql.DriverManagerDataSource.getConnection(JAX)
at
com.evermind.sql.DriverManagerConnectionPoolDataSource.getPooledConnection(JAX)

at com.evermind.sql.OrionPooledDataSource.d_(JAX)
at com.evermind.sql.aj.d_(JAX)
at com.evermind.sql.OrionPooledDataSource.getConnection(JAX)
at com.evermind.sql.DriverManagerXADataSource.ev(JAX)
at com.evermind.sql.am.er(JAX)
at com.evermind.sql.aq.prepareStatement(JAX)
at com.evermind.server.ejb.DataSourceConnection.getCustomStatement(JAX)

at
KeywordHome_EntityHomeWrapper73.findAll(KeywordHome_EntityHomeWrapper73.java:533)

at
com.evermind.faq.ejb.EntryManagerEJB.getKeywords(EntryManagerEJB.java:58)
at
EntryManager_StatefulSessionBeanWrapper54.getKeywords(EntryManager_StatefulSessionBeanWrapper54.java:304)

at /viewFAQ.jsp._jspService(/viewFAQ.jsp.java:70) (JSP page line 18)
at com.orionserver.http.OrionHttpJspPage.service(JAX)
at com.evermind.server.http.HttpApplication.xk(JAX)
at com.evermind.server.http.JSPServlet.service(JAX)
at com.evermind.server.http.d4.sx(JAX)
at com.evermind.server.http.d4.sv(JAX)
at com.evermind.server.http.eg.s2(JAX)
at com.evermind.server.http.eg.dp(JAX)
at com.evermind.util.f.run(JAX)





Re: problem invalidating servlet

2001-01-24 Thread Boris Erukhimov

Try this ...

if (event instanceof LogoutEvent) {
 HttpSession validSession = request.getSession(true);
 validSession.setAttribute(WebKeys.ModelManagerKey, mm);
}

~boris

Matt Bauer wrote:

> I have this small bit of code that handles a log out.  What I want to do
> is invalidate the session and put a new on in its place.  The problem is
> when I try to set the attribute, I get an exception telling my the
> session is invalidated.  Am I missing something?
>
> if (event instanceof LogoutEvent) {
>  request.getSession().invalidate();
>  HttpSession validSession = request.getSession();
>  validSession.setAttribute(WebKeys.ModelManagerKey, mm);
> }
>
> Thanks
>
> M





Re: Client hits STOP button..is there a way to detect this before sending a response?

2000-11-15 Thread Boris Erukhimov



"Duffey, Kevin" wrote:

>
> So here is the problem. If a user submits a form (say..to search for all
> clients) and lets say that search will take two minutes. 10 seconds later,
> the client sees he/she made a mistake on what they were searching for. As if
> often the case..they hit STOP on the browser, change their mistake and
> submit the form again. On the server..there are now two threads
> running..because the first one hasn't completed yet (assuming the user
> submitted the form the 2nd time fairly quickly). The 2nd request is
> quick..it populates the javabean reference to a Vector of objects say in 20
> seconds. The response is sent back and the user sees a list of say 20 items.
> Now, while they are looking over this list, the 1st request they sent is
> still going on. At some point it too populates the SAME javabean with its
> results, which are now different than what the client is actually looking at
> on the page. The action tries to return its response but it finds its
> connection was terminated. It throws an exception (which I catch), and
> voila..the client sees nothing. Where the problem lies though..is when the
> first request populates the javabean that the 2nd request already populated.
> So when the user clicks on say item 3 of what he sees..it refers to item 3
> in the results Vector that has now been replaced with the first requests
> results. Therefore, the information is incorrect.
> Thanks for any ideas and info on this topic.

I guess what you need is to implement what is called a "delayed response" to
avoid
make user waiting about 2 min.

Here is a flow:
1. User makes search or whatever request which is handled with delayed
response.
Your action or session class launches a separate thread to do the actual job
if
 let's say an "in process" flag is set to "false" or not exist in your
HttpSession.
 If thread is launched set that flag to "true". If not (meaning thread is
running) go to the step 2.

2. Your action class responds with JSP page saying "Please wait ".
 Put in the page a simple javascript code sending another request after some
timeout, say 8 sec.

3. Your action class process incoming request and checks if flag "in process" is
still on.
 If yes it responds with the same "Please wait..." page which will schedule
another try in 8 sec.
 If no, it responds with your result page populated by bean, which itself
uses result
 data passed through HttpSession from completed job thread.

Note that actual job is now almost untied from browser connection. If user hits
"Stop" and then decides to repeat search request still being within the same
HttpSession and his previously
launched job thread is not completed, he will receive "Please wait ..." page.

Hope it helps
~boris








External DTD's

2000-11-14 Thread Boris Erukhimov

I'm developing an XML-based interapplication communication facility.
It is intended to work accross public Internet, so where to place DTD becomes an issue.
Being  newbe to XML I'm curious where orion keeps it's external DTD files
which are referred by all .xml files in config and other directories like for example
   http://www.orionserver.com/dtds/principals.dtd">

>From here it looks like DTD's are stored at orion domain, but when I cut my Internet
connection, I still was able to launch orion successfuly, run some stuff and shut it 
down.

If I am not missing something obvious when starts orion parses all xml configuration 
files
using standard parsers. So how can it work without Internet connection ?

Thanks
~boris







Re: Servlet class folder

2000-10-27 Thread Boris Erukhimov

It's java, not Orion you have trouble with ...

Make your "Test" servlet class belong to package "pack" named after your
folder name.
Refer to the servlet class as pack.Test in URL or in web.xml to set a
servlet mapping:
   
 AliasForTestClass
 /pack.Test


~boris

Yi Su wrote:

> Hi all,
>
> I've successfully deployed an web application to orion
> server.  I have the following file structure:
>
> e:\myapp\META-INF\application.xml
> e:\myapp\myapp-web\WEB-INF\web.xml
> e:\myapp\myapp-web\WEB-INF\classes\pack\Test.class
>
> However, the orion server forces me to put my
> Test.class (pack\Test.class) under
> \orion\default-web-app/WEB-INF/classes.  Otherwise the
> server throws me "500 Internal Server Error" error
> message.
>
> I follow the way of depolying in orion-primer, but my
> application doesn't have EJB module.  Can someone
> please help me to solve the problem as putting classes
> under orion default-web-app does give me trouble.  I
> must miss something.
>
> Thank you.
>
> Yeoman
>
> __
> Do You Yahoo!?
> Yahoo! Messenger - Talk while you surf!  It's FREE.
> http://im.yahoo.com/





Re: Orion as NT4 Service

2000-10-26 Thread Boris Erukhimov

Kevin,
Were you able to get a gracefull shutdown if Orion is run as service installed
by JNT ?
If so could you please specify  JNT command line  to install the service ?
I'm interested in part following  –Dshutdown.method= ?

jnt "/InstallAsService:OrionWebServer" "/SDd:\Orion" -Dshutdown.method= "?"
-jar orion.jar

Thanks
~boris

"Duffey, Kevin" wrote:

> We are using JNT, a free service runner for java applications that properly
> handles the log-off command. I forget the url, but if you do a search at
> excite or something, I am sure you will find it. We were using
> run_as_service, or srvany, neither of which properly worked.
>
> > -Original Message-
> > From: Todd Renner [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, October 25, 2000 6:48 AM
> > To: Orion-Interest
> > Subject: Orion as NT4 Service
> >
> >
> > Hi,
> >
> > We've setup orion (1.2.9) to be an NT service as specified
> > at orionsupport.com.   But whenever we log off the machine
> > the server stops with no errors.   I recall some discussion on
> > this awhile ago, but all I could find in the archives pertained
> > to Unix.We've tried several different scenarios, diff. users,
> > reboot and not logging in etc. but with no success.   Anybody
> > have some suggestions as to what to try?   Were using sunjdk1.3,
> > hotspot server, nt40.Thanks.
> >
> >
> >
> > Todd Renner
> > [EMAIL PROTECTED]
> >





Redirecting JSP output to a file

2000-10-04 Thread Boris Erukhimov

I need to have HTML output from JSP page stored in a file.
There are 2 different requests requiring output from the the same JSP page.
First is regular one

RequestDispatcher rd = req.getRequestDispatcher("foo.jsp");
rd.forward(req, res);

The second one has to forward "foo.jsp", I mean HTML output of "foo.jsp", to a
file.
I've heard WebSphere has some implementation of response object allowing to do
it.
Something like that in Orion ?

Any hints would be greatly appreciated.
Thanks
~boris





servleet setup

1999-10-24 Thread Boris Erukhimov

A couple of fresh user's questions.

I was able to address my packaged servlet placing it into "servlet"
directory under default site. The URL is
"http://localhost:8000/servlet/MayPackage.MyClass".

Questions :

1. Where can I specify init parameters for my servlet ?
2. Is there a way to alias called servlet ?
3. Does "servlet" directory has a special meaning like in JWS - a
customized Class Loader is used to track servlet code update and
automatic reloading ?

Thanks in advance
~boris