You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Keshava Murthy <ke...@bigtec.org> on 2003/05/15 12:19:42 UTC

Using java bean in a turbine application

Hi,

I have downloaded a upload bean from www.javazoom.net and works fine as an
application. I want to use this bean in my turbine application. Can some one
guide me how can I do it ?

regards,
Keshava Murthy. S


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: t2.1 and tomcat 4.1.24?

Posted by "Dan K." <da...@yorku.ca>.
Hi,

So no one has done this before or has everyone upgraded to turbine 2.2
and higher?  Nothing in the mail archive seems to help the situation...
Well thanks anyway.

Regards,
Dan

On Thu, 15 May 2003, Dan K. wrote:

>
> Hi,
>
> Has anyone migrated a T2.1 app from Tomcat 4.0.x to Tomcat 4.1.x,
> specifically, TC4.1.24?  If so, what were your steps?
>
> I keep getting a horrible ClassNotFoundException...  Uncommenting the
> invoker mapping didn't help.
>
> Horrible Exception: java.lang.ClassNotFoundException:
>
> 	Requested Screen not found:
> 	Turbine looked in the following modules.packages path:
> 	[ca.yorku.webapp.modules, org.apache.turbine.modules]
>
>
> Regards,
> Dan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


t2.1 and tomcat 4.1.24?

Posted by "Dan K." <da...@yorku.ca>.
Hi,

Has anyone migrated a T2.1 app from Tomcat 4.0.x to Tomcat 4.1.x,
specifically, TC4.1.24?  If so, what were your steps?

I keep getting a horrible ClassNotFoundException...  Uncommenting the
invoker mapping didn't help.

Horrible Exception: java.lang.ClassNotFoundException:

	Requested Screen not found:
	Turbine looked in the following modules.packages path:
	[ca.yorku.webapp.modules, org.apache.turbine.modules]


Regards,
Dan


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: Need help with cookies

Posted by Quinton McCombs <qm...@nequalsone.com>.
Thanks to everyone who responded about my problem with cookies.  My
problem was that the cookie was being set incorrectly.  The path being
used for the cookie was missing the context path.  This has now been
fixed in 2.3-dev

--------------------------------------------
Quinton McCombs
NequalsOne - HealthCare marketing tools
mailto:qmccombs@NequalsOne.com
http://www.NequalsOne.com 

> -----Original Message-----
> From: Eric Emminger [mailto:eric@ericemminger.com] 
> Sent: Thursday, May 15, 2003 12:38 PM
> To: Turbine Users List
> Subject: Re: Need help with cookies
> 
> 
> Turbine 2.2 has a bug in DefaultCookieParser that throws a 
> NullPointerException if no cookies exist in the request. I think it's 
> fixed in 2.3.
> 
> > // Setting the cookie
> >    Cookie cookie = new Cookie(cookieApplLogged,"true");
> >    cookie.setMaxAge(maxage);
> >    cookie.setComment(comment);
> >    //cookie.setDomain(domain);
> >    cookie.setPath(path);
> > 
> >    data.getResponse().addCookie(cookie);
> 
> I do the same to set a cookie. You have more flexibility setting the 
> properties of the Cookie and you don't have to check for a NPE.
> 
> Quinton, you could do this.
> 
> Cookie cookie = new Cookie("NeoUserName", user.getName()); 
> cookie.setMaxAge(Integer.MAX_VALUE);
> cookie.setPath("/");
> data.getResponse().addCookie(cookie);
> 
> That's a javax.servlet.http.Cookie above.
> 
> Eric
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Need help with cookies

Posted by Eric Emminger <er...@ericemminger.com>.
Turbine 2.2 has a bug in DefaultCookieParser that throws a 
NullPointerException if no cookies exist in the request. I think it's 
fixed in 2.3.

> // Setting the cookie
>    Cookie cookie = new Cookie(cookieApplLogged,"true");
>    cookie.setMaxAge(maxage);
>    cookie.setComment(comment);
>    //cookie.setDomain(domain);
>    cookie.setPath(path);
> 
>    data.getResponse().addCookie(cookie);

I do the same to set a cookie. You have more flexibility setting the 
properties of the Cookie and you don't have to check for a NPE.

Quinton, you could do this.

Cookie cookie = new Cookie("NeoUserName", user.getName());
cookie.setMaxAge(Integer.MAX_VALUE);
cookie.setPath("/");
data.getResponse().addCookie(cookie);

That's a javax.servlet.http.Cookie above.

Eric


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Need help with cookies

Posted by Edgar González <eg...@valhallaproject.com>.
Quinton,

I was read in Jetspeed that Turbine don't handle properly the cookies,
following are some examples of code that set and read cookies:

// Setting the cookie
String cookieApplLogged = TurbineResources.getString(
                              AtuinConstants.COOKIE_APPL_LOGGED);
if (cookieApplLogged != null && cookieApplLogged.length() > 0)
{
   int maxage = -1;
   String comment = "";
   String domain = "." + data.getServerName();
   String path = "/";
   Cookie cookie = new Cookie(cookieApplLogged,"true");

   cookie.setMaxAge(maxage);
   cookie.setComment(comment);
   //cookie.setDomain(domain);
   cookie.setPath(path);

   data.getResponse().addCookie(cookie);
}

// Checking the cooike
String cookieApplLogged = TurbineResources.getString(
                       AtuinConstants.COOKIE_APPL_LOGGED);
if (cookieApplLogged != null && cookieApplLogged.length() > 0)
{
    // check exist cookies - turbine don't  handle this currently
    if ( data.getRequest().getCookies() != null )
    {
        String cookie = data.getCookies()
                                .getString(cookieApplLogged);
        if (cookie!=null && cookie.equals("true"))
        {
            atuinR.setAlertMessage(TurbineResources.getString(
                           AtuinConstants.SESSION_EXPIRED_MESSAGE));
        }
    }
}

Hope this help

----------------------------------------------------------------------------
Edgar Gonzalez Gonzalez
VALHALLA Project, s.a.
Chief Technology Officer
Web: www.valhallaproject.com
E-mail: egg@valhallaproject.com
Phone: +58-212-242.4379 / 6662 / 4055 / 6475
Fax: +58-212-242.6809

"The limits of my language mean the limits of my world."
Ludwig Wittgenstein

----------------------------------------------------------------------------
----- Original Message -----
From: "Quinton McCombs" <qm...@nequalsone.com>
To: "'Turbine Users List'" <tu...@jakarta.apache.org>
Sent: Thursday, May 15, 2003 10:38 AM
Subject: Need help with cookies


> I am trying to get and set cookies using DefaultCookieParser.  The
> cookie appears to be set corrrectly but it is not being read.  Bear in
> mind, this is the first time I have ever tried to use cookies....
>
>
> As the final step in my login action, I write an encrypted version to
> the username and password to two cookies.  In my secure screen code, if
> the user is not logged in, I try to read the cookies.  The idea here is
> that if the user is not logged in, I will read the cookie and use the
> info to log the user in without ever having to send them to the login
> screen.
>
> Code to write the cookie:  (encryption omitted ATM)
>
> CookieParser cp = data.getCookies();
> cp.set("NeoUserName", user.getName(), Integer.MAX_VALUE);
> cp.set("NeoPassword", user.getPassword(), Integer.MAX_VALUE);
>
> The above code should set two cookies.  Each are perm cookies and should
> be set for the max duration.
>
> Code to read the cookies:  (encryption omitted ATM)
>
> CookieParser cp = data.getCookies();
> String userName = cp.getString("NeoUserName");
> String password = cp.getString("NeoPassword");
> log.debug("userName = "+userName);
> log.debug("password = "+password);
>
> The log indicates that the username and password are both null.  I
> verfied that the cookie were created.  They also contained the data I
> expected to see.
>
> Another interesting thing to see in the log file was the following line:
>
> 2003-05-14 17:54:05,784 [Thread-4] DEBUG
> org.apache.turbine.util.parser.DefaultCookieParser- Number of Cookies: 1
> 2003-05-14 17:54:05,784 [Thread-4] DEBUG
> org.apache.turbine.util.parser.DefaultCookieParser- Adding
> jsessionid=CB507FCF4534205924779A3B8F84AF32
>
> It found the jsessionid cookie and read it.  It just ignored my cookies.
>
> Any ideas?
> --------------------------------------------
> Quinton McCombs
> NequalsOne - HealthCare marketing tools
> mailto:qmccombs@NequalsOne.com
> http://www.NequalsOne.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: Need help with cookies

Posted by James Cooper <ja...@maxware.nl>.
Quinton
I had a few problems reading, and unsetting cookies myself, especially if I
was checking to see if a cookie existed. This is the old tried a tested.
Setting works fine mind..

	  // I use the HttpServletRequest.getCookies() as data.getCookies threw
NullPointerExceptions
        // if the cookie was not set. Personally I'd class this as a bug
        Cookie[] lCookie = aData.getRequest().getCookies();

        if (lCookie != null)
        {
            for (int i = 0; i < lCookie.length; i++)
            {
                // If the cookie was set, initialise the Locale with its
contents
                if ((lCookie[i].getName().equals(aCookieName)) &&
(!lCookie[i].getValue().equals("false")))
                {
                    gCookie = lCookie[i];
                    break;
                }
            }
        }
-----Original Message-----
From: Quinton McCombs [mailto:qmccombs@nequalsone.com]
Sent: 15 May 2003 16:38
To: 'Turbine Users List'
Subject: Need help with cookies


I am trying to get and set cookies using DefaultCookieParser.  The
cookie appears to be set corrrectly but it is not being read.  Bear in
mind, this is the first time I have ever tried to use cookies....


As the final step in my login action, I write an encrypted version to
the username and password to two cookies.  In my secure screen code, if
the user is not logged in, I try to read the cookies.  The idea here is
that if the user is not logged in, I will read the cookie and use the
info to log the user in without ever having to send them to the login
screen.

Code to write the cookie:  (encryption omitted ATM)

CookieParser cp = data.getCookies();
cp.set("NeoUserName", user.getName(), Integer.MAX_VALUE);
cp.set("NeoPassword", user.getPassword(), Integer.MAX_VALUE);

The above code should set two cookies.  Each are perm cookies and should
be set for the max duration.

Code to read the cookies:  (encryption omitted ATM)

CookieParser cp = data.getCookies();
String userName = cp.getString("NeoUserName");
String password = cp.getString("NeoPassword");
log.debug("userName = "+userName);
log.debug("password = "+password);

The log indicates that the username and password are both null.  I
verfied that the cookie were created.  They also contained the data I
expected to see.

Another interesting thing to see in the log file was the following line:

2003-05-14 17:54:05,784 [Thread-4] DEBUG
org.apache.turbine.util.parser.DefaultCookieParser- Number of Cookies: 1
2003-05-14 17:54:05,784 [Thread-4] DEBUG
org.apache.turbine.util.parser.DefaultCookieParser- Adding
jsessionid=CB507FCF4534205924779A3B8F84AF32

It found the jsessionid cookie and read it.  It just ignored my cookies.

Any ideas?
--------------------------------------------
Quinton McCombs
NequalsOne - HealthCare marketing tools
mailto:qmccombs@NequalsOne.com
http://www.NequalsOne.com


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Need help with cookies

Posted by Quinton McCombs <qm...@nequalsone.com>.
I am trying to get and set cookies using DefaultCookieParser.  The
cookie appears to be set corrrectly but it is not being read.  Bear in
mind, this is the first time I have ever tried to use cookies....


As the final step in my login action, I write an encrypted version to
the username and password to two cookies.  In my secure screen code, if
the user is not logged in, I try to read the cookies.  The idea here is
that if the user is not logged in, I will read the cookie and use the
info to log the user in without ever having to send them to the login
screen.

Code to write the cookie:  (encryption omitted ATM)

CookieParser cp = data.getCookies();
cp.set("NeoUserName", user.getName(), Integer.MAX_VALUE);
cp.set("NeoPassword", user.getPassword(), Integer.MAX_VALUE);

The above code should set two cookies.  Each are perm cookies and should
be set for the max duration.

Code to read the cookies:  (encryption omitted ATM)

CookieParser cp = data.getCookies();
String userName = cp.getString("NeoUserName");
String password = cp.getString("NeoPassword");
log.debug("userName = "+userName);
log.debug("password = "+password);

The log indicates that the username and password are both null.  I
verfied that the cookie were created.  They also contained the data I
expected to see.

Another interesting thing to see in the log file was the following line:

2003-05-14 17:54:05,784 [Thread-4] DEBUG
org.apache.turbine.util.parser.DefaultCookieParser- Number of Cookies: 1
2003-05-14 17:54:05,784 [Thread-4] DEBUG
org.apache.turbine.util.parser.DefaultCookieParser- Adding
jsessionid=CB507FCF4534205924779A3B8F84AF32

It found the jsessionid cookie and read it.  It just ignored my cookies.

Any ideas?
--------------------------------------------
Quinton McCombs
NequalsOne - HealthCare marketing tools
mailto:qmccombs@NequalsOne.com
http://www.NequalsOne.com 


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Using java bean in a turbine application

Posted by Pavel Kusch <pa...@icecentric.com>.
This is how you can get the name of the file you uploaded:

**********************************

FileItem fileItem = data.getParameters().getFileItem("file");

if (fileItem != null)

{

String fileName = fileItem.getFileName();


StringTokenizer toker=new StringTokenizer(fileName, "\\");


while (toker.hasMoreTokens() )

{

fileName= toker.nextToken();

}

}

*********************************
fileName then holds the name of the file. You save the file in database or
in your file system or ...


With regards,

Pavel Kusch
iceCentric
309.685.7900
309.264.2674
----- Original Message -----
From: "Keshava Murthy" <ke...@bigtec.org>
To: "Turbine Users List" <tu...@jakarta.apache.org>
Sent: Thursday, May 15, 2003 8:02 AM
Subject: Re: Using java bean in a turbine application


> Hi,
>
> I need to upload multiple images, files etc. From turbine application I
can
> upload one file at a time and when I upload next time that file is
replaced.
>
> Is there a way wherein I can upload multiple fies at a time and at the
same
> time save it with the same name as the uploaded ones. I just want the
> uploaded files to be added to the earlier uploaded files.
>
> I am using turbine 2.2 and if anybody has code for doing this kindly
forward
> it to me.
>
> regards,
> Keshava Murthy. S
> ----- Original Message -----
> From: "Peter Courcoux" <pe...@courcoux.biz>
> To: "Turbine Users List" <tu...@jakarta.apache.org>
> Sent: Thursday, May 15, 2003 4:04 PM
> Subject: Re: Using java bean in a turbine application
>
>
> > Turbine has its own upload service for turbine 2.2 which is replaced by
> > commons-fileupload for turbine 2.3. Both work well. These are integrated
> > services. Would they meet your needs?
> >
> > On Thu, 2003-05-15 at 11:19, Keshava Murthy wrote:
> > > Hi,
> > >
> > > I have downloaded a upload bean from www.javazoom.net and works fine
as
> an
> > > application. I want to use this bean in my turbine application. Can
some
> one
> > > guide me how can I do it ?
> > >
> > > regards,
> > > Keshava Murthy. S
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> > --
> > Peter Courcoux <pe...@courcoux.biz>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Using java bean in a turbine application

Posted by Keshava Murthy <ke...@bigtec.org>.
 Hi,

I need to upload multiple images, files etc. From turbine application I can
upload one file at a time and when I upload next time that file is replaced.

Is there a way wherein I can upload multiple fies at a time and at the same
time save it with the same name as the uploaded ones. I just want the
uploaded files to be added to the earlier uploaded files.

I am using turbine 2.2 and if anybody has code for doing this kindly forward
it to me.

regards,
Keshava Murthy. S
----- Original Message -----
From: "Peter Courcoux" <pe...@courcoux.biz>
To: "Turbine Users List" <tu...@jakarta.apache.org>
Sent: Thursday, May 15, 2003 4:04 PM
Subject: Re: Using java bean in a turbine application


> Turbine has its own upload service for turbine 2.2 which is replaced by
> commons-fileupload for turbine 2.3. Both work well. These are integrated
> services. Would they meet your needs?
>
> On Thu, 2003-05-15 at 11:19, Keshava Murthy wrote:
> > Hi,
> >
> > I have downloaded a upload bean from www.javazoom.net and works fine as
an
> > application. I want to use this bean in my turbine application. Can some
one
> > guide me how can I do it ?
> >
> > regards,
> > Keshava Murthy. S
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> --
> Peter Courcoux <pe...@courcoux.biz>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Using java bean in a turbine application

Posted by Peter Courcoux <pe...@courcoux.biz>.
Turbine has its own upload service for turbine 2.2 which is replaced by
commons-fileupload for turbine 2.3. Both work well. These are integrated
services. Would they meet your needs?

On Thu, 2003-05-15 at 11:19, Keshava Murthy wrote:
> Hi,
> 
> I have downloaded a upload bean from www.javazoom.net and works fine as an
> application. I want to use this bean in my turbine application. Can some one
> guide me how can I do it ?
> 
> regards,
> Keshava Murthy. S
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
-- 
Peter Courcoux <pe...@courcoux.biz>

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org