Re: Virtual Host configuration
Never really done this myself, but there is something about host aliases in the docs for 5.5: http://tomcat.apache.org/tomcat-5.5-doc/config/host.html#Host%20Name%20Aliases Does this help? Nic On 19/03/06, Matt Anderson <[EMAIL PROTECTED]> wrote: > > Hi All, > > I was configuring the virtual hosting using version 5.5.15 and I found > something different to what I remember. When I add a host for > www.somedomain.com.au and I then enter in http://somedomain.com.au it does > not work unless I add the www. at the beginning... To get around this I > added to hosts with the following names and this solution works. > > www.somedomain.com.au > somedomain.com > > but surely I am making some sort of mistake, why do I need to add the two > hosts in order to have the same address load the same web application. I > remeber in the past it did not matter, I added one and the other was > recognised. I am hoping I have explained it well enough and if anyone can > shed some light on this situation it would be greatly appreciated! Thanks > in > advance. > > Matt > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: Tomcat and Threads
You can also try using the TimerTask, as follows: In the context.xml create a bean as follows: The TimerBean can be very simple. I typically have an init(), destroy(), and setters for the parameters (setParam1, setParam2). The Bean needs to create a Timer and can be used to invoke a TimerTask. All this is explained pretty thoroughly in the jdk 1.5. To invoke the bean it can be done either through a servlet or a ServletListener. One of the nice things of doing it this way is that only one task will run at a time and it doesn't require much work to set up. I'd be curious to see what people think of this idea, because even though it works well for me there might be a better way. Richard Toren Christopher K. St. John wrote: On Sat, 18 Mar 2006 19:32:19 +0100 "Clemens Eisserer" <[EMAIL PROTECTED]> wrote: I've created a servlet wich creates some threads for doing background stuff. ... now I subscribed to a servlet-hosting service which uses a shared tomcat enviroment. How does tomcat handle these threads? Will they be destroyed by tomcat as soon as I click "stop" in Tomcat's application manager or will I have to take care about them? There's some good, in-depth discussion in the archives. It needs some updating, but: http://www.distributopia.com/servlet_stuff/background_threads.html is also reasonably informative. -cks -- Christopher St. John http://artofsystems.blogspot.com http://eventmirror.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Converting characters to "ascii" value
I know "Ascii value" isn't quite the correct term, but it's the only one I could come up with. What Im trying to come up with is the simplest way of coming up with the numeric value associated with a given character, and to go back the other direction as well. In VB, these are the ASC() and chr() functions. I know how to get these values by going through a Byte type, but is there a quicker way to get (for example): Starting with "B", return 66, or starting with " " (one space), return 32? Going the other way, 66 should return "B", and 32 should return " ". Thanks for any suggestions! DAve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Converting characters to "ascii" value
char is a numeric type. You might try this code as an example: char c = 32; c += '@'; if(c > 31) System.out.println(c + " = " + (int)c); The exception is it adds to strings as a character, thus the cast is needed. Regards, Artur - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Converting characters to "ascii" value
The first 127 characters of Unicode are in fact ASCII (might be the first 255, I'm not sure, but the first 127 for sure). In other words, it you do: int i = (int)'A'; will result in i=65, the ASCII value for A. char is a numeric type remember, so you don't really have to cast to int, I just did it that way to better illustrate what was happening. To go the other way, it's just: int i = 65; char c = (char)i; That assumes i<127. Frank David Kerber wrote: I know "Ascii value" isn't quite the correct term, but it's the only one I could come up with. What Im trying to come up with is the simplest way of coming up with the numeric value associated with a given character, and to go back the other direction as well. In VB, these are the ASC() and chr() functions. I know how to get these values by going through a Byte type, but is there a quicker way to get (for example): Starting with "B", return 66, or starting with " " (one space), return 32? Going the other way, 66 should return "B", and 32 should return " ". Thanks for any suggestions! DAve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Clean Install - examples do not work
Hi All, May be experts do not need the examples running but they seem to be broken for a long time as evidenced by several posts on the web. I could not get an answer as what is the fix. In tar file that I downloaded from Apache site has the truncated file name. $ tar tvf jakarta-tomcat-5.0.28.tar | grep functions_jsp.clas -rw-r--r-- 0 0 6445 Aug 28 19:02:24 2004 jakarta-tomcat-5.0.28/webapps/jsp-examples/WEB-INF/classes/org/apache/jsp/js p2/el/functions_jsp.clas The "functions_jsp.clas" is truncated. Many people have reported that on clean install, they get these exceptions. 2006-03-19 09:09:49 StandardContext[/jsp-examples]Exception starting filter Compression Filter java.lang.ClassNotFoundException: compressionFilters.CompressionFilter 2006-03-19 09:09:49 StandardContext[/servlets-examples]Exception starting filter Set Character Encoding java.lang.ClassNotFoundException: filters.SetCharacterEncodingFilter My environment is Aix 5.3 64 bit using IBM 5_64. Am I missing some settings? None of the examples in servletes-examples work as "resource is not available". I appreciate your help. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JNDI in embedded tomcat
Hi, All, I want to start tomcat by program, but I also need a JNDI data source. Could anyone tell me how to config a Tomcat JNDI data source by program, or any method let the data source configuration file work? Minilin
Re: Converting characters to "ascii" value
Thanks! Artur Rataj wrote: char is a numeric type. You might try this code as an example: char c = 32; c += '@'; if(c > 31) System.out.println(c + " = " + (int)c); The exception is it adds to strings as a character, thus the cast is needed. Regards, Artur - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Converting characters to "ascii" value
I've never used char types; I'm so used to using Strings I don't even think of it. Thanks! Frank W. Zammetti wrote: The first 127 characters of Unicode are in fact ASCII (might be the first 255, I'm not sure, but the first 127 for sure). In other words, it you do: int i = (int)'A'; will result in i=65, the ASCII value for A. char is a numeric type remember, so you don't really have to cast to int, I just did it that way to better illustrate what was happening. To go the other way, it's just: int i = 65; char c = (char)i; That assumes i<127. Frank David Kerber wrote: I know "Ascii value" isn't quite the correct term, but it's the only one I could come up with. What Im trying to come up with is the simplest way of coming up with the numeric value associated with a given character, and to go back the other direction as well. In VB, these are the ASC() and chr() functions. I know how to get these values by going through a Byte type, but is there a quicker way to get (for example): Starting with "B", return 66, or starting with " " (one space), return 32? Going the other way, 66 should return "B", and 32 should return " ". Thanks for any suggestions! DAve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Converting characters to "ascii" value
Hum... I am missing something or you just want to cast a char to a byte/int in Java? char x = 'B'; // or "Bravo".charAt(0) if you start with a string byte y = (byte) x; System.out.println("y=" + y); // should give you 66 and vice-versa: char z = (char) y; System.out.println("z=" + z); // should give you B The only thing you need to watch is the byte number, I think you get a number between -128 and +127, so you may need to adjuct depending on your needs. BTW I've not tested the code above, I'm just typing it as I speak. HTH Nic On 19/03/06, David Kerber <[EMAIL PROTECTED]> wrote: > > I know "Ascii value" isn't quite the correct term, but it's the only one > I could come up with. > > What Im trying to come up with is the simplest way of coming up with the > numeric value associated with a given character, and to go back the > other direction as well. In VB, these are the ASC() and chr() > functions. I know how to get these values by going through a Byte type, > but is there a quicker way to get (for example): > > Starting with "B", return 66, or starting with " " (one space), return 32? > Going the other way, 66 should return "B", and 32 should return " ". > > Thanks for any suggestions! > DAve > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: Converting characters to "ascii" value
Not a char, a String (or more specifically, a specific character extracted from a String). Nic Daniau wrote: Hum... I am missing something or you just want to cast a char to a byte/int in Java? char x = 'B'; // or "Bravo".charAt(0) if you start with a string byte y = (byte) x; System.out.println("y=" + y); // should give you 66 and vice-versa: char z = (char) y; System.out.println("z=" + z); // should give you B The only thing you need to watch is the byte number, I think you get a number between -128 and +127, so you may need to adjuct depending on your needs. BTW I've not tested the code above, I'm just typing it as I speak. HTH Nic On 19/03/06, David Kerber <[EMAIL PROTECTED]> wrote: I know "Ascii value" isn't quite the correct term, but it's the only one I could come up with. What Im trying to come up with is the simplest way of coming up with the numeric value associated with a given character, and to go back the other direction as well. In VB, these are the ASC() and chr() functions. I know how to get these values by going through a Byte type, but is there a quicker way to get (for example): Starting with "B", return 66, or starting with " " (one space), return 32? Going the other way, 66 should return "B", and 32 should return " ". Thanks for any suggestions! DAve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Converting characters to "ascii" value
To be more specific than my last message, my ultimate goal is to be able to do something like: String myString = "ABCDEFG" Integer myInt = myString.whateverMethod( myString.substring( 1, 2 )) // should return 66 I can do this by going through a byte[], but was looking for a more straight forward method, something like VB's asc() function: In VB: myInt = asc( mid$( myString, 2,1)) // returns 66 Integer myInt = myString.asc( myString.substring( 1, 2 )) // would return 66 if the asc() method existed Nic Daniau wrote: Hum... I am missing something or you just want to cast a char to a byte/int in Java? char x = 'B'; // or "Bravo".charAt(0) if you start with a string byte y = (byte) x; System.out.println("y=" + y); // should give you 66 and vice-versa: char z = (char) y; System.out.println("z=" + z); // should give you B The only thing you need to watch is the byte number, I think you get a number between -128 and +127, so you may need to adjuct depending on your needs. BTW I've not tested the code above, I'm just typing it as I speak. HTH Nic On 19/03/06, David Kerber <[EMAIL PROTECTED]> wrote: I know "Ascii value" isn't quite the correct term, but it's the only one I could come up with. What Im trying to come up with is the simplest way of coming up with the numeric value associated with a given character, and to go back the other direction as well. In VB, these are the ASC() and chr() functions. I know how to get these values by going through a Byte type, but is there a quicker way to get (for example): Starting with "B", return 66, or starting with " " (one space), return 32? Going the other way, 66 should return "B", and 32 should return " ". Thanks for any suggestions! DAve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
UserDatabase with something else than a basic MemoryUserDatabase
Hi, I'm trying to configure Tomcat (5.5) with a DataSource realm the "proper" way. Configuring a DataSourceRealm directly is fine http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html#List%20Available%20Security%20Roles>. But also to conform with the sample server.xml given at install, which configures a MemoryUserDatabase first and then point the realm to this UserDatabse, which seams to make sense in the J2EE kind of approach. Anyway, in order to do this you need some sort of UserDatabase factory. But when you look in the API in org.apache.catalina.users, o deception! the only factory you can find is MemoryUserDatabaseFactory... no DataSourceUserDatabaseFactory or even JDBCUserDatabaseFactory as you would logically expect?... As we know MemoryRealm (and MemoryUserDatabase) is fairly useless in a production environment, so why would they have been to all the trouble of coming up with this UserDatabase thing if no corresponding implementation exists for the other realm types? That's when I say: I must be missing something reeeally obvious here... Any help welcome! Cheers, Nic
programatic jaas authentication
Hi Everybody, I got working container JAAS authentication (area protected by url set in web.xml), I also know how to authenticate against JAAS. But what I cannot sort out is how to programatically force container to authenticate (from login dialog), i.e., how to get principal to the session/http request. I use JSF. Any idea? Thanks a lot Jan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Converting characters to "ascii" value
> Integer myInt = myString.asc( myString.substring( 1, 2 )) // would > return 66 if the asc() method existed int b = (int)myString.charAt(1); or, in 1.5 int b = (int)(myString.substring(1,2).charAt(0))); ? in java you don't need asc, since each char can be assign to an integer an vice versa Leon On 3/19/06, David Kerber <[EMAIL PROTECTED]> wrote: > To be more specific than my last message, my ultimate goal is to be able > to do something like: > > String myString = "ABCDEFG" > Integer myInt = myString.whateverMethod( myString.substring( 1, 2 )) > // should return 66 > > I can do this by going through a byte[], but was looking for a more > straight forward method, something like VB's asc() function: > > In VB: > myInt = asc( mid$( myString, 2,1)) // returns 66 > > Integer myInt = myString.asc( myString.substring( 1, 2 )) // would > return 66 if the asc() method existed > > > > Nic Daniau wrote: > > >Hum... I am missing something or you just want to cast a char to a byte/int > >in Java? > > > >char x = 'B'; // or "Bravo".charAt(0) if you start with a string > >byte y = (byte) x; > >System.out.println("y=" + y); // should give you 66 > > > >and vice-versa: > >char z = (char) y; > >System.out.println("z=" + z); // should give you B > > > >The only thing you need to watch is the byte number, I think you get a > >number between -128 and +127, so you may need to adjuct depending on your > >needs. > > > >BTW I've not tested the code above, I'm just typing it as I speak. > > > >HTH > >Nic > > > >On 19/03/06, David Kerber <[EMAIL PROTECTED]> wrote: > > > > > >>I know "Ascii value" isn't quite the correct term, but it's the only one > >>I could come up with. > >> > >>What Im trying to come up with is the simplest way of coming up with the > >>numeric value associated with a given character, and to go back the > >>other direction as well. In VB, these are the ASC() and chr() > >>functions. I know how to get these values by going through a Byte type, > >>but is there a quicker way to get (for example): > >> > >>Starting with "B", return 66, or starting with " " (one space), return 32? > >>Going the other way, 66 should return "B", and 32 should return " ". > >> > >>Thanks for any suggestions! > >>DAve > >> > >> > >> > >>- > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > >> > >> > > > > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Best eclipse plugin for tomcat development
--- Richard Mixon <[EMAIL PROTECTED]> wrote: > Dola, > > For the last couple of years I have used the Sysdeo > plugin with good > success. > > But since December the all-in-one bundle of Eclipse > with the Eclipse Web > Tools Project has been available. This is a > completely integrated build that > does not require installation of plugins. Not only > does it run Tomcat with > integrated debugger, but has decent JSP, HTML and > Javascript editors. Also > there was a nice step by step tutorial in a recent > JDJ edition. > > Here are the links: > > http://download.eclipse.org/webtools/downloads/drops/R-1.0-200512210855/ > > Arguably there are better individual pieces, or even > bundled combinations > such as MyEclipse and others, but IMHO this is > probably the easiest way to > get going. > > HTH - Richard > > > -Original Message- > From: Dola Woolfe [mailto:[EMAIL PROTECTED] > Sent: Friday, March 17, 2006 9:45 AM > To: Tom Cat > Subject: Best eclipse plugin for tomcat development > > Hi, > > Following the advice of the mailing lists members, > I'm trying to work with > Eclipse. I've learned that to do tomcat development > I need to download an > appropriate plugin and that there are seveal to > choose from. Can someone > recommend a good one (or is there a best one, or the > most common one)? > > Thanks! > > Dola This doesn't exactly answer your question, but I use Netbeans a lot for development of Web applications and Java UIs. Netbeans has built in support for Tomcat straight out of install without adding any extra plugins, and you can install other modules for JBoss and Sun Application Server, and there may be others. You might give it a try. I haven't used Eclipse much myself. Wade - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Converting characters to "ascii" value
String myString = "ABCDEFG"; int myInt = (int)myString.charAt(1); Even simpler than VB :) Frank David Kerber wrote: To be more specific than my last message, my ultimate goal is to be able to do something like: String myString = "ABCDEFG" Integer myInt = myString.whateverMethod( myString.substring( 1, 2 )) // should return 66 I can do this by going through a byte[], but was looking for a more straight forward method, something like VB's asc() function: In VB: myInt = asc( mid$( myString, 2,1)) // returns 66 Integer myInt = myString.asc( myString.substring( 1, 2 )) // would return 66 if the asc() method existed Nic Daniau wrote: Hum... I am missing something or you just want to cast a char to a byte/int in Java? char x = 'B'; // or "Bravo".charAt(0) if you start with a string byte y = (byte) x; System.out.println("y=" + y); // should give you 66 and vice-versa: char z = (char) y; System.out.println("z=" + z); // should give you B The only thing you need to watch is the byte number, I think you get a number between -128 and +127, so you may need to adjuct depending on your needs. BTW I've not tested the code above, I'm just typing it as I speak. HTH Nic On 19/03/06, David Kerber <[EMAIL PROTECTED]> wrote: I know "Ascii value" isn't quite the correct term, but it's the only one I could come up with. What Im trying to come up with is the simplest way of coming up with the numeric value associated with a given character, and to go back the other direction as well. In VB, these are the ASC() and chr() functions. I know how to get these values by going through a Byte type, but is there a quicker way to get (for example): Starting with "B", return 66, or starting with " " (one space), return 32? Going the other way, 66 should return "B", and 32 should return " ". Thanks for any suggestions! DAve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
UTF-8 2019 (right single quote) incorrect display
Hello List... my first attempt at i18n is failing. I've converted MS smart quotes to utf 2019 symbol (right single quote) in my VIM editor after setting encoding to UTF-8. The quote displays ok in vim but in the browser it displays badly ( in firefox - a+circumflex, and IE - a+circumflex+garbage ). The http servlet response content type character set is UTF-8. I don't understand where I'm losing the utf encoding of the text. Any assistance is greatly appreciated. Tomcat 5.0.28 on FreeBSD. Many thanks /j-p. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
tomcat examples
Hello, I am trying to learn using tomcat and writing servlets. After I installed Tomcat 5.5.16 for windows and pointed my browser to localhost:8080, I can see the tomcat page. However, when I try to access "JSP examples" or "servlet examples" in the left panel menu, I get a 404 page (The requested resource is not available). Similarly, when I choose "Tomcat manager" link on the left, the jsp-examples and servlets-examples applications are shown not running and cannot be started. Can someone advise? Also, is there a way to have a non-default location of the pages to be served (i.e. other than $CATALINA_HOME/webapps/ROOT/)? KK. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat and Threads
Hi again, > There's some good, in-depth discussion in the archives. It > needs some updating, but: > http://www.distributopia.com/servlet_stuff/background_threads.html > > is also reasonably informative. Thanks a lot for mentioning this article - wow i think i could have caused troubles on my hoster's server ;) Since I need to deploy to many different servlet-containers (some of them are seriously broken) I chose the do-it-yourself way. SingleTon-designed Thread-Manager which stops all threads in destroy. Thanks for the tip, lg Clemens - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Somewhat OT: Multiple auth methods in one webapp?
On 3/17/06, Mark Lowe <[EMAIL PROTECTED]> wrote: > Thats the 2.3 and 2.4 specs btw.. the 2.2 doesn't have section 12.5 > and the authentication section is section 11.. > > Anyhow without getting into all that cellar dwelling, i dont think > that there's a restriction on the amount of securit contraints you can > configure along with login-config's .. Not sure whether you can have 2 > realms for 1 webapp in websphere, i'd imagine so.. On reflection this will be a big fat pain in the arse at the session attribute used by the container is the subject or principal... session.setAttribute(subject,subject).. or something like that. Having 2 realms even if theoretically possible would be a pain because you secondary auth would overwrite the first. If you wanted to restrict access to a service via a second login form, if the user messed up this login it could invalidate his/her existing login which could be behaviour you dont want. Even if you ensured that the seocnd login put all the bits and peices from the first login, you could find behaviour you dont want.. Mark > > Mark > > On 3/16/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: > > On Thu, March 16, 2006 2:26 pm, Caldarale, Charles R said: > > >> From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] > > >> Subject: RE: Somewhat OT: Multiple auth methods in one webapp? > > >> > > >> Do you know, or does anyone else know, where the server > > >> looks for the credentials when the challenge box has > > >> been submitted? > > > > > > See section 12.5 of the Servlet spec (you probably have that memorized > > > by now) and RFC 2617, which covers both Basic and Digest authentication > > > for HTTP. > > > > Thanks Chuck, saves me the time to find it. > > > > But no, I'm not the guy that memorizes specs, that is very clearly Craig > > McClanahan's title :) The man's instant recall of spec is astounding! > > > > > - Chuck > > > > Frank > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Converting characters to "ascii" value
Indeed it is! Frank W. Zammetti wrote: String myString = "ABCDEFG"; int myInt = (int)myString.charAt(1); Even simpler than VB :) Frank David Kerber wrote: To be more specific than my last message, my ultimate goal is to be able to do something like: String myString = "ABCDEFG" Integer myInt = myString.whateverMethod( myString.substring( 1, 2 )) // should return 66 I can do this by going through a byte[], but was looking for a more straight forward method, something like VB's asc() function: In VB: myInt = asc( mid$( myString, 2,1)) // returns 66 Integer myInt = myString.asc( myString.substring( 1, 2 )) // would return 66 if the asc() method existed Nic Daniau wrote: Hum... I am missing something or you just want to cast a char to a byte/int in Java? char x = 'B'; // or "Bravo".charAt(0) if you start with a string byte y = (byte) x; System.out.println("y=" + y); // should give you 66 and vice-versa: char z = (char) y; System.out.println("z=" + z); // should give you B The only thing you need to watch is the byte number, I think you get a number between -128 and +127, so you may need to adjuct depending on your needs. BTW I've not tested the code above, I'm just typing it as I speak. HTH Nic On 19/03/06, David Kerber <[EMAIL PROTECTED]> wrote: I know "Ascii value" isn't quite the correct term, but it's the only one I could come up with. What Im trying to come up with is the simplest way of coming up with the numeric value associated with a given character, and to go back the other direction as well. In VB, these are the ASC() and chr() functions. I know how to get these values by going through a Byte type, but is there a quicker way to get (for example): Starting with "B", return 66, or starting with " " (one space), return 32? Going the other way, 66 should return "B", and 32 should return " ". Thanks for any suggestions! DAve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Clean Install - examples do not work
> From: Vikram [mailto:[EMAIL PROTECTED] > Subject: Clean Install - examples do not work > > In tar file that I downloaded from Apache site has the > truncated file name. There's nothing wrong with the tar file - use a real (GNU-compatible) tar utility. If you'd looked at the README you would have found this: NOTE: The tar files in this distribution use GNU tar extensions, and must be untarred with a GNU compatible version of tar. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: tomcat examples
> From: Konstantin L Kouptsov [mailto:[EMAIL PROTECTED] > Subject: tomcat examples > However, when I try to access "JSP examples" or "servlet > examples" in the left panel menu, I get a 404 page Sounds like something in your installation failed to complete, or perhaps you've got a file permissions problem. If you're running Tomcat as a service, does the account it's running under have access to all of the directories in the installation path? You might try looking at the directory structure from the .zip download and make sure you've got everything. > Also, is there a way to have a non-default location > of the pages to be served (i.e. other than > $CATALINA_HOME/webapps/ROOT/)? RTFM: http://tomcat.apache.org/tomcat-5.5-doc/appdev/index.html http://tomcat.apache.org/tomcat-5.5-doc/config/index.html In particular, look at the doc for and , and read the Servlet spec. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: UserDatabase with something else than a basic MemoryUserDatabase
Yeah, well, UserDatabase didn't really attract many followers :). It's a nice concept, with a really s*cky implementation (esp. how it works with /admin :). At one point, there was an attempt at a JDBC UserDatabase, but it fizzled. Short story: You're not missing anything. UserDatabase is currently the unloved orphaned child of Tomcat ;-). "Nic Daniau" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, I'm trying to configure Tomcat (5.5) with a DataSource realm the "proper" way. Configuring a DataSourceRealm directly is fine http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html#List%20Available%20Security%20Roles>. But also to conform with the sample server.xml given at install, which configures a MemoryUserDatabase first and then point the realm to this UserDatabse, which seams to make sense in the J2EE kind of approach. Anyway, in order to do this you need some sort of UserDatabase factory. But when you look in the API in org.apache.catalina.users, o deception! the only factory you can find is MemoryUserDatabaseFactory... no DataSourceUserDatabaseFactory or even JDBCUserDatabaseFactory as you would logically expect?... As we know MemoryRealm (and MemoryUserDatabase) is fairly useless in a production environment, so why would they have been to all the trouble of coming up with this UserDatabase thing if no corresponding implementation exists for the other realm types? That's when I say: I must be missing something reeeally obvious here... Any help welcome! Cheers, Nic - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat examples
Thanks for the answer. As far as the second part is concerned, I found that I needed to stick docBase="C:\bar" workDir="C:\bar\work" /> in the $CATALINA_HOME/conf/server.xml file, and it works. As far as examples are concented, I have installed everything, so the examples with all the files are in place, e.g. in $CATALINA_HOME/webapps/jsp-examples. Tomcat is running as a service, "Local system". I am accessing from the local computer, so that should work. As appears, any valid thing placed in $CATALINA_HOME/webapps works, except these two: jsp-examples and servlets-examples. Any more suggestions? Konstantin. Caldarale, Charles R wrote: From: Konstantin L Kouptsov [mailto:[EMAIL PROTECTED] Subject: tomcat examples However, when I try to access "JSP examples" or "servlet examples" in the left panel menu, I get a 404 page Sounds like something in your installation failed to complete, or perhaps you've got a file permissions problem. If you're running Tomcat as a service, does the account it's running under have access to all of the directories in the installation path? You might try looking at the directory structure from the .zip download and make sure you've got everything. Also, is there a way to have a non-default location of the pages to be served (i.e. other than $CATALINA_HOME/webapps/ROOT/)? RTFM: http://tomcat.apache.org/tomcat-5.5-doc/appdev/index.html http://tomcat.apache.org/tomcat-5.5-doc/config/index.html In particular, look at the doc for and , and read the Servlet spec. - Chuck - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat examples
I have the same problem here. And below is the error from the log file for my case. Anybody body know what is wrong ? Mar 20, 2006 12:29:31 AM org.apache.catalina.core.StandardContext listenerStart SEVERE: Error configuring application listener of class listeners.ContextListener java.lang.ClassFormatError: Extra bytes at the end of class file listeners/ContextListener at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1812) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:866) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1319) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3677) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4183) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1112) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021) at org.apache.catalina.core.StandardHost.start(StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442) at org.apache.catalina.core.StandardService.start(StandardService.java:450) at org.apache.catalina.core.StandardServer.start(StandardServer.java:709) at org.apache.catalina.startup.Catalina.start(Catalina.java:551) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) -- View this message in context: http://www.nabble.com/tomcat-examples-t1307951.html#a3487646 Sent from the Tomcat - User forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 5.5.16 - Error configuring application listener of class listeners.ContextListener
I have the same problem here. Have you managed to solved your problem ? Rudy -- View this message in context: http://www.nabble.com/Tomcat-5.5.16---Error-configuring-application-listener-of-class-listeners.ContextListener-t1292922.html#a3487618 Sent from the Tomcat - User forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: tomcat examples
> From: Konstantin L Kouptsov [mailto:[EMAIL PROTECTED] > Subject: Re: tomcat examples > > Thanks for the answer. As far as the second part is > concerned, I found that I needed to stick path="/foo" reloadable="true" docBase="C:\bar" > workDir="C:\bar\work" /> in the > $CATALINA_HOME/conf/server.xml file, and it works. I see you ignored this bold-face note in the doc: Please note that for tomcat 5, unlike tomcat 4.x, it is NOT recommended to place elements directly in the server.xml file. Instead, put them in the META-INF/context.xml directory of your WAR file or the conf directory as described above. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: tomcat examples
> From: erha [mailto:[EMAIL PROTECTED] > Subject: Re: tomcat examples > > I have the same problem here. No, you have a completely different problem. > And below is the error from the log file for my case. Anybody > body know what is wrong ? > > java.lang.ClassFormatError: Extra bytes at the end of class file > listeners/ContextListener As I stated before: that class file is bad. It appears to be one you created, not from the Tomcat installation. You need to recompile it or otherwise correct it. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat 5.5.16 - Confirmation of " Extra bytes at the end of class file listeners/ContextListener" error
I have confirmed this error on a clean XP install (completely virgin, nothing but up to date patches installed) with clean JDK 1.5_06 setup. The installer ID'ed the JRE correctly and tray applet is running. This problem is repeatable on many various XP installs, real and virtual, dev and non-dev. Tomcat 5.0.x runs fine on the same machines. adam... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Somewhat OT: Multiple auth methods in one webapp?
FYI, I did a little research... the 2.4 DTD states the affinity of the element as ?, so you are allowed at most a single auth method. So, while you can of course configure as many constraints as you want, they all must share the same method, one per context. This means that, in answer to my original question, the only way I can do it if I want the Web Services to be in the same context is to write a filter to do basic auth. Frank Mark Lowe wrote: On 3/17/06, Mark Lowe <[EMAIL PROTECTED]> wrote: Thats the 2.3 and 2.4 specs btw.. the 2.2 doesn't have section 12.5 and the authentication section is section 11.. Anyhow without getting into all that cellar dwelling, i dont think that there's a restriction on the amount of securit contraints you can configure along with login-config's .. Not sure whether you can have 2 realms for 1 webapp in websphere, i'd imagine so.. On reflection this will be a big fat pain in the arse at the session attribute used by the container is the subject or principal... session.setAttribute(subject,subject).. or something like that. Having 2 realms even if theoretically possible would be a pain because you secondary auth would overwrite the first. If you wanted to restrict access to a service via a second login form, if the user messed up this login it could invalidate his/her existing login which could be behaviour you dont want. Even if you ensured that the seocnd login put all the bits and peices from the first login, you could find behaviour you dont want.. Mark Mark On 3/16/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: On Thu, March 16, 2006 2:26 pm, Caldarale, Charles R said: From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Subject: RE: Somewhat OT: Multiple auth methods in one webapp? Do you know, or does anyone else know, where the server looks for the credentials when the challenge box has been submitted? See section 12.5 of the Servlet spec (you probably have that memorized by now) and RFC 2617, which covers both Basic and Digest authentication for HTTP. Thanks Chuck, saves me the time to find it. But no, I'm not the guy that memorizes specs, that is very clearly Craig McClanahan's title :) The man's instant recall of spec is astounding! - Chuck Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
java.lang.IllegalStateException
When i try to delete a record my tomcat gives following error error: java.lang.IllegalStateException my code fo delete is <% if(del!=null) { System.out.println("in delete"); if(Item_con == null ) { throw new Exception() ; } Item_stmt=Item_con.createStatement(); str = "Delete FROM items where ItemName='" + Name +"'"; System.out.println("this is "+Item_stmt.executeUpdate(str)); System.out.println("record deleted"); Item_con.close(); System.out.println("con closed"); %> -- Cup of Java + Suger of XML = Secure WebApp
Re: Tomcat and Threads
Hello, I had the same question in my mind some time ago. I have a web application which creates a timer in a context listener init(), which wakes up in 30seconds or so, and destroys the timer in context listener destroy(). It should complete its processing before server stops, so I did some experiments. If I use Timer and TimerTask in J2SE, stopping the application does not wait timer task to complete if its running (it is a behaviour we can guess), however timer task is not killed and it is completed after context listener destroy() finishes. The situation is different if you stop tomcat, where timer and its associated task if its running is killed immediately. In windows, tomcat monitor has a timeout parameter, I think this adjust the time it should wait for all user threads to die. I dont know if there is such a parameter in *nix environments. Since I need to wait for Task to complete, I do it by putting some synchronization controls when destroying timer. This solves the problem if you only stop the application. However, stopping tomcat still kills the thread in windows environment, so I adjust the timeout parameter to a reasonable value (this may be an issue on windows platforms only, I remember stopping tomcat in linux waits for threads if you do some synchronization). Later, I moved to Quartz framework which has a stop function which waits for task to complete. Surprisingly, stopping tomcat also waits for timer tasks (jobs) if I use Quartz (even with zero timeout on windows). So, it is clear I miss a big point when I use my own Timer/TimerTask and thread controls. I did those experiments some time ago, some points may be wrong or out of date. You can easily try it by yourself. Best regards, Mete -Original Message- From: Clemens Eisserer [mailto:[EMAIL PROTECTED] Sent: Saturday, March 18, 2006 8:32 PM To: users@tomcat.apache.org Subject: Tomcat and Threads Hello, I've created a servlet wich creates some threads for doing background stuff. Till now I never worried about these thread since I was runnning this servlet only on my own servers. However now I subscribed to a servlet-hosting service which uses a shared tomcat enviroment. How does tomcat handle these threads? Will they be destroyed by tomcat as soon as I click "stop" in Tomcat's application manager or will I have to take care about them? Thank you in advance, lg Clemens - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Hosting providers
I use : http://www.eapps.com And also used http://www.spinweb.net both have different offers ranging to Virtual Private Servers to Dedicated ones. they also have both great expertise and support. Note that eapps.com is an official; JBoss partner, thus providing full support of Tomcat. Hopes this helps. With Best Regards Bruno Georges Glencore International AG Tel. +41 41 709 3204 Fax +41 41 709 3000 |-+---> | | Morten Andersen | | | <[EMAIL PROTECTED]| | | m> | | | | | | 18.03.06 09:21 | | | Please respond | | | to "Tomcat Users| | | List" | | | | |-+---> >-| | | |To: Tomcat Users List | |cc: | |Subject: [OT] Hosting providers | | | |Distribute: | |Personal? |---| | || [ ] x | | ||---| | | | >-| I have developed a webapplication that I need hosting for. Here is my requirements: - Multihoming easy and possible without restart - Multiple domains allowed - Personal JVM - 24/7 support Where should I look? Any recommendations? Morten Andersen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] LEGAL DISCLAIMER. The contents of this e-mail and any attachments are strictly confidential and they may not be used or disclosed by someone who is not a named recipient. If you have received this email in error please notify the sender by replying to this email inserting the word "misdirected" as the message and delete this e-mail from your system. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]