Troubles with https....

2001-07-10 Thread Geoff Marshall

Can anyone explain the principles or theory of operation of https within
Orion?

I have a site running on one machine under Orion that uses https.  No
problem, everything works fine.

I tarballed the whole shebang and expanded it onto machine two. Machine two
has 4 Network Interfaces, thus 4 IP addresses.  I'm running Orion on the
second of 4 IP addresses.  The entire site works, but I can't hit it via
https.  

I don't think it's an Orion configuration issue (since the same config files
work on machine 1) , but in any event, I'm doing exactly what's described on
the orionsupport pages.

Can anyone give me some insight?  I've run out of ideas.

BTW, yes, the versions are the same on the two machines.

Thanks!





Re: orion with mysql?

2001-04-04 Thread Geoff Marshall

Am using MySQL with Orion without it's own db-schema.  No problems, yet.

Be sure to get the MM.MySQL driver...
-- 

-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: Peter Peltonen <[EMAIL PROTECTED]>
> Organization: Fivetec Solutions Oy
> Reply-To: Orion-Interest <[EMAIL PROTECTED]>
> Date: Wed, 04 Apr 2001 19:42:44 +0300
> To: Orion-Interest <[EMAIL PROTECTED]>
> Subject: orion with mysql?
> 
> 
> Is it possible to use MySQL with Orion? Does it need a db-schema of it's own?
> 
> We tried to use PostgreSQL but JBuilder4 didn't cope with it very well
> (JBuilder isn't able to show Postgre's tables). We also tried Hypersonic, but
> it seems that when both Orion and JBuilder communicate with the db the db gets
> confused. At least the changes we make in JBuilder don't get updated.
> 
> Any ideas about a good open-source db that would work with both Orion and
> JBuilder would be appreciated!
> 
> Regards,
> Peter
> 
> 





communication link failure

2001-03-20 Thread Geoff Marshall

Hello all!

I've got an application-level object that grabs a pool of database
connections (MySQL using the mm.mysql JDBC driver).  All works well until
there is not activity for some extended period of time (overnight) and then
all attempts to access the database get "communication link failure" errors.

Is there any way to configure Orion or MySQL to not give up on a database
connection.  Or do I have to move the connections to some other level.

I know the app objects are surviving because I can query them, but just
can't reestablish with the db.

Anyone else have similar problems or any ideas???
-- 

-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
...





https second session problems...

2001-03-06 Thread Geoff Marshall

First, a thank-you to Jay Armstrong for his SimplePortTester.  Indeed,
Apache had port 443 locked up even though I thought I had stopped Apache.

Here's the problem of the day:

I'm only using JSP and Beans. It seems when I switch between http and https,
Orion crreates a 'second session'.  I have inserted a System.err.println in
EVERY method of my SessionBean which has a single boolean property:
loggedOn. My comments (//)

// run orion
[root@daphne orion]# Orion/1.4.5 initialized

// with browser hit my index page in http
// index page instantiates two DataAccess objects, and
// one SessionBean with session scope
DataAccess.DataAccess() - constructing...
DataAccess.DataAccess() - constructing...
SessionBean.SessionBean() - constructing...
SessionBean.getCustId() -
SessionBean.isLoggedOn() - false

// fill out log-on form on index page and log on (re-submits page as https)
DataAccess.DataAccess() - constructing...
DataAccess.DataAccess() - constructing...
SessionBean.SessionBean() - constructing...
// ...there you have it, all three session
// beans are being instantiated again!!!
// EVEN THOUGH my JSESSIONID does not change
// (looked at it in my brower)
SessionBean.getCustId() -
SessionBean.setCustId() -
SessionBean.logOn() -
// cust now logged on in https

// still there on next https page.
SessionBean.isLoggedOn() - true
SessionBean.getCustId() - 2


// switch to http page, and cust is gone.
SessionBean.isLoggedOn() - false

// back to https and cust is there again.
SessionBean.isLoggedOn() - true
SessionBean.getCustId() - 2
SessionBean.isLoggedOn() - false
SessionBean.getCustId() - 2

Is this a bug or a feature?  If it's a bug or a feature, is there a
work-around?  It makes no sense to me why you would want to create a second
'session'.
-- 

-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
...





https problems...

2001-03-05 Thread Geoff Marshall

I've read the two documents on setting up https and have performed the steps
five times using Linux and Windows.  But I can't seem to get Orion to slip
into SSL.

The only clue I have is this message at Orion startup:

# Error starting HTTP-Server: Unable to intialize SSLServerSocketFactory
'com.evermind.ssl.JSSESSLServerSocketFactory': Address already in use
Orion/1.4.5 initialized

What address??  Does Orion mean port??  What port is it trying to use??


-- 

-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
...





Re: Storing HttpServletRequest Object in Session

2001-03-02 Thread Geoff Marshall

Because when you retrieve the request, the request is over.  The object is
gone.

Set those values at the session level.
-- 

-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: "Santosh Kumar" <[EMAIL PROTECTED]>
> Reply-To: Orion-Interest <[EMAIL PROTECTED]>
> Date: Fri, 2 Mar 2001 14:06:46 +0530
> To: Orion-Interest <[EMAIL PROTECTED]>
> Subject: Storing HttpServletRequest Object in Session
> 
> Hi all,
> I tried to store the implicit request object in session. But when i tried to
> retrieve it.
> 
> 
> one.jsp
> --
> 
> ...
> ...
> 
> request.setAttribute("ONE", "1");
> request.setAttribute("TWO", "2");
> ..
> ..
> session.setAttribute("request",request);
> ..
> --> forward to two.jsp
> 
> 
> two.jsp
> --
> request = (HttpServletRequest)  session.getAttribute("request");
> out.println((String) request.getAttribute("ONE"));
> out.println((String) request.getAttribute("TWO"));
> 
> 
> Both the print statements are returning null.. i was expecting 1 and 2
> WHY
> 
> 
> Regards,
> Santosh
> 
> 
> 
> 
> 
> 





Re: need help getting started

2001-03-02 Thread Geoff Marshall

I'm using Orion for only JSP, Beans and Servlets.  It's solid, fast, and
when you're ready to move on, you don't have to move out
-- 

-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: "johnd" <[EMAIL PROTECTED]>
> Reply-To: Orion-Interest <[EMAIL PROTECTED]>
> Date: Thu, 1 Mar 2001 20:59:00 -0800
> To: Orion-Interest <[EMAIL PROTECTED]>
> Subject: Re: need help getting started
> 
> my main reason for switching was that orion is much faster than tomcat.
> Isn't that so?
> 
> But, you are right, I had the feeling that it was way over kill...I am also
> looking into resin, I guess that is over kill, too for functionality, but
> like I said I was looking for speed gains.
> 
> - Original Message -
> From: "Randahl Fink Isaksen" <[EMAIL PROTECTED]>
> To: "Orion-Interest" <[EMAIL PROTECTED]>
> Sent: Thursday, March 01, 2001 2:10 PM
> Subject: RE: need help getting started
> 
> 
>> I would definately *NOT* recommend moving away from Tomcat if you only use
>> JSP and servlets. Tomcat is the reference implementation, it is free, and
>> unless you need a product with a lot of additional features (GUI helper
>> tools, EJBs, remote debugging, etc.) there is no reason to open up a can
> of
>> worms.
>> I really like the Orion server but that is for its EJB capabilities. I
> think
>> the Orion team strives for making it a great EJB server. - The aim is not
>> specifically to make it the best JSP/Servlet platform available, so I
> would
>> not expect it to be ahead of Tomcat in that sence.
>> Orion is a great product, but also a more complicated product, so if you
> can
>> use a less complex system and still fulfill your needs, then I sure
>> recommend you do so.
>> 
>> However, should you get to the point where you simply don't think using
> just
>> a relational database and several truck loads of SQL really makes your
> day,
>> THEN JOIN THE CLUB - that is why many of use Orion Server and Enterprise
>> Java Beans.
>> 
>> Yours Sincerely
>> 
>> Randahl
>> -Original Message-
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED]]On Behalf Of John de la
>> Garza
>> Sent: 1. marts 2001 19:01
>> To: Orion-Interest
>> Subject: need help getting started
>> 
>> 
>> I have been using tomcat for some time now and am having issues with it...
>> 
>> 
>> I am thinking about using Orion.  I don't do any ejb stuff and only need a
>> servlet container and web server.
>> 
>> I am having trouble using formbased security.  I couldn't get it to work
>> with the users set up in the principals file.  When I would go to a
>> protected area I would just get a message saying 'not allowed here' or
>> something like that but I would not get prompted for a pw username.
>> 
>> 
>> I actually don't want to use the principals file but have the usernames
> and
>> passwds in a data base.
>> 
>> Can anyone here refer me to some documentation on this?
>> 
>> 
>> 
> 
> 
> 





Re: Capturing the output of a JSP page as HTML

2001-03-02 Thread Geoff Marshall

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
> 
> 
> 



package db;

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

public class RequestBean
{

private String host;
private Vector args;
private String query;
private String template;
private String NEWLINE;
private String method;

public RequestBean()
{
query = "";
template = "";
NEWLINE = "\n";
method = "post";
host = "";
args = new Vector();
NEWLINE = System.getProperty("line.separator");


System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
}

public void setHost(String s)
{
host = s;
query = "";
}

public String getHost()
{
return host;
}

public void setMethod(String s)
{
method = s;
}

public String getMethod()
{
return method;
}

public void setQuery(String s)
{
query = s;
}

public String getQuery()
{
return query;
}

public void setArgs(Vector vector)
{
args = vector;
}

public Vector getArgs()
{
return args;
}

public void addPair(String s, String s1)
{
args.addElement(s);
args.addElement(s1);
}

public void setTemplate(String s)
{
template = s;
}

public String getTemplate()
{
return template;
}

public String action()
{
if(method.equalsIgnoreCase("get"))
return doGet();
else
return doPost();
}

public String doPost()
{
Object obj = null;
URLConnection urlconnection = null;
String s2 = host;
String s3 = "";
if(query.length() > 0)
s2 = s2 + "?" + query;
   
   // Build string of name/value pairs for post
   String s = "";
   Enumeration enumeration = args.elements();
   while(enumeration.hasMoreElements()) 
{
if(s.length() > 0)
s = s + "&";

s = s + (String)enumeration.nextElement() + "=";
s = s + URLEncoder.encode((String)enumeration.nextElement());
}

try
{
URL url = new URL(s2);
urlconnection = url.openConnection();
urlconnection.setDoOutput(true);
urlconnection.setDoInput(true);
urlconnection.setUseCaches(false);
urlconnection.setRequestProperty("content-type", 
"application/x-www-form-urlencoded");
PrintWriter printwriter = new PrintWriter(urlconnection.getOutputStream());
printwriter.print(s); // send post parms
printwriter.close();
}
catch(Exception _ex)
{
return "EXCEPTION 1:" + _ex;
}

try
{
BufferedReader bufferedreader = new BufferedReader(new 
InputStreamReader(urlconnection.getInputStream()));
String s1;
try
{
while((s1 = bufferedreader.readLine()) != null) 
s3 = s3 + s1 + NEWLINE;
}
catch(Exception _ex) { }
bufferedreader.close();
}
catch(Exception _ex)
{
return "EXCEPTION 2:" + _ex;
}

return s3;
}

public String doGet()
{
Object obj = null;
URLConnection urlconnection = null;
String

Re: login security include file

2001-03-01 Thread Geoff Marshall

According to all the books, as soon and you do a  there are
3 things you can't do:

1) redirect
2) mess with your response headers
3) mess with cookies

So all such code must reside before your first  in a static
file...

-- 

-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: "Vaskin Kissoyan" <[EMAIL PROTECTED]>
> Organization: Lokion
> Reply-To: Orion-Interest <[EMAIL PROTECTED]>
> Date: Wed, 28 Feb 2001 16:35:44 -0500
> To: Orion-Interest <[EMAIL PROTECTED]>
> Subject: login security include file
> 
> I'm trying to do a response.sendRedirect() from an include file 
> and wanted to avoid doing a directive.include (preparser),
> 
> I keep getting "Response has already been committed, be sure not to write to
> the OutputStream or to trigger a commit due to any other action before calling
> this method."
> 
> I have been very careful as to put this include at the very top of the file,
> and to specify autoFlush=false and flush=false on the include tag.
> 
> Again, the intention of this include file would be to be place at the top of
> the jsp file to secure it by redirecting to a login page if credentials in a
> session based UserBean do not allow access to the page for some reason.
> 
> -Vaskin
> 





Re: Intro to Orion Tutorial

2001-03-01 Thread Geoff Marshall

Awesome, now if someone can translate it into Linux...
-- 

-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
...






Re: Inactive application-scope bean problem

2001-02-22 Thread Geoff Marshall

I'm working on the package, but not that class.  Is that the problem
-- 

-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: Rafael Alvarez <[EMAIL PROTECTED]>
> Reply-To: Orion-Interest <[EMAIL PROTECTED]>
> Date: Thu, 22 Feb 2001 09:09:27 -0400
> To: Orion-Interest <[EMAIL PROTECTED]>
> Subject: Re: Inactive application-scope bean problem
> 
> Hello Geoff,
> 
> GM> If I don't use the application for some period of time and then try to hit
> GM> the index page, I get this error, which only restarting Orion seems to
> GM> fix...
> 
> GM> 500 Internal Server Error
> 
> GM> java.lang.ClassCastException: db.AppBean
> GM> at /Gold/home.jsp._jspService(/Gold/home.jsp.java:33)
> GM> at com.orionserver.http.OrionHttpJspPage.service(JAX)
> GM> at com.evermind.server.http.HttpApplication.xj(JAX)
> GM> at com.evermind.server.http.JSPServlet.service(JAX)
> GM> at com.evermind.server.http.d3.sw(JAX)
> GM> at com.evermind.server.http.d3.su(JAX)
> GM> at com.evermind.server.http.ef.s1(JAX)
> GM> at com.evermind.server.http.ef.do(JAX)
> GM> at com.evermind.util.f.run(JAX)
> 
> GM> ... any ideas
> 
> Have you modified the class at some point between each hit? That
> errors happen sometimes when the class in disk is different from the
> class in memory.
> 
> -- 
> Best regards,
> Rafaelmailto:[EMAIL PROTECTED]
> 
> 
> 
> 





Inactive application-scope bean problem

2001-02-22 Thread Geoff Marshall

-
Hello all!  I have a simple class that I'm using as a bean.  All it does is
provide a secure and non-secure root url:

package db;

public class AppBean {
private String SecureRootURL, NonSecureRootURL;

public AppBean() {
this.SecureRootURL= "https://mybox.mydomain.com:/whatever/";
this.NonSecureRootURL = "http://mybox.mydomain.com:/whatever/";
}

public void setSecure(String newURL) { SecureRootURL = newURL; }
public String getSecure() { return SecureRootURL; }

public void setNonSecure(String newURL) { NonSecureRootURL = newURL; }
public String getNonSecure() { return NonSecureRootURL; }
}

-
At the top of each JSP page:


<%
// initialize any application stuff

%>



-
If I don't use the application for some period of time and then try to hit
the index page, I get this error, which only restarting Orion seems to
fix...

500 Internal Server Error

java.lang.ClassCastException: db.AppBean
at /Gold/home.jsp._jspService(/Gold/home.jsp.java:33)
at com.orionserver.http.OrionHttpJspPage.service(JAX)
at com.evermind.server.http.HttpApplication.xj(JAX)
at com.evermind.server.http.JSPServlet.service(JAX)
at com.evermind.server.http.d3.sw(JAX)
at com.evermind.server.http.d3.su(JAX)
at com.evermind.server.http.ef.s1(JAX)
at com.evermind.server.http.ef.do(JAX)
at com.evermind.util.f.run(JAX)

... any ideas
-- 

-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
...





Orion doesn't work.

2001-02-15 Thread Geoff Marshall


I've surfed and surfed, and can't find any info on the problem I'm having.
HELP!


All brand new:
Red Hat Linux v7, Sun J2EE 1.2.1, Sun JDK1.3, Orion 1.4.5

[geoff@daphne orion]$cd /usr/local/orion
[geoff@daphne orion]$ java -jar orion.jar
java.lang.NoClassDefFoundError: com/evermind/gui/server/ServiceConsole
at java.lang.reflect.Method.invoke(Method.java:native)
at kaffe.jar.ExecJarName.main(ExecJarName.java:70)
at kaffe.jar.ExecJar.main(ExecJar.java:59)


Obviously, I'm missing some class, but where/what is it?  The JDK/SDK seems
to be working fine i.e. I can compile and run java applications, etc.  Does
some .jar file need to be expanded???

HELP!
-- 

-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
.......
-- 

-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
...





Orion doesn't work.

2001-02-15 Thread Geoff Marshall

I've surfed and surfed, and can't find any info on the problem I'm having.
HELP!


All brand new:
Red Hat Linux v7, Sun J2EE 1.2.1, Sun JDK1.3, Orion 1.4.5

[geoff@daphne orion]$cd /usr/local/orion
[geoff@daphne orion]$ java -jar orion.jar
java.lang.NoClassDefFoundError: com/evermind/gui/server/ServiceConsole
at java.lang.reflect.Method.invoke(Method.java:native)
at kaffe.jar.ExecJarName.main(ExecJarName.java:70)
at kaffe.jar.ExecJar.main(ExecJar.java:59)


Obviously, I'm missing some class, but where/what is it?  The JDK/SDK seems
to be working fine i.e. I can compile and run java applications, etc.  Does
some .jar file need to be expanded???

HELP!
-- 

-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
...





Re: Problems with a finder method in a cmp

2001-02-12 Thread Geoff Marshall

Please don't laugh at me, but what IS a 'finder method in a CMP'??  Just a
simple explanation or a pointer to more info, please...
-- 

-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: "mangesh laad" <[EMAIL PROTECTED]>
> Reply-To: Orion-Interest <[EMAIL PROTECTED]>
> Date: Fri, 09 Feb 2001 19:49:26 -
> To: Orion-Interest <[EMAIL PROTECTED]>
> Subject: Re: Problems with a finder method in a cmp
> 
> Hi
> All u have to do is just write the findByName as u already have in the
> home interface . While deploying the orion will write the coresponding
> finder query for you in the orion--ejb-jar in its finder-method tag
> 
> 
> 
>> From: "fresnaULL" <[EMAIL PROTECTED]>
>> Reply-To: Orion-Interest <[EMAIL PROTECTED]>
>> To: Orion-Interest <[EMAIL PROTECTED]>
>> Subject: Problems with a finder method in a cmp
>> Date: Thu, 8 Feb 2001 14:01:28 -
>> 
>> Hi all,
>> 
>> I'm trying to define this finder method in a cmp:
>> 
>> SELECT * FROM people
>> WHERE people.name LIKE '%name%'
>> 
>> which is correct in SQL SERVER 7.0
>> 
>> I put the following in the people home interface:
>> 
>> String findByName_query = "people.name like '%$1%'";
>> .
>> .
>> .
>> public java.util.Enumeration findByName(String value) throws
>> java.rmi.RemoteException, javax.ejb.FinderException;
>> 
>> but it doesn't work. Orion is able to deploy the cmp but when I try to use
>> it I only get this
>> error message:
>> 
>> 500 Internal Server Error
>> java.lang.NullPointerException
>> at sun.jdbc.odbc.JdbcOdbcPreparedStatement.clearParameter(Unknown Source)
>> at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setChar(Unknown Source)
>> at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setString(Unknown Source)
>> at com.evermind.sql.am.setString(JAX)
>> at com.evermind.sql.am.setString(JAX)
>> at
>> PeopleHome_EntityHomeWrapper72.findByName(PeopleHome_EntityHomeWrapper72.jav
>> a:1142)
>> at Search.doGet(Search.java:46)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java)
>> at com.evermind.server.http.d1.si(JAX)
>> at com.evermind.server.http.d1.forward(JAX)
>> at com.evermind.server.http.ed.sp(JAX)
>> at com.evermind.server.http.ed.so(JAX)
>> at com.evermind.util.f.run(JAX)
>> 
>> 
>> Does anybody know how i can make it work?
>> 
>> Thanks in advance
>> 
>> 
>> 
>> 
>> 
> 
> _
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
> 
> 
> 





Re: Setting Cookies

2001-02-09 Thread Geoff Marshall

Here's my code.  Seems to work...



import javax.servlet.*;
import javax.servlet.http.*;

public class SessionBean {
private boolean loggedOn;

public SessionBean() {
this.loggedOn = false;
}

// get customer ID from cookie
public String getCustId(HttpServletRequest req) {
Cookie[] cookies = req.getCookies();

if (cookies != null && cookies.length > 0) {
for (int i = 0; i < cookies.length; i++) {
Cookie cookie = cookies[i];
if ("cust_id".equals(cookie.getName())) {
String s = cookie.getValue();
s = s==null ? "" : s; // do not return null
return s;
}
}
}
return ""; 
}

// put customer ID into cookie and log on
public void setCustId(HttpServletResponse res, String cust) {
Cookie cookie = new Cookie("cust_id", cust);
res.addCookie(cookie);
logOn();
}

public void logOn() {
this.loggedOn=true;
}
public void logOff() {
this.loggedOn=false;
}
public boolean isLoggedOn() {
    return this.loggedOn;
}
}
-- 

-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: "S.Badrinarayanan" <[EMAIL PROTECTED]>
> Reply-To: Orion-Interest <[EMAIL PROTECTED]>
> Date: 9 Feb 2001 07:27:19 +
> To: Orion-Interest <[EMAIL PROTECTED]>
> Subject: Setting Cookies
> 
> Hi
> 
> Is there a known problem with adding cookies using orion 1.4.5?  I have the
> following code to set cookies
> 
> res.addCookie(new javax.servlet.http.Cookie("1", "one"));
> javax.servlet.RequestDispatcher dis =
> getServletContext().getRequestDispatcher(common.util.Utils.MESSAGE_PAGE);
> dis.forward(req, res);
> 
> I am printing out the cookie values in the jsp (forward statement).  But I get
> an empty list.
> 
> What am I missing here?
> 
> Regards
> sb
> 
> 
> Chequemail.com - a free web based e-mail service that also pays!!!
> http://www.chequemail.com
> 
> 





Re: HTTPS from Orion Java Bean

2001-02-06 Thread Geoff Marshall

Tim-  

Thanks for responding.  I need to learn to write these messages a little
more clearly.

Basically, I downloaded the JSSE stuff from Sun and tweaked the J2sdkee1.2.1
to allow me access to the SSL routines as per Sun's instructions.  I
compiled the Java class and executed it (see below).  It runs, so I know
it's not the code that has the problem.

When I bring it into Orion as a class instantiated by a  tag, I
then get the error message.

So I'm thinking I need to apply the JSSE stuff to Orion in some way, and I
can find no information on how to do that...
-- 

-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
...

import java.io.*;
import java.net.*;
import java.util.*;
import javax.servlet.http.*;
import java.text.*;

// Take a credit card transaction and interact with the authorization
// company.  Get an authorization.  Parse return. Store it in the database.
Handle errors.
// decide which page to display.
// call this with all the parameters on the url...
public class AuthBean {
// authorization object
// consists of information regarding requested transaction
// and response from that transaction.
private String authURL;

public AuthBean() {

System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.ww
w.protocol");
this.authURL = "https://www.verisign.com/"
}

public void setGateway(String gateway) {
this.authURL = gateway;
}

public String authorize(String parms) throws Exception {
URL gateway = new URL(this.authURL + "?" + parms);
BufferedReader in = new BufferedReader(new
InputStreamReader(gateway.openStream()));

String inputLine=null, authorization="";

while ((inputLine = in.readLine()) != null)
authorization = authorization + inputLine;

in.close();
return authorization;
}

public static void main(String args[]) {
AuthBean ab = new AuthBean();

try {
System.out.println(ab.authorize("test"));
} catch(Exception e) {
System.out.println("EXCEPTION:" + e);
}
}
}





Re: Output Volume

2001-02-06 Thread Geoff Marshall

Check your implicit out object (Type JSPWriter).  You can get the size of
the output buffer from the bufferSize property and you can flush your output
buffers before you hit that size.

e.g.



// output something
out.println("...");

if (out.getRemaining() < someComfortableMargin) {
out.flush();
out.clear();
}

// keep on outputting
out.println("...");
-- 

-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: "Chandika Mendis" <[EMAIL PROTECTED]>
> Reply-To: Orion-Interest <[EMAIL PROTECTED]>
> Date: Tue, 6 Feb 2001 08:21:13 -0800
> To: Orion-Interest <[EMAIL PROTECTED]>
> Subject: Output Volume
> 
> I'm trying to run a very simple JSP that gives a rather large volume of
> output. It loads the first time but fails the second time.(was doing some
> performance comparisons). The same JSP works fine with ServletExec. Any help
> will be appreciated.
> 
> 
> I've attached the JSP below:-
> 
> <%@page language="java" import="java.util.* %>
> 
> 
> <%
> 
> Date st=new Date();
> StringBuffer fullString=new StringBuffer();
> for (int i=0;i<1;i++){
> out.println("Some string concatenation blah blah blah "+i+"");
> }
> Date end=new Date();
> out.println("Time elapsed :"+(end.getTime()-st.getTime()));
> %>
> 
> 
> 
> 
> 
> 





HTTPS from Orion Java Bean

2001-02-05 Thread Geoff Marshall

Hello all!

I've written a bean that calls a credit card processing gateway from a Java
bean.  It is very simple and executes an https://... request.  Then it reads
the entire contents of the web page.

And it works if I run my AuthBean class from the command line.  But when I
attempt to use AuthBean, calling it from an Orion JSP, I get a runtime
error:

SSL not implemented.

So I looked at all I did to enable the j2sdkee1.2.1 to work with SSL and
tried to somehow apply that to Orion, but I came up blank.

I read through the SSL help page and it doesn't seem to address the problem
I'm having.

Any help would be appreciated!


-- 

-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
...