Question for Bruno Re: Forwarding Domains
Hi Bruno, I am NOT using apache in front of tomcat. Sorry. I really like standalone tomcat. So I would like to learn more about the first solution you described here. However, I do not understand it at all. What exacty do you mean, and where can I read/learn about it? Second question--in the discussion thread titled something like [one tomcat + multiple ip's] I tried the proposed solution and have asked if it is suitable/safe for production environment. Do you have any input on the question? Justin --- Bruno Georges [EMAIL PROTECTED] wrote: Hi justin You can achieve url forwarding/rewriting using a simple servlet filter, or better if you have apache in the front, use mod-rewrite, which is configurable in your httpd.conf. If you are using iis, there are few available isapi filter which you can use, alternatively you can write your own, which reacts on the preprocheaders or urlmap notifications. Hope this helps. Bruno Georges Bruno Georges Glencore International AG Tel. +41 41 709 3204 Fax +41 41 709 3000 - Original Message - From: Justin Jaynes [EMAIL PROTECTED] Sent: 01.08.2005 23:53 To: tomcat-user@jakarta.apache.org Subject: Forwarding Domains Is it possible for me to host somedomain.com on my tomcat, and as that is my prefered domain name format, and want all users who go to www.somedomain.com (YES, I have A records set up for both and they point to the same tomcat server) to be re-directed to somedomain.com, using my tomcat setup? In other words, I want to move all my users from the domain they enter to a domain I prefer USING my tomcat setup. I imagine there is some way to set up my server.xml to do it. Justin Thanks in advance. I have never had an issue unresolved after submitting to this list. Bravo! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] * * LEGAL DISCLAIMER * This message contains confidential information for * the exclusive use of the person mentioned above. * - 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: Forwarding Domains
Sorry, there is no way out of the box. But there are filters which can do this for you. For example: http://tuckey.org/urlrewrite/ -Tim Justin Jaynes wrote: Is it possible for me to host somedomain.com on my tomcat, and as that is my prefered domain name format, and want all users who go to www.somedomain.com (YES, I have A records set up for both and they point to the same tomcat server) to be re-directed to somedomain.com, using my tomcat setup? In other words, I want to move all my users from the domain they enter to a domain I prefer USING my tomcat setup. I imagine there is some way to set up my server.xml to do it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forwarding Domains
Hi justin You can achieve url forwarding/rewriting using a simple servlet filter, or better if you have apache in the front, use mod-rewrite, which is configurable in your httpd.conf. If you are using iis, there are few available isapi filter which you can use, alternatively you can write your own, which reacts on the preprocheaders or urlmap notifications. Hope this helps. Bruno Georges Bruno Georges Glencore International AG Tel. +41 41 709 3204 Fax +41 41 709 3000 - Original Message - From: Justin Jaynes [EMAIL PROTECTED] Sent: 01.08.2005 23:53 To: tomcat-user@jakarta.apache.org Subject: Forwarding Domains Is it possible for me to host somedomain.com on my tomcat, and as that is my prefered domain name format, and want all users who go to www.somedomain.com (YES, I have A records set up for both and they point to the same tomcat server) to be re-directed to somedomain.com, using my tomcat setup? In other words, I want to move all my users from the domain they enter to a domain I prefer USING my tomcat setup. I imagine there is some way to set up my server.xml to do it. Justin Thanks in advance. I have never had an issue unresolved after submitting to this list. Bravo! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] * * LEGAL DISCLAIMER * This message contains confidential information for * the exclusive use of the person mentioned above. * - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forwarding Domains
Hi justin You can achieve url forwarding/rewriting using a simple servlet filter, or better if you have apache in the front, use mod-rewrite, which is configurable in your httpd.conf. If you are using iis, there are few available isapi filter which you can use, alternatively you can write your own, which reacts on the preprocheaders or urlmap notifications. Hope this helps. Bruno Georges Bruno Georges Glencore International AG Tel. +41 41 709 3204 Fax +41 41 709 3000 - Original Message - From: Justin Jaynes [EMAIL PROTECTED] Sent: 01.08.2005 23:53 To: tomcat-user@jakarta.apache.org Subject: Forwarding Domains Is it possible for me to host somedomain.com on my tomcat, and as that is my prefered domain name format, and want all users who go to www.somedomain.com (YES, I have A records set up for both and they point to the same tomcat server) to be re-directed to somedomain.com, using my tomcat setup? In other words, I want to move all my users from the domain they enter to a domain I prefer USING my tomcat setup. I imagine there is some way to set up my server.xml to do it. Justin Thanks in advance. I have never had an issue unresolved after submitting to this list. Bravo! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] * * LEGAL DISCLAIMER * This message contains confidential information for * the exclusive use of the person mentioned above. * - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: forwarding (and adding to) a request to another server
Please take me off your mailing list. I don't know what the hell you are talking about. I got on this mailing list by error and it is way beyond my comprehension. WARREN TAYLOR Sunbelt Business Advisors Sunbelt Business Brokers of MS www.sunbeltnetwork.com -Original Message- From: Robert Koberg [mailto:[EMAIL PROTECTED] Sent: Thursday, July 21, 2005 3:52 PM To: Tomcat Users List Subject: forwarding (and adding to) a request to another server Hi, I have a secure webapp (main portal) in Tomcat that calls webservices for authentication. There are other *existing* apps on different servers. All users log in to all apps through my app (single sign on). When a user clicks a link in my app that is to go to another secure app, I need to call a web service to get authentication info for that particular app. Then, POST the authentication info to the other server and have the requested page show in the browser. Is there some way to: 1. get the request in a Filter 2. call the webservice and get auth info 3. redirect/forward/open-a-url-conn to POST the auth info as form data to another app 4. finally, have the other app's page show in the user's browser ? Anybody done anything like this? Any ideas? Is it possible? I could do this with JavaScript by building the form for each page that have these secure link types. But, it complicates things a great deal because I would need to call the webservice and put the auth info (encrypted strings) on the page even though the user may never click the link. any ideas, -Rob - 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: forwarding (and adding to) a request to another server
Warren Taylor wrote: Please take me off your mailing list. I don't know what the hell you are talking about. I got on this mailing list by error and it is way beyond my comprehension. Can you read the bottom of the post to this mail list? - 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: Forwarding *all* webapps with mod_jk
Simon MARTIN wrote: Hi, I've integrated Tomcat successfully into Apache using mod_jk, but there's something I've found nothing about: forwarding *all* webapps with only one static statement in the configuration files. I've thought about something like this: JkMount /tomcat/* ajp13:* (which of course is wrong I know) You can use the mod_rewrite: RewriteEngine On RewriteRule ^/tomcat/(.+)$ /$1 [R,L] JkMount /* ajp13 But this will map everything to the tomcat. You can not do (for now): /tomcat/examples/* - /examples/* and then back to: /examples/* - /tomcat/examples/* This would require that mod_jk when forwarding the request to Tomcat strips the '/tomcat' from the URL, and then after receiving the response add the '/tomcat' prefix to the url. Of course you will be forced to use only the relative url's inside your application, so the usage is dubious. Mladen. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forwarding *all* webapps with mod_jk
Mladen Turk wrote: Simon MARTIN wrote: Hi, I've integrated Tomcat successfully into Apache using mod_jk, but there's something I've found nothing about: forwarding *all* webapps with only one static statement in the configuration files. I've thought about something like this: JkMount /tomcat/* ajp13:* (which of course is wrong I know) You can use the mod_rewrite: RewriteEngine On RewriteRule ^/tomcat/(.+)$ /$1 [R,L] JkMount /* ajp13 But this will map everything to the tomcat. You can not do (for now): /tomcat/examples/* - /examples/* and then back to: /examples/* - /tomcat/examples/* This would require that mod_jk when forwarding the request to Tomcat strips the '/tomcat' from the URL, and then after receiving the response add the '/tomcat' prefix to the url. Of course you will be forced to use only the relative url's inside your application, so the usage is dubious. Mladen. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Could he not do something like this...doesn't mod_jk now have the mod_jk2 stuff in it? I do this in mod_jk2 in the workers2.properties file #this will allow all rsg servlets to be run through tomcat. [uri:/*.jrsg] info=jrsg (extension for RSG controller servlets) context=/ I give all of my servlets an extension in their name. Though I assume this could be done like: #this will allow all rsg servlets to be run through tomcat. [uri:/*servlet*] info= for all servlets in a servlet directory context=/ I then make sure that the native server has the same context/path what ever you want to call it as the tomcat web app will have. This means the url path will be correct for both servers. If I have /someapp in Apache or IIS then my webapp name will be /someapp and /someapp/servlets will house the servlets Can he not do something like this in mod_jk? What would the equivalent be? Also, if he isn't using the version of mod_jk which has the mod_jk2 stuff merged in, I would still like to know if the merged version still has this capability? Hope that might help, and thanks for any other info given to the list of a similar nature on the same topic. Wade - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forwarding *all* webapps with mod_jk
Wade Chandler wrote: You can use the mod_rewrite: RewriteEngine On RewriteRule ^/tomcat/(.+)$ /$1 [R,L] JkMount /* ajp13 But this will map everything to the tomcat. You can not do (for now): /tomcat/examples/* - /examples/* and then back to: /examples/* - /tomcat/examples/* This would require that mod_jk when forwarding the request to Tomcat strips the '/tomcat' from the URL, and then after receiving the response add the '/tomcat' prefix to the url. Of course you will be forced to use only the relative url's inside your application, so the usage is dubious. #this will allow all rsg servlets to be run through tomcat. [uri:/*servlet*] info= for all servlets in a servlet directory context=/ You can use (for JK1.2.8) JkMount /*/servlet/* This was not possible on pre 1.2.8. But I think he ment something else, and that is dynamically rewriting the url with mod_jk. For example: JkMount /tomcat/* ajp13 JkMountPrefix /tomcat ajp13 Something like that would allow that for: /tomcat/foo/* actuall requests to Tomcat are /foo/* This still sounds to me somehow silly. One can create a virtual host inside Apache and redirect it to Tomcat ROOT so that for example all requests to http://host are for the Apache, and http://tomcat.host mapped with 'JkMount /* ajp13' Mladen. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: forwarding across contexts?
Hi, In short, how does one deploy a war file such that it looks for content (/images/whatever.gif) in a configurable location in the file system? Configure the server to serve that WAR file with a context path of (the empty string). This can be done in tomcat in three ways: - Add a Context entry in conf/server.xml whose path= and docBase is your WAR - Add an xml file with the Context tag to conf/[engine name]/[host name] (same path and docBase) - Put same XML file as above in your WAR file's META-INF directory instead of under the conf directory (tomcat 5 only). Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: forwarding across contexts?
Thanks once again. This is very helpful. Now here's what I really want (it never ends, does it): Is there a way, within a single context, to separate out the static content to some other file system location. I'd like to be able to deploy my war file with library jars, configuration info, classes, etc., into the safe location within the jboss deploy directory. But, I'd like to have all of my static content (again, /images/whatever.gif) elsewhere on the file system. I believe that Yoav's suggestion is that I set up the empty path () context for this purpose. However, this is where I started, and Justin argued against this cross-context approach. So is there a way to accomplish this separation within a single context? Many, many thanks. It's amazing how, even with a stack of books and google and jakarta and all, there's no substitute for talking with people. Fred At 07:37 AM 5/11/2004, you wrote: Hi, In short, how does one deploy a war file such that it looks for content (/images/whatever.gif) in a configurable location in the file system? Configure the server to serve that WAR file with a context path of (the empty string). This can be done in tomcat in three ways: - Add a Context entry in conf/server.xml whose path= and docBase is your WAR - Add an xml file with the Context tag to conf/[engine name]/[host name] (same path and docBase) - Put same XML file as above in your WAR file's META-INF directory instead of under the conf directory (tomcat 5 only). Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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: forwarding across contexts?
Hi, Is there a way, within a single context, to separate out the static content to some other file system location. Of course, there are many ways, none of them advised. You want to keep your webapp as a whole, that's the whole point of a WAR file. You can symlink (at the filesystem level) or use normal HTTP linking to access your static content. But you can't symlink in a WAR, so... I believe that Yoav's suggestion is that I set up the empty path () context for this purpose. However, this is where I started, and Justin argued against this cross-context approach. And I agree with Justin, just to be clear. I wasn't advocating anything different from what he said, just showing you that it can technically be done. If crossContext forwards are the worst design choices on this list, we'll be in great shape. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: forwarding across contexts?
Yoav, Let me describe a bit about our application, just in case you (or anyone else) have some specific advice. My client is a publisher, and the bulk of the site will be many thousands of published articles and associated content such as figure, tables, etc. The HTML content, however, will be served by tomcat, since it has some dynamic components. This is why it's not practical to bundle everything into a war file. Instead, I need tomcat to point to the file system where many users will be building the site. On the other hand, the war file can easily contain the java infrastructure (struts, velocity, configuration information, etc.). I'd like to be able to keep the small war file, hot deploy, etc., but have the raw content (static and otherwise) live elsewhere. Given that, would you solve it with multiple contexts? Or do you have another suggestion? Thanks again, Fred At 10:08 AM 5/11/2004, you wrote: Hi, Is there a way, within a single context, to separate out the static content to some other file system location. Of course, there are many ways, none of them advised. You want to keep your webapp as a whole, that's the whole point of a WAR file. You can symlink (at the filesystem level) or use normal HTTP linking to access your static content. But you can't symlink in a WAR, so... I believe that Yoav's suggestion is that I set up the empty path () context for this purpose. However, this is where I started, and Justin argued against this cross-context approach. And I agree with Justin, just to be clear. I wasn't advocating anything different from what he said, just showing you that it can technically be done. If crossContext forwards are the worst design choices on this list, we'll be in great shape. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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: forwarding across contexts?
Fred, Thanks for the additional info about your app ... it makes it much easier to talk about these things. :) There are many (valid) ways to proceed, many of which vary in the amount of standards they adhere to (how much you want to align yourself with Tomcat). I'll just give you my thoughts. At 09:02 AM 5/11/2004, you wrote: Let me describe a bit about our application, just in case you (or anyone else) have some specific advice. My client is a publisher, and the bulk of the site will be many thousands of published articles and associated content such as figure, tables, etc. The HTML content, however, will be served by tomcat, since it has some dynamic components. The biggest question, then, has to do with your security requirements. Specifically, does this content need to be protected or can it just sit out there for anyone to grab? If it need not be protected, this is, IMHO, a textbook example of when to use Apache. You've got a large collection of static data and a relatively small web application associated with it. You've probably got different groups working on the different parts (the publisher's content and the HTML pages), so it makes sense to separate it out and serve the static content by generating links to your static web server's content from your dynamic HTML. Additionally, you could then put the two pieces on separate machines (one or more with Apache, one or more with Tomcat) to keep them separated even more cleanly. If the content needs to be protected, I would create a separate directory and put the content there. Symlink this to the base of your Tomcat webApp and let Tomcat serve it normally, employing whatever security scheme you're using. You won't be able to deploy the entire thing as a single WAR, but it doesn't sound like you really care to do this anyways. This is why it's not practical to bundle everything into a war file. Instead, I need tomcat to point to the file system where many users will be building the site. On the other hand, the war file can easily contain the java infrastructure (struts, velocity, configuration information, etc.). I'd like to be able to keep the small war file, hot deploy, etc., but have the raw content (static and otherwise) live elsewhere. Given that, would you solve it with multiple contexts? Or do you have another suggestion? Alternately, you could extend the DefaultServlet (if you don't mind tying yourself to Tomcat and your version) with your own custom static content servlet that gets data from an arbitrary directory. If you can't be tied to Tomcat, use the source as a base to write your own default servlet. This solution is more on the slick side of things, so it wouldn't be preferable ... better to stay within the mainstream boundaries. If you can, look into symlinking or Apache. Consider the extend/impl DefaultServlet idea. If you're still not satisfied, having two separate contexts can be made to work. Perhaps others have additional ideas. Fred Good luck, justin At 10:08 AM 5/11/2004, you wrote: Hi, Is there a way, within a single context, to separate out the static content to some other file system location. Of course, there are many ways, none of them advised. You want to keep your webapp as a whole, that's the whole point of a WAR file. You can symlink (at the filesystem level) or use normal HTTP linking to access your static content. But you can't symlink in a WAR, so... I believe that Yoav's suggestion is that I set up the empty path () context for this purpose. However, this is where I started, and Justin argued against this cross-context approach. And I agree with Justin, just to be clear. I wasn't advocating anything different from what he said, just showing you that it can technically be done. If crossContext forwards are the worst design choices on this list, we'll be in great shape. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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] __ Justin Ruthenbeck Software Engineer, NextEngine Inc. justinr - AT - nextengine DOT com Confidential. See: http://www.nextengine.com/confidentiality.php __ - To unsubscribe,
RE: forwarding across contexts?
Justin, Thanks again for taking the time to think about this with me. Alas, my customer's deployment platform is windows. So no symlinks. No Apache (they use IIS). Complicated security model for everything on the site except for decorative gifs. So Tomcat does it all! Thanks, Fred At 03:13 PM 5/11/2004, you wrote: Fred, Thanks for the additional info about your app ... it makes it much easier to talk about these things. :) There are many (valid) ways to proceed, many of which vary in the amount of standards they adhere to (how much you want to align yourself with Tomcat). I'll just give you my thoughts. At 09:02 AM 5/11/2004, you wrote: Let me describe a bit about our application, just in case you (or anyone else) have some specific advice. My client is a publisher, and the bulk of the site will be many thousands of published articles and associated content such as figure, tables, etc. The HTML content, however, will be served by tomcat, since it has some dynamic components. The biggest question, then, has to do with your security requirements. Specifically, does this content need to be protected or can it just sit out there for anyone to grab? If it need not be protected, this is, IMHO, a textbook example of when to use Apache. You've got a large collection of static data and a relatively small web application associated with it. You've probably got different groups working on the different parts (the publisher's content and the HTML pages), so it makes sense to separate it out and serve the static content by generating links to your static web server's content from your dynamic HTML. Additionally, you could then put the two pieces on separate machines (one or more with Apache, one or more with Tomcat) to keep them separated even more cleanly. If the content needs to be protected, I would create a separate directory and put the content there. Symlink this to the base of your Tomcat webApp and let Tomcat serve it normally, employing whatever security scheme you're using. You won't be able to deploy the entire thing as a single WAR, but it doesn't sound like you really care to do this anyways. This is why it's not practical to bundle everything into a war file. Instead, I need tomcat to point to the file system where many users will be building the site. On the other hand, the war file can easily contain the java infrastructure (struts, velocity, configuration information, etc.). I'd like to be able to keep the small war file, hot deploy, etc., but have the raw content (static and otherwise) live elsewhere. Given that, would you solve it with multiple contexts? Or do you have another suggestion? Alternately, you could extend the DefaultServlet (if you don't mind tying yourself to Tomcat and your version) with your own custom static content servlet that gets data from an arbitrary directory. If you can't be tied to Tomcat, use the source as a base to write your own default servlet. This solution is more on the slick side of things, so it wouldn't be preferable ... better to stay within the mainstream boundaries. If you can, look into symlinking or Apache. Consider the extend/impl DefaultServlet idea. If you're still not satisfied, having two separate contexts can be made to work. Perhaps others have additional ideas. Fred Good luck, justin At 10:08 AM 5/11/2004, you wrote: Hi, Is there a way, within a single context, to separate out the static content to some other file system location. Of course, there are many ways, none of them advised. You want to keep your webapp as a whole, that's the whole point of a WAR file. You can symlink (at the filesystem level) or use normal HTTP linking to access your static content. But you can't symlink in a WAR, so... I believe that Yoav's suggestion is that I set up the empty path () context for this purpose. However, this is where I started, and Justin argued against this cross-context approach. And I agree with Justin, just to be clear. I wasn't advocating anything different from what he said, just showing you that it can technically be done. If crossContext forwards are the worst design choices on this list, we'll be in great shape. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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: forwarding across contexts?
At 01:04 PM 5/11/2004, you wrote: Justin, Thanks again for taking the time to think about this with me. Alas, my customer's deployment platform is windows. So no symlinks. No Apache (they use IIS). Complicated security model for everything on the site except for decorative gifs. So Tomcat does it all! In that case, I would personally either extend or implement the DefaultServlet to read resources from a designated local location (given by a servlet init param). It seems silly to add a webApp that consists only of static content in this case ... but you know how to do it if you deem that best. Once you decide what you're going to do and implement it, I'd be curious to get your feedback and/or comments on your method. If you remember this conversation when you're done, shoot me/us an email with any observations. Good luck, justin At 03:13 PM 5/11/2004, you wrote: Fred, Thanks for the additional info about your app ... it makes it much easier to talk about these things. :) There are many (valid) ways to proceed, many of which vary in the amount of standards they adhere to (how much you want to align yourself with Tomcat). I'll just give you my thoughts. At 09:02 AM 5/11/2004, you wrote: Let me describe a bit about our application, just in case you (or anyone else) have some specific advice. My client is a publisher, and the bulk of the site will be many thousands of published articles and associated content such as figure, tables, etc. The HTML content, however, will be served by tomcat, since it has some dynamic components. The biggest question, then, has to do with your security requirements. Specifically, does this content need to be protected or can it just sit out there for anyone to grab? If it need not be protected, this is, IMHO, a textbook example of when to use Apache. You've got a large collection of static data and a relatively small web application associated with it. You've probably got different groups working on the different parts (the publisher's content and the HTML pages), so it makes sense to separate it out and serve the static content by generating links to your static web server's content from your dynamic HTML. Additionally, you could then put the two pieces on separate machines (one or more with Apache, one or more with Tomcat) to keep them separated even more cleanly. If the content needs to be protected, I would create a separate directory and put the content there. Symlink this to the base of your Tomcat webApp and let Tomcat serve it normally, employing whatever security scheme you're using. You won't be able to deploy the entire thing as a single WAR, but it doesn't sound like you really care to do this anyways. This is why it's not practical to bundle everything into a war file. Instead, I need tomcat to point to the file system where many users will be building the site. On the other hand, the war file can easily contain the java infrastructure (struts, velocity, configuration information, etc.). I'd like to be able to keep the small war file, hot deploy, etc., but have the raw content (static and otherwise) live elsewhere. Given that, would you solve it with multiple contexts? Or do you have another suggestion? Alternately, you could extend the DefaultServlet (if you don't mind tying yourself to Tomcat and your version) with your own custom static content servlet that gets data from an arbitrary directory. If you can't be tied to Tomcat, use the source as a base to write your own default servlet. This solution is more on the slick side of things, so it wouldn't be preferable ... better to stay within the mainstream boundaries. If you can, look into symlinking or Apache. Consider the extend/impl DefaultServlet idea. If you're still not satisfied, having two separate contexts can be made to work. Perhaps others have additional ideas. Fred Good luck, justin At 10:08 AM 5/11/2004, you wrote: Hi, Is there a way, within a single context, to separate out the static content to some other file system location. Of course, there are many ways, none of them advised. You want to keep your webapp as a whole, that's the whole point of a WAR file. You can symlink (at the filesystem level) or use normal HTTP linking to access your static content. But you can't symlink in a WAR, so... I believe that Yoav's suggestion is that I set up the empty path () context for this purpose. However, this is where I started, and Justin argued against this cross-context approach. And I agree with Justin, just to be clear. I wasn't advocating anything different from what he said, just showing you that it can technically be done. If crossContext forwards are the worst design choices on this list, we'll be in great shape. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and
Re: forwarding across contexts?
At 07:04 PM 5/10/2004, you wrote: Hi, I'm trying to install a filter into the default context that forwards to my application (in another context) and it doesn't seem to want to work. (jboss 3.2.3 with embedded tomcat 4.1.29) In researching this, I've seen various hints that this may in fact be illegal. Can anyone confirm? It is generally good design practice to limit interactions between your webapps except for strongly defined specific interfaces that promote modularity. Doing something like you're suggesting will likely lead to messy, difficult code to work with ... not because it's a necessarily bad design idea, but rather because the premise behind J2EE is that code bases are designed, coded, deployed, and maintained as independent applications. They're not meant to ineroperate in a fluid way. It's possible to do what you're suggesting, but not recommended. The REASON I want to do this is that I want to be able to take advantage of simple URLS with the default context, as in /images/whatever.gif, and have them be served by DefaultServlet, which conveniently knows how to handle all that sort of stuff, set mime types, etc. I'm also hoping that DefaultServlet was written by someone more clever than me! Resources need not be within the ROOT web application to be served by the DefaultServlet. You'll notice that the DefaultServlet is defined within the global web.xml (I haven't worked with recent versions of jBoss, so I'm not sure exactly where they put this these days), which means that all applications inherit it. This means that resources like /images/whatever.gif and /mywebapp/images/whatever.gif will both be served by the DefaultServlet unless you configure it otherwise. But, I also want to capture certain simple URLs and forward these to another context. As in /protected.html needs to be forwarded to /accesscheck/protected.html or similar. Am I on the wrong track here? Is it possible to forward (via RequestDispatcher) from one context to another? If not, how can I take advantage of DefaultServlet in my application? See ServletContext#getContext(String). Again, I predict you'll find this to be a clunky and frustrating way to do things. Unless you have an over-riding reason to do otherwise, embrace the idea of separate and distinct web applications and let the container do this URL parsing and forwarding for you. Many thanks, Fred Toth Good luck, justin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: forwarding across contexts?
Justin, Thanks very much for your considered reply. You both solved my problem and made me question my approach at the same time. In re-thinking this in terms of separated webapps, I've hit another issue. If I solve this problem within one particular web application, I have to be able to point this webapp to another place in the file system (other than $CATALINA_HOME/webapp). I had figured out how to do that with the ROOT application, but I'm not sure how to do this within a war file. In short, how does one deploy a war file such that it looks for content (/images/whatever.gif) in a configurable location in the file system? If I can figure that out, I think I can abandon the cross-context issue for good! Thanks, Fred At 10:23 PM 5/10/2004, you wrote: At 07:04 PM 5/10/2004, you wrote: Hi, I'm trying to install a filter into the default context that forwards to my application (in another context) and it doesn't seem to want to work. (jboss 3.2.3 with embedded tomcat 4.1.29) In researching this, I've seen various hints that this may in fact be illegal. Can anyone confirm? It is generally good design practice to limit interactions between your webapps except for strongly defined specific interfaces that promote modularity. Doing something like you're suggesting will likely lead to messy, difficult code to work with ... not because it's a necessarily bad design idea, but rather because the premise behind J2EE is that code bases are designed, coded, deployed, and maintained as independent applications. They're not meant to ineroperate in a fluid way. It's possible to do what you're suggesting, but not recommended. The REASON I want to do this is that I want to be able to take advantage of simple URLS with the default context, as in /images/whatever.gif, and have them be served by DefaultServlet, which conveniently knows how to handle all that sort of stuff, set mime types, etc. I'm also hoping that DefaultServlet was written by someone more clever than me! Resources need not be within the ROOT web application to be served by the DefaultServlet. You'll notice that the DefaultServlet is defined within the global web.xml (I haven't worked with recent versions of jBoss, so I'm not sure exactly where they put this these days), which means that all applications inherit it. This means that resources like /images/whatever.gif and /mywebapp/images/whatever.gif will both be served by the DefaultServlet unless you configure it otherwise. But, I also want to capture certain simple URLs and forward these to another context. As in /protected.html needs to be forwarded to /accesscheck/protected.html or similar. Am I on the wrong track here? Is it possible to forward (via RequestDispatcher) from one context to another? If not, how can I take advantage of DefaultServlet in my application? See ServletContext#getContext(String). Again, I predict you'll find this to be a clunky and frustrating way to do things. Unless you have an over-riding reason to do otherwise, embrace the idea of separate and distinct web applications and let the container do this URL parsing and forwarding for you. Many thanks, Fred Toth Good luck, justin - 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: Forwarding
Howdy, You can also do this with a filter (mapped to url-pattern /*, looks for request URL ending in /something.jsp/, redirects accordingly. I understand your desire NOT to use Apache (even though mod_rewrite would work here) in order to keep the environment simpler and pure java. Yoav Shapira Millennium ChemInformatics -Original Message- From: Holger Klawitter [mailto:[EMAIL PROTECTED] Sent: Friday, November 28, 2003 2:24 AM To: Tomcat Users List Subject: Re: Forwarding -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am Thursday 27 November 2003 16:49 schrieb Stuart Stephen: Why not use apache mod_rewrite ? You need to have apache (and jkwhatever) up and running for this ;-) Mit freundlichem Gruß / With kind regards Holger Klawitter - -- lists at klawitter dot de -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/xvgM1Xdt0HKSwgYRAmj0AJ9gbXIiXPuAF9p8gmdC2xPcF/uXNwCaA5/A yHMLQABP8Ky+ljKqC4wlJ9M= =h2Bd -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forwarding
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am Thursday 27 November 2003 16:49 schrieb Stuart Stephen: Why not use apache mod_rewrite ? You need to have apache (and jkwhatever) up and running for this ;-) Mit freundlichem Gru / With kind regards Holger Klawitter - -- lists at klawitter dot de -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/xvgM1Xdt0HKSwgYRAmj0AJ9gbXIiXPuAF9p8gmdC2xPcF/uXNwCaA5/A yHMLQABP8Ky+ljKqC4wlJ9M= =h2Bd -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forwarding
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am Thursday 27 November 2003 00:16 schrieb Kuba Krlikowski: Dnia 2003-11-26 23:00, Uytkownik Jeff Tulley napisa: I think Kuba wants to redirect all requests that end with /something.jsp/ to /something.jsp This should be possible with a custom Valve. Unfortunately you probably have to write one yourself. Mit freundlichem Gru / With kind regards Holger Klawitter - -- lists at klawitter dot de -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/xaul1Xdt0HKSwgYRAlP4AJ9T/hODqoC03LPi+9p7X4ZEIwBnHgCggjJO qknDbukofjBekjqgqeqPwok= =OEbn -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forwarding
I'm a noob and all but.. Surely you could create a simple servlet to intercept all requests to /something.jsp/ and simply forward it to /something.jsp? G. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Forwarding
Why not use apache mod_rewrite ? -Original Message- From: Holger Klawitter [mailto:[EMAIL PROTECTED] Sent: 27 November 2003 07:46 To: [EMAIL PROTECTED] Subject: Re: Forwarding -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am Thursday 27 November 2003 00:16 schrieb Kuba Krlikowski: Dnia 2003-11-26 23:00, Uytkownik Jeff Tulley napisa: I think Kuba wants to redirect all requests that end with /something.jsp/ to /something.jsp This should be possible with a custom Valve. Unfortunately you probably have to write one yourself. Mit freundlichem Gru / With kind regards Holger Klawitter - -- lists at klawitter dot de -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/xaul1Xdt0HKSwgYRAlP4AJ9T/hODqoC03LPi+9p7X4ZEIwBnHgCggjJO qknDbukofjBekjqgqeqPwok= =OEbn -END PGP SIGNATURE- - 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: Forwarding
Can you re-phrase that? I'm not sure what you want to do. On Wednesday 26 November 2003 04:25 pm, Kuba Królikowski wrote: Hi, I want to make forwarding in my web application which forward every /.jsp/ (url without '/' at the end) link to /.jsp (url without '/' at the end). Do you know how to do it on Tomcat? I know, that I can define for every site servlet and servlet-mapping tags in web.xml, but is there any universal method, which make forwarding for every sites with one instruction/tag? Kuba - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ben Souther F.W. Davison Company, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forwarding
I think Kuba wants to redirect all requests that end with /something.jsp/ to /something.jsp Are you using Apache on the front end? I think this would be best done in Apache, with mod_rewrite, and a RewriteRule. (Do not forget to turn the RewriteEngine on, a common mistake). [EMAIL PROTECTED] 11/26/03 2:38:18 PM Can you re-phrase that? I'm not sure what you want to do. On Wednesday 26 November 2003 04:25 pm, Kuba Królikowski wrote: Hi, I want to make forwarding in my web application which forward every /.jsp/ (url without '/' at the end) link to /.jsp (url without '/' at the end). Do you know how to do it on Tomcat? I know, that I can define for every site servlet and servlet-mapping tags in web.xml, but is there any universal method, which make forwarding for every sites with one instruction/tag? Kuba - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ben Souther F.W. Davison Company, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Jeff Tulley ([EMAIL PROTECTED]) (801)861-5322 Novell, Inc., The Leading Provider of Net Business Solutions http://www.novell.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forwarding
Dnia 2003-11-26 22:38, Uytkownik Ben Souther napisa: Can you re-phrase that? Well, I can, but what with URL such as /article.jsp?id=435/? They are not static, I can't put them all to web.xml. Kuba - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forwarding
Dnia 2003-11-26 23:00, Uytkownik Jeff Tulley napisa: I think Kuba wants to redirect all requests that end with /something.jsp/ to /something.jsp Exactly. Are you using Apache on the front end? I think this would be best done in Apache, with mod_rewrite, and a RewriteRule. (Do not forget to turn the RewriteEngine on, a common mistake). No, I don't use Apache yet. Can I do something similar with Tomcat? Kuba - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forwarding with Tomcat Standalone
Have you set up the security-constraint in your web.xml for those pages? security-constraint web-resource-collection web-resource-nameLogin 4 Everything/web-resource-name !-- Define the context-relative URL(s) to be protected -- url-pattern/private/*/url-pattern /web-resource-collection auth-constraint !-- Anyone with one of the listed roles may access this area -- role-nameuser/role-name role-nameadmin/role-name /auth-constraint user-data-constraint descriptionSSL not required/description transport-guaranteeCONFIDENTIAL/transport-guarantee /user-data-constraint /security-constraint You will also probably need to set up a filter to redirect non-secure pages out of HTTPS. This is not automatic. Adam On 09/23/2003 03:28 AM Michael Futeran wrote: I am trying to replace an Apache/Tomcat combination with Tomcat standalone. I have everything else working, but I can not figure out how to get requests for secure pages to be auto forwarded to https the way they are with Apache. -- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Forwarding with Tomcat Standalone
Howdy, A filter can be easily written for this purpose: - Check request URL - If request is for secure page, forward to different port (the one you configure in server.xml to be an SSL connector) on same server with same request path. - Otherwise, pass request on... Yoav Shapira Millennium ChemInformatics -Original Message- From: Michael Futeran [mailto:[EMAIL PROTECTED] Sent: Monday, September 22, 2003 9:28 PM To: Tomcat Users List Subject: Forwarding with Tomcat Standalone I am trying to replace an Apache/Tomcat combination with Tomcat standalone. I have everything else working, but I can not figure out how to get requests for secure pages to be auto forwarded to https the way they are with Apache. This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forwarding control
That's exactly what I needed to know. Thanks, Mike. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Forwarding control
The only way is to 'reconstruct' a new request object using a querystring So the url would need to be constructed with ?foo=barfoo2=bar2 etc, etc. The thing with sendRedirect() is that it sends an HTTP code to the browser, which then makes a brand new request, so there is no way for the browser to know about the previous 'request' unless you fake it out with the querystring. If you have objects, you'll have to use a session. -Original Message- From: James Michelich [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2003 5:12 PM To: [EMAIL PROTECTED] Subject: RE: Forwarding control Mike, Your suggestion worked out perfectly! Thanks for the help. One other quick question, if you don't mind - since sendRedirect() doesn't send along the request object, is there another way to access it from the target url while still using this method? Thanks, James - 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: Forwarding control
James, Use response.sendRedirect() instead of the RequestDispatcher. That will change the URL in the browser. If you want to stick with the RequestDispatcher, you'll have to add some logic to catch a resubmission of the same data (possibly use a hidden field in your forms with a unique identifier, random number, timestamp, etc... and record those in the user session or a backend database) and skip over processing and go straight to the result.jsp. Hope that helps. Mike -Original Message- From: James Michelich [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2003 4:50 PM To: [EMAIL PROTECTED] Subject: Forwarding control Hello, any help would be much appreciated. The basic scenario is as follows - I have a form page called form.jsp (http://localhost/webapp/form.jsp). Upon submission, the form data is processed by a servlet mapped to the url '/process' (http://localhost/webapp/process). Once the servlet has completed processing the form data, it forwards control to a results page (http://localhost/webapp/result.jsp) via RequestDispatcher dispatch = request.getRequestDispatcher (forwardPath); dispatch.forward(request, response); My question is this - although control has been forwarded to the results page, the browser's url is still http://localhost/webapp/process, which is ok with me; however, if the page is refreshed, the browser prompts for the form data to be resubmitted and the processing is repeated (which for my application happens to be quite substantial), rather than refreshing the contents of the results page. I suppose this is a minor annoyance that could be worked around by displaying a link to the results page rather than forwarding directly to it, but I'd rather implement the latter. Does anyone know of a solution or workaround for this problem? Thanks in advance, James - 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: Forwarding control
Mike, Your suggestion worked out perfectly! Thanks for the help. One other quick question, if you don't mind - since sendRedirect() doesn't send along the request object, is there another way to access it from the target url while still using this method? Thanks, James - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Forwarding with parameters
You cannot change protocol inside a reuqest. To change protocol you have to send a redirect to the browser. -Original Message- From: Gil Hauer To: Tomcat Users List Sent: 24-07-03 13:44 Subject: Forwarding with parameters Hello, I have code in a servlet that, based on transaction status, forwards to another target page. The code snippet is: String target = /index.jsp; ServletContext c = getServletContext(); RequestDispatcher d = c.getRequestDispatcher(target); response.setContentType(text/html); d.forward(request, response); How can I set new parameters for the target page? Is it as simple as setting String target = /index.jsp?param=val; I ask this since it doesn't seem to work -- that parameter does not seem to get set. Also, at this point I'm in an https session and I'd like to transfer to unencrypted protocol -- how can I do that? Thanks in advance, Gil - 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: Forwarding with parameters
Howdy, Yup, use sendRedirect. Or add a filter with a servlet request wrapper mapped to index.jsp that checks and adds parameters as needed. Yoav Shapira Millennium ChemInformatics -Original Message- From: René Vangsgaard ML [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 8:34 AM To: 'Gil Hauer '; 'Tomcat Users List ' Subject: RE: Forwarding with parameters You cannot change protocol inside a reuqest. To change protocol you have to send a redirect to the browser. -Original Message- From: Gil Hauer To: Tomcat Users List Sent: 24-07-03 13:44 Subject: Forwarding with parameters Hello, I have code in a servlet that, based on transaction status, forwards to another target page. The code snippet is: String target = /index.jsp; ServletContext c = getServletContext(); RequestDispatcher d = c.getRequestDispatcher(target); response.setContentType(text/html); d.forward(request, response); How can I set new parameters for the target page? Is it as simple as setting String target = /index.jsp?param=val; I ask this since it doesn't seem to work -- that parameter does not seem to get set. Also, at this point I'm in an https session and I'd like to transfer to unencrypted protocol -- how can I do that? Thanks in advance, Gil - 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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forwarding with parameters
I forget all the reasons why at the moment, but I use sendRedirect() instead of forward(). String target = page1.jsp?param1= + val1 + param2= + val2 + param3= + val3; response.sendRedirect( target ); Hope this helps, -- *** * Rick Roberts* * Advanced Information Technologies, Inc. * *** Gil Hauer wrote: Hello, I have code in a servlet that, based on transaction status, forwards to another target page. The code snippet is: String target = /index.jsp; ServletContext c = getServletContext(); RequestDispatcher d = c.getRequestDispatcher(target); response.setContentType(text/html); d.forward(request, response); How can I set new parameters for the target page? Is it as simple as setting String target = /index.jsp?param=val; I ask this since it doesn't seem to work -- that parameter does not seem to get set. Also, at this point I'm in an https session and I'd like to transfer to unencrypted protocol -- how can I do that? Thanks in advance, Gil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Forwarding with parameters
Using forward changes control within the server, while sendRedirect transfers control to the browser and asks it to make another request. Hence forward is faster, but the browser won't know what you did, and won't know about any directory location changes. This also means that a change from http to https in a forward would be pointless since it does not involve communication with the client. As for setting parameters with a forward, you're on the right track. Adding them to your target string works for me. Layton -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 6:23 AM To: Tomcat Users List Subject: RE: Forwarding with parameters Howdy, Yup, use sendRedirect. Or add a filter with a servlet request wrapper mapped to index.jsp that checks and adds parameters as needed. Yoav Shapira Millennium ChemInformatics -Original Message- From: René Vangsgaard ML [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 8:34 AM To: 'Gil Hauer '; 'Tomcat Users List ' Subject: RE: Forwarding with parameters You cannot change protocol inside a reuqest. To change protocol you have to send a redirect to the browser. -Original Message- From: Gil Hauer To: Tomcat Users List Sent: 24-07-03 13:44 Subject: Forwarding with parameters Hello, I have code in a servlet that, based on transaction status, forwards to another target page. The code snippet is: String target = /index.jsp; ServletContext c = getServletContext(); RequestDispatcher d = c.getRequestDispatcher(target); response.setContentType(text/html); d.forward(request, response); How can I set new parameters for the target page? Is it as simple as setting String target = /index.jsp?param=val; I ask this since it doesn't seem to work -- that parameter does not seem to get set. Also, at this point I'm in an https session and I'd like to transfer to unencrypted protocol -- how can I do that? Thanks in advance, Gil - 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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forwarding with parameters
Perfect! Thanks for the help. Gil On Thu, 2003-07-24 at 10:54, Rick Roberts wrote: I forget all the reasons why at the moment, but I use sendRedirect() instead of forward(). String target = page1.jsp?param1= + val1 + param2= + val2 + param3= + val3; response.sendRedirect( target ); Hope this helps, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forwarding an Apache request to a seperate machine running Tomcat ....newbie here1
On Wed, 28 May 2003 11:28:28 -0400, Eric fiedler [EMAIL PROTECTED] wrote: I have read numerous posts that say I basically have two options: mod_jk or mod_proxy. Seeing as machine 'b', the Tomcat machine, will host the static documents associated with its site...I think mod_proxy is the best way to go...correct??? Depends on what you mean by put a link to machine B on machine A. If you mean that the content on machine B is dynamic content that Tomcat handles, then you can use mod_jk or mod_jk2. If you mean that the content on machine B is static content, you could still do it with mod_jk (with a JkMount of * instead of /*.jsp), but it won't be optimal. Mod_proxy can work, too. I am running tomcat 4.0.3 and Apache 1.3.I also have 2.0 available to me if that is better. 1.3 or 2 is fine...but you should think about upgrading your Tomcat. 4.0.6 is the latest, I believe, in the 4.0 tree, and some of the fixes in .4, .5, and .6 were security related. I cannot find documentation on how to use mod_jk under tomcat 4.0.3. Furthermore, most documentation I read assumes Tomcat and Apache are on the same machine. What do you do if they are not??? Version of Tomcat is fairly irrelevant as far as mod_jk is concerned...in general any documentation for any Tomcat version 4 will be fine, or even Tomcat 3.3. http://www.johnturner.com/howto http://tomcatfaq.sourceforge.net If Tomcat and Apache are not on the same machine, you simply change the .host property in mod_jk's workers.properties file from localhost to the IP address of the machine hosting Tomcat. In regards to mod_proxy; Where can I get this? Apache was installed previously and I do not have the source code anymore. Is there a binary version of this? I have no idea, perhaps an Apache list can help. John -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: forwarding from Tomcat to Apache
Drop the paridon.homedns.org, assuming login.html is the base htdocs directory you ought to be fine. The second solution would be to add http://; in front of the paridon.homedns.org. --mikej -=- mike jackson [EMAIL PROTECTED] -Original Message- From: Todd Paridon [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 9:36 AM To: [EMAIL PROTECTED] Subject: forwarding from Tomcat to Apache Background: I am using Apache 2.0.43, Tomcat 4.1.18 with mod_jk as the connector. I am using a servlet to check a users response to a retry/cancel operation. If it is a retry I want to go back to a static page being served by Apache, if it is cancel I want to access another page being served by Tomcat. The second part works fine, but when I try to redirect back to Apache (using response.sendRedirect(paridon.homedns.org/login.html) ) the url it uses is : http://paridon.homedns.org/ParidonWeb/servlet/paridon.homedns.org/ login.html When I use response.sendRedirect(login.html) it responds: http://paridon.homedns.org/ParidonWeb/servlet/ParidonWeb/servlet/L oginFailed?OK=Retry Neither of which is there... It should be just: http://paridon.homedns.org/login.html Is this a setup problem? Does anyone know what the proper way to do this or a workaround? Thanks in advance. Todd Paridon - 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: Forwarding in servlets.
Please remember that in both forward and send re-direct, execution of the current servlet will resume unless you put a return statement after the forward or re-direct statement. if (dispatcher!=null) { dispatcher.forward(request, response) ; return; } -Original Message- From: Kwok Peng Tuck [mailto:[EMAIL PROTECTED]] Sent: 08 October, 2002 12:42 AM To: [EMAIL PROTECTED] Subject: Forwarding in servlets. Is there any way besides the following : request.setAttribute(selectedScreen, request.getServletPath()) ; RequestDispatcher dispatcher = request.getRequestDispatcher(/test.jsp) ; if (dispatcher!=null) { dispatcher.forward(request, response) ; } to forward a request to a jsp page. Is it possible to use response.sendRedirect like in jsp ? Any suggestions will be great. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: forwarding to a page anchor
Duh, no. Anchor tags are only meaningful to the browser. They are stripped from the request to the server (for e.g. a href=mypage.jsp#anchorName). Using a RequestDispacher with an anchor will give a 404 error on all versions of Tomcat. This is by design (since server-side it can't possibly do what you think you want it to do :). Alternatives are: 1) use response.sendRedirect (so that the browser controls the anchor) instead of rd.forward. 2) re-write page.jsp so that doing a: jsp:forward page=/page.jsp jsp:param name=anchor value=%= anchorName % / /jsp:forward has the proper JavaScript code to scroll to the anchorName tag. Cindy Ballreich [EMAIL PROTECTED] wrote in message 3.0.5.32.20020925164616.00c58390@urchin">news:3.0.5.32.20020925164616.00c58390@urchin... I'd like to forward to an anchor a name=anchorName in a jsp page, but I keep getting a 404 error when I try to do it. It works from the browser, but not from the server. Is it possible to forward to a page anchor like this? RequestDispatcher rd = request.getRequestDispatcher(/page.jsp#anchorName); rd.forward(request, response); Thanks Cindy -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: forwarding to a jsp using a servlet
Billy, Try this in your doGet / process method: (I put my jsps under WEB-INF so they are not servable directly). String url = FileUtil.makeJspUrl(/WEB_INF/jspDir/test.jsp); response.setContentType(text/html); ServletContext sc = getServletContext(); RequestDispatcher rd = sc.getRequestDispatcher(url); rd.include(request, response); Andy -Original Message- From: Billy V. Kantartzis [mailto:[EMAIL PROTECTED]] Sent: 29 July 2002 13:59 To: Tomcat Users List Subject: forwarding to a jsp using a servlet can some one please tell me how i coulod make a forward from a servlet to a jsp i need to use the same url plus i dont want in some cases the destination address apiasring on the address bar thanks in advance Billy -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: forwarding to a jsp using a servlet
thanks i will try this ---Original Message--- From: Tomcat Users List Date: 29 July 2002 14:46:04 To: Tomcat Users List Subject: RE: forwarding to a jsp using a servlet Billy, Try this in your doGet / process method: (I put my jsps under WEB-INF so they are not servable directly). String url = FileUtil.makeJspUrl(/WEB_INF/jspDir/test.jsp); response.setContentType(text/html); ServletContext sc = getServletContext(); RequestDispatcher rd = sc.getRequestDispatcher(url); rd.include(request, response); Andy -Original Message- From: Billy V. Kantartzis [mailto:[EMAIL PROTECTED]] Sent: 29 July 2002 13:59 To: Tomcat Users List Subject: forwarding to a jsp using a servlet can some one please tell me how i coulod make a forward from a servlet to a jsp i need to use the same url plus i dont want in some cases the destination address apiasring on the address bar thanks in advance Billy -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] org -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: forwarding to a jsp using a servlet
Billy, Sorry - I included my File Utility class by mistake. I hard coded the result in the message and still left the method call - doh. Try again: String url = /WEB_INF/jspDir/test.jsp; response.setContentType(text/html); ServletContext sc = setServletContext(); RequestDispatcher rd = sc.getRequestDispatcher(url); rd.include(request, response); Andy -Original Message- From: Billy V. Kantartzis [mailto:[EMAIL PROTECTED]] Sent: 29 July 2002 15:11 To: Tomcat Users List Subject: RE: forwarding to a jsp using a servlet thanks i will try this ---Original Message--- From: Tomcat Users List Date: 29 July 2002 14:46:04 To: Tomcat Users List Subject: RE: forwarding to a jsp using a servlet Billy, Try this in your doGet / process method: (I put my jsps under WEB-INF so they are not servable directly). String url =ileUtil.makeJspUrl(/WEB_INF/jspDir/test.jsp); response.setContentType(text/html); ServletContext sc =etServletContext(); RequestDispatcher rd =c.getRequestDispatcher(url); rd.include(request, response); Andy -Original Message- From: Billy V. Kantartzis [mailto:[EMAIL PROTECTED]] Sent: 29 July 2002 13:59 To: Tomcat Users List Subject: forwarding to a jsp using a servlet can some one please tell me how i coulod make a forward from a servlet to a jsp i need to use the same url plus i dont want in some cases the destination address apiasring on the address bar thanks in advance Billy -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] org -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: forwarding to a jsp using a servlet
From: Andy Eastham [EMAIL PROTECTED] Sent: Monday, July 29, 2002 6:43 AM Subject: RE: forwarding to a jsp using a servlet Try this in your doGet / process method: (I put my jsps under WEB-INF so they are not servable directly). String url = FileUtil.makeJspUrl(/WEB_INF/jspDir/test.jsp); response.setContentType(text/html); ServletContext sc = getServletContext(); RequestDispatcher rd = sc.getRequestDispatcher(url); rd.include(request, response); Just an FYI in case it ever happens to you, BEA Weblogic will NOT serve JSPs from WEB-INF, and this can become a porting issue if you ever try to move your application in that direction. This particularly notable for things like 'includes'. I can see how the spec could be read either way, it's a point that should be clarified in the future, IMHO. Regards, Will Hartung ([EMAIL PROTECTED]) -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: forwarding through j_security_check
Hi Craig- I've come up with a solution that seems to work very well for my purposes. Unfortunately, my project's priority is to build on Jrun, but I'll need to adapt this solution to Tomcat in the near future. I post the description of my implemented solution just to get it out there for comment and possibly (if the solution is worthy) to help out anyone else trying to solve this problem. The essence of the problem, again, was to enable a single sign-on through a corporate portal. The portal presents links to other corporate web applications. Clicking on those links automatically signs the user on through the web-app's security service. My solution was to create a servlet (Jrun)SecurityCredentialForward capable of interacting with the security service (in the current solution Jrun's WebAppSecurityService). By bypassing the FormAuthentication class (the real manager of the j_security_check workflow) I could avoid the two step process. Each url in the portal's application list contains a link to the security servlet and parameters specifying the applications main url, username and password. The SecurityCredentialForward takes the username and password, authenticates them with the WebAppSecurityService and if everything is kosher, redirects the user to the main web page. All natural web container security functions are used from there on and as far as the container is concerned, the j_security_check process ran as normal. I'm pretty sure this same approach could be used with Tomcat. It doesn't seem to incur any negative performance penalties and doesn't (as far as I can see) violate the login process since it uses resources that are already available to the servlet. Any opinions are gladly accepted. thanks, Jim -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 12:45 PM To: Tomcat Users List Subject: RE: forwarding through j_security_check On Tue, 16 Jul 2002, James Krygowski wrote: Date: Tue, 16 Jul 2002 07:09:55 -0400 From: James Krygowski [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: RE: forwarding through j_security_check Hi Craig- If so, is it possible to set up a servlet that could manipulate the Referrer in the header, and redirect a request along to an application in another Tomcat server, making it look like a post to j_security_check, complete with referrer, j_username and j_password? Any suggestions or comments are welcome and appreciated. Trying to forward security credentials like this is pretty much guaranteed not to work. One thing you might consider using is Tomcat's standard support for single sign on across multiple webaps. Check out the Single Sign On section Thanks for the response. Your suggestion is only applicable for those who have a homogenous Tomcat environment. In my situation, my portal will have to forward to a mixed environment of Tomcat and JRun servers. In the future that may expand to include either WebLogic or WebSphere. I find it hard to believe that there is no way to programmatically manage a login sequence using j_security_check. Is it possible to use a servlet intermediary to handle the login interaction and then redirect the user to a protected resource once the login sequence is successfully completed? Hard to believe or not, the servlet spec is totally silent about programmatic interaction with j_security_check. That means there is absolutely no guarantee of behavior consistency in this regard across servlet containers -- or even across different versions of the same container (Tomcat 3.3 and 4.x do things very differently in this regard, for example). Your use case is something that things like the Liberty Alliance http://www.projectliberty.org are trying to solve. Unfortunately, you're a bit early on the adoption curve for that to be helpful. About the only portable thing you can do in the mean time would be a proxy app that your users always went through for every request, which knows how to do the login interaction with each back end app as needed (i.e. whenever they challenge for credentials, answer based on what it knows about this user, but pass all other requests through). But the performance impact of such a proxy isn't going to be very attractive. Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: forwarding through j_security_check
Jim, You may also want to check out Tapestry: http://www.saush.com/tapestry/ Good luck, Mete __ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: forwarding through j_security_check
Hi Craig- If so, is it possible to set up a servlet that could manipulate the Referrer in the header, and redirect a request along to an application in another Tomcat server, making it look like a post to j_security_check, complete with referrer, j_username and j_password? Any suggestions or comments are welcome and appreciated. Trying to forward security credentials like this is pretty much guaranteed not to work. One thing you might consider using is Tomcat's standard support for single sign on across multiple webaps. Check out the Single Sign On section Thanks for the response. Your suggestion is only applicable for those who have a homogenous Tomcat environment. In my situation, my portal will have to forward to a mixed environment of Tomcat and JRun servers. In the future that may expand to include either WebLogic or WebSphere. I find it hard to believe that there is no way to programmatically manage a login sequence using j_security_check. Is it possible to use a servlet intermediary to handle the login interaction and then redirect the user to a protected resource once the login sequence is successfully completed? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: forwarding through j_security_check
On Tue, 16 Jul 2002, James Krygowski wrote: Date: Tue, 16 Jul 2002 07:09:55 -0400 From: James Krygowski [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: RE: forwarding through j_security_check Hi Craig- If so, is it possible to set up a servlet that could manipulate the Referrer in the header, and redirect a request along to an application in another Tomcat server, making it look like a post to j_security_check, complete with referrer, j_username and j_password? Any suggestions or comments are welcome and appreciated. Trying to forward security credentials like this is pretty much guaranteed not to work. One thing you might consider using is Tomcat's standard support for single sign on across multiple webaps. Check out the Single Sign On section Thanks for the response. Your suggestion is only applicable for those who have a homogenous Tomcat environment. In my situation, my portal will have to forward to a mixed environment of Tomcat and JRun servers. In the future that may expand to include either WebLogic or WebSphere. I find it hard to believe that there is no way to programmatically manage a login sequence using j_security_check. Is it possible to use a servlet intermediary to handle the login interaction and then redirect the user to a protected resource once the login sequence is successfully completed? Hard to believe or not, the servlet spec is totally silent about programmatic interaction with j_security_check. That means there is absolutely no guarantee of behavior consistency in this regard across servlet containers -- or even across different versions of the same container (Tomcat 3.3 and 4.x do things very differently in this regard, for example). Your use case is something that things like the Liberty Alliance http://www.projectliberty.org are trying to solve. Unfortunately, you're a bit early on the adoption curve for that to be helpful. About the only portable thing you can do in the mean time would be a proxy app that your users always went through for every request, which knows how to do the login interaction with each back end app as needed (i.e. whenever they challenge for credentials, answer based on what it knows about this user, but pass all other requests through). But the performance impact of such a proxy isn't going to be very attractive. Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: forwarding through j_security_check
On Mon, 15 Jul 2002, James Krygowski wrote: Date: Mon, 15 Jul 2002 08:55:59 -0400 From: James Krygowski [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: forwarding through j_security_check Hi All- I'm working on a web-app launcher. The essential idea is to provide users with a centralized, secure web portal from which they can launch other web applications. The other applications will reside in Tomcat servers different from the portal Tomcat server. Each application will be protected by standard J2EE security implemented with j_security_check. I'd like to be able to forward to applications and automatically negotiate the j_security_check so that user's don't have to log on once they've already presented their credentials to the portal application (i.e. single sign-on). Is it possible to formulate an href url that simultaneously specifies the target resource and the credentials being passed to j_security_check? I note that in the packet sent in the j_security_check post, all the information needed is present. If the read the packet right, the Referrer in the http header contains the information about the desired protected resource. Is this Referrer used by j_security_check to forward a request on to the desired destination? No, it is not. When form based login detects the need to challenge the user for credentials, it saves an internal copy of the original request, and replays it once the user is successfully authenticated. If so, is it possible to set up a servlet that could manipulate the Referrer in the header, and redirect a request along to an application in another Tomcat server, making it look like a post to j_security_check, complete with referrer, j_username and j_password? Any suggestions or comments are welcome and appreciated. Trying to forward security credentials like this is pretty much guaranteed not to work. One thing you might consider using is Tomcat's standard support for single sign on across multiple webaps. Check out the Single Sign On section on: http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/host.html Thanks, Jim Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: forwarding wrapped request:lost parameter???
On Wed, 5 Jun 2002, Liu, Xiaoyan wrote: Date: Wed, 5 Jun 2002 13:54:27 -0400 From: Liu, Xiaoyan [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Subject: forwarding wrapped request:lost parameter??? Hi, I have a question about request forwarding. We use three filters in the chain, the very first filter wraps HttpServeletRequest( it extends HttpServletRequestWrapper) and passes down the chain. The third filter forwards the request to different jsp pages based on user input. What we have experienced is that sometimes the wrapped request is missing posted parameters while calling 'getParameter' on the original one (non-wrapped) returns sth. This happens in a random fashion. question: which request tomcat forwards: wrapped one or non-wrapped one? Is there sth we are not doing right? The request that is seen by the forwarded-to servlet is the request wrapper that your application created -- Tomcat implements request dispatcher forwarding with a wrapper of it's own, but this is placed underneath any application-provided wrappers. One way to cause the problem you are seeing is if your wrapper overrides getParameter() and doesn't delegate it to the real request that it is wrapping. If that is happening to you, then it's a bug in your wrapper. thanks. Liu Capitalthinking.com Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Forwarding requests to other Services?
You could either use response.sendRedirect to the servlet or jva.net.URLConnection to call the other servlet and then stream the output from the servlet to your response.getOutputStream. Randy -Original Message- From: Scott Shorter [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 10:09 AM To: 'Tomcat Users List' Subject: Forwarding requests to other Services? All, I read in the API that the path to use as a parameter to ServletRequest.getRequestDispatcher(String path) cannot extend beyond the current context. This is a problem, because I need to forward a request to a servlet that listens on a different port, and hence is part of a different service and different context. Can someone recommend a solution? Thanks in advance, Scott -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: Forwarding requests to other Services?
I was afraid you would say that. Bleah. Of course the good news about that is I realized that the other servlet then tries to forward back to the first after it's done its thing. I'll try redirects instead and see how that works. Will the redirect maintain request attributes like forward will? Thanks, Scott -Original Message- From: Randy Layman [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 9:31 AM To: 'Tomcat Users List' Subject: RE: Forwarding requests to other Services? You could either use response.sendRedirect to the servlet or jva.net.URLConnection to call the other servlet and then stream the output from the servlet to your response.getOutputStream. Randy -Original Message- From: Scott Shorter [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 10:09 AM To: 'Tomcat Users List' Subject: Forwarding requests to other Services? All, I read in the API that the path to use as a parameter to ServletRequest.getRequestDispatcher(String path) cannot extend beyond the current context. This is a problem, because I need to forward a request to a servlet that listens on a different port, and hence is part of a different service and different context. Can someone recommend a solution? Thanks in advance, Scott -- To unsubscribe: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: Forwarding requests to other Services?
Response.sendRedirect sends the client web browser a Resource Temporarily Moved header (I believe its header 302). The client then makes a second request to the referred resource. If you want any parameters passed, you must put them in the redirected resource URL yourself, and you are limited to GET parameters. Example - response.sendRedirect(http://otherserver:443/path/to/other/servlet?ID=value id2=value); Also you must return from the method that sends this because all its really doing is calling setHeader. Randy -Original Message- From: Scott Shorter [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 10:20 AM To: 'Tomcat Users List' Subject: RE: Forwarding requests to other Services? I was afraid you would say that. Bleah. Of course the good news about that is I realized that the other servlet then tries to forward back to the first after it's done its thing. I'll try redirects instead and see how that works. Will the redirect maintain request attributes like forward will? Thanks, Scott -Original Message- From: Randy Layman [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 9:31 AM To: 'Tomcat Users List' Subject: RE: Forwarding requests to other Services? You could either use response.sendRedirect to the servlet or jva.net.URLConnection to call the other servlet and then stream the output from the servlet to your response.getOutputStream. Randy -Original Message- From: Scott Shorter [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 10:09 AM To: 'Tomcat Users List' Subject: Forwarding requests to other Services? All, I read in the API that the path to use as a parameter to ServletRequest.getRequestDispatcher(String path) cannot extend beyond the current context. This is a problem, because I need to forward a request to a servlet that listens on a different port, and hence is part of a different service and different context. Can someone recommend a solution? Thanks in advance, Scott -- To unsubscribe: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: Forwarding JSP and Browser Options
I guess you could use something like this : html script function changeBrowser() { window.open(attribs) //open new window with/without desired attributes. //put focus onto new window window.close() //close the window that originated the request. } /script body onload=changeBrowser()/body/html this is the normal way of dealing with new windows. -r Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 14, 2001 5:08 PM To: [EMAIL PROTECTED] Subject: Forwarding JSP and Browser Options When forwarding a JSP you loose the ability to change the browser options like removing statusbar, menubar, toolbar and locationbar as you do in the JavaScript OPEN function. How can do this from either within my JSP page or from the servlet forwarding the JSP? Thanks in advance Jeff Sulman
Re: Forwarding JSP and Browser Options
Popup windows are best left to JavaScript. I suppose one could create JavaScript code via out.println within % tag , but too much work for nothing. R/L - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 14, 2001 1:07 PM Subject: Forwarding JSP and Browser Options When forwarding a JSP you loose the ability to change the browser options like removing statusbar, menubar, toolbar and locationbar as you do in the JavaScript OPEN function. How can do this from either within my JSP page or from the servlet forwarding the JSP? Thanks in advance Jeff Sulman
Re: Forwarding in Tomcat
The rest of the code should execute normally after the forward. It is my understanding that calling forward simply tags the HttpRequest object, telling the app server to forward it to the target servlet upon completetion of the code. In fact if, in the doGet() method of Servlet0, you forward to Servlet1, and then (one line later), forward to Servlet2, the rest of the code in servlet0 will execute, and the request will be forwarded to Servlet 2. I haven't tried this, specifically in Tomcat, but that's the way it works in WebSphere... Cheers, E. From: Dan Randall [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Forwarding in Tomcat Date: Tue, 08 May 2001 10:28:23 -0700 Hi, Using tomcat as my servlet container, if I use the forward method of a dispatcher object, say to forward an object attached to the HttpResponse to a JSP, will code after the forward in the servlet be executed normally? Will a try...finally insure that the remaining code is executed? Is the try finally necessary? In a nutshell, I guess, does the forward method permanently exit a servlet method such as doGet()? Thanks! Dan _ Get your FREE download of MSN Explorer at http://explorer.msn.com
Re: Forwarding
forward() will only send it to another servlet or jsp, I think. However, sendRedirect() will work with external URLs. Just do response.sendRedirect(http://www.misMuelas.com;); Un saludo, Alex. Zsolt Koppany wrote: Thank you for the idea, I know the jsp:forward command but I was not able to forward to a complete different URL for example http://www.sun.com:8080;. Do you know how to do that? Zsolt Barthélémy TEHAM wrote: by using jsp:forward Action exple: jsp:forward page=dest.jsp / Documentation source: http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-JSP.html#Section8.6 --- Zsolt Koppany [EMAIL PROTECTED] a écrit : Hi, how can I forward to a page that the user does not see where he was forwarded to? The reason is, we might change the target host or page and if the user makes a bookmark to the forwarded page he cannot come back if we change the target host or the page. Zsolt -- Zsolt Koppany Intland GmbH www.intland.com Schulze-Delitzsch-Strasse 16 D-70565 Stuttgart Tel: +49-711-7871080 Fax: +49-711-7871017 = Barthélémy TEHAM - E-mail : [EMAIL PROTECTED] Website: http://teham.free.fr ___ Do You Yahoo!? -- Pour faire vos courses sur le Net, Yahoo! Shopping : http://fr.shopping.yahoo.com -- Zsolt Koppany Intland GmbH www.intland.com Schulze-Delitzsch-Strasse 16 D-70565 Stuttgart Tel: +49-711-7871080 Fax: +49-711-7871017
Re: Forwarding
by using jsp:forward Action exple: jsp:forward page=dest.jsp / Documentation source: http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-JSP.html#Section8.6 --- Zsolt Koppany [EMAIL PROTECTED] a écrit : Hi, how can I forward to a page that the user does not see where he was forwarded to? The reason is, we might change the target host or page and if the user makes a bookmark to the forwarded page he cannot come back if we change the target host or the page. Zsolt -- Zsolt Koppany Intland GmbH www.intland.com Schulze-Delitzsch-Strasse 16 D-70565 Stuttgart Tel: +49-711-7871080 Fax: +49-711-7871017 = Barthélémy TEHAM - E-mail : [EMAIL PROTECTED] Website: http://teham.free.fr ___ Do You Yahoo!? -- Pour faire vos courses sur le Net, Yahoo! Shopping : http://fr.shopping.yahoo.com
Re: Forwarding
Thank you for the idea, I know the jsp:forward command but I was not able to forward to a complete different URL for example http://www.sun.com:8080;. Do you know how to do that? Zsolt Barthélémy TEHAM wrote: by using jsp:forward Action exple: jsp:forward page=dest.jsp / Documentation source: http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-JSP.html#Section8.6 --- Zsolt Koppany [EMAIL PROTECTED] a écrit : Hi, how can I forward to a page that the user does not see where he was forwarded to? The reason is, we might change the target host or page and if the user makes a bookmark to the forwarded page he cannot come back if we change the target host or the page. Zsolt -- Zsolt Koppany Intland GmbH www.intland.com Schulze-Delitzsch-Strasse 16 D-70565 Stuttgart Tel: +49-711-7871080 Fax: +49-711-7871017 = Barthélémy TEHAM - E-mail : [EMAIL PROTECTED] Website: http://teham.free.fr ___ Do You Yahoo!? -- Pour faire vos courses sur le Net, Yahoo! Shopping : http://fr.shopping.yahoo.com -- Zsolt Koppany Intland GmbH www.intland.com Schulze-Delitzsch-Strasse 16 D-70565 Stuttgart Tel: +49-711-7871080 Fax: +49-711-7871017
RE: Forwarding
Create an frameset document with one frame. Your servlet produces the frameset, the target of the one frame is the new URL you want. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Zsolt Koppany Sent: Saturday, April 28, 2001 11:07 AM To: [EMAIL PROTECTED] Subject: Re: Forwarding Thank you for the idea, I know the jsp:forward command but I was not able to forward to a complete different URL for example http://www.sun.com:8080;. Do you know how to do that? Zsolt Barthélémy TEHAM wrote: by using jsp:forward Action exple: jsp:forward page=dest.jsp / Documentation source: http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-JSP.html #Section8.6 --- Zsolt Koppany [EMAIL PROTECTED] a écrit : Hi, how can I forward to a page that the user does not see where he was forwarded to? The reason is, we might change the target host or page and if the user makes a bookmark to the forwarded page he cannot come back if we change the target host or the page. Zsolt -- Zsolt Koppany Intland GmbH www.intland.com Schulze-Delitzsch-Strasse 16 D-70565 Stuttgart Tel: +49-711-7871080 Fax: +49-711-7871017 = Barthélémy TEHAM - E-mail : [EMAIL PROTECTED] Website: http://teham.free.fr ___ Do You Yahoo!? -- Pour faire vos courses sur le Net, Yahoo! Shopping : http://fr.shopping.yahoo.com -- Zsolt Koppany Intland GmbH www.intland.com Schulze-Delitzsch-Strasse 16 D-70565 Stuttgart Tel: +49-711-7871080 Fax: +49-711-7871017
Re: Forwarding to a JSP gives a callback
[EMAIL PROTECTED] wrote: Hi I'm trying to forward from my controller servlet to a jsp or html page. This is not very successful at all, and I think this is because the servlet for some reason get's called a second time after the forward for some reason. An example: The servlet is invoked by a form-post. It extracts the data of interest and calls another page (jsp or html) by usingdispatcher.forward(blah blah). This should work, but what I notice is that the doGet() within the servlet gets invoked after the forward (which was done from the doPost), and the page that was forwarded to never writes it's content to the browser. It's just blank. What am I doing wrong? Regards /Ola PS Sorry about the mailformat, notes doesn't seem to care about my attempts to get to understand that this should be plain text :( DS - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] Perhaps you want to check your servlet-mapping: Is the servlet itself mapped to a url-pattern that matches the dispatcher destination url ? In that case you would get the behaviour described. Paul -- Paul Marshall [EMAIL PROTECTED] 089/26019-609 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Forwarding Servlet/JSP Request to Tomcat from Apache
I have this exact problem, hope someone else can help. S - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]