Re: How to change effective user id on Windows

2010-01-08 Thread Jim Ma

勹

发自我的 iPod

在 Jan 7, 2010,22:42,Looijmans, Mike mike.looijm...@oce.com 写到:

The current configuration is correct in terms of security - the  
'SYSTEM'

user is a limited account that has no access to the desktop nor shared
network resources.

Be warned that running a service under other credentials than the  
system

user is likely to lead to a less secure configuration, instead of
improving.

M.


-Original Message-
From: Amit Agarwal [mailto:ami@gmail.com]
Sent: donderdag 07 januari 2010 15:08
To: users@tomcat.apache.org
Subject: How to change effective user id on Windows

Tomat on Linux starts as root to bind to port 80, and then
switches effective user id to nobody. Windows does not appear
to have concept of changing effective user. Tomcat service
runs as a local system on Windows. Need to change the user
for Tomcat after binding to port 80.

How can this be achieved?

--

Sent from Karnataka, India



This message and attachment(s) are intended solely for use by the  
addressee and may contain information that is privileged,  
confidential or otherwise exempt from disclosure under applicable law.


If you are not the intended recipient or agent thereof responsible  
for delivering this message to the intended recipient, you are  
hereby notified that any dissemination, distribution or copying of  
this communication is strictly prohibited.


If you have received this communication in error, please notify the  
sender immediately by telephone and with a 'reply' message.


Thank you for your co-operation.



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



MapListener update

2009-07-14 Thread jim ma
Hi ,

When I update my code for embedding tomcat 5.x to embedding 6.x, a null
pointer exception blocks me .
I dug the code , I found it cause by the
org.apache.catalina.connector.MapperListener difference :

Tomcat5.x
---
/**
 * Register host.
 */
private void registerHost(ObjectName objectName)
throws Exception {
String name=objectName.getKeyProperty(host);
if( name != null ) {
String[] aliases = (String[])
mBeanServer.invoke(objectName, findAliases, null, null);
mapper.addHost(name, aliases, objectName);
if(log.isDebugEnabled())
log.debug(sm.getString
 (mapperListener.registerHost, name, domain));

}
}

Tomcat6.x
-
/**
 * Register host.
 */
private void registerHost(ObjectName objectName)
throws Exception {
String name=objectName.getKeyProperty(host);
if( name != null ) {
Host host = (Host) ServerFactory.getServer().findService(
domain).getContainer().findChild(name);
String[] aliases = host.findAliases();
mapper.addHost(name, aliases, objectName);
host.addContainerListener(this);
if(log.isDebugEnabled())
log.debug(sm.getString
 (mapperListener.registerHost, name, domain));

}
}


Is this change to fix an issue ? Or Tomcat6.x totally change the host name
looking up mechanism .
Could you also point to me where can I find the Tomcat6.x document about
difference with Tomcat5.x if there is ? for example architecture , execution
etc.

Thanks in advance .

Jim Ma


Re: How to prevent Tomcat redirect my request

2008-11-21 Thread jim ma
On Fri, Nov 21, 2008 at 10:53 AM, Caldarale, Charles R 
[EMAIL PROTECTED] wrote:

  From: jim ma [mailto:[EMAIL PROTECTED]
  Subject: Re: How to prevent Tomcat redirect my request
 
  If I get 302 response and write some code to resend
  quest to the redirected location

 The point everyone's trying to make is that you should send the correct URL
 the *first* time, rather than sending one that doesn't comply with the HTTP
 spec and letting Tomcat correct it for you.


Thanks , Chunk.  The problem is that I can not simply correct that URL and
send it for the f
first  time.   The request url is generated by other  application or in some
condition sometimes provided by  user . The client side  can not  judge 
http://localhost:8080/foo;  is a request for foo   resource in root
context or a request url for the default page in foo context.   Server side
has that information and can judge it .  If there is a foo context , it will
reply the redirect response.
httpunit can help that.  Actually I want to know if there is second
option(configure tomcat to support that ) .


Re: How to prevent Tomcat redirect my request

2008-11-21 Thread jim ma
 Tell your clients to generate URLs like:
 http://host/your_servlet?url=url_to_fetch
 In other words you should implemet proxy that will handle redirects itself.
 Finally, your clients will not see any 302 redirects.


I like this idea.  It is greatly helpful  , I think it works for my problem.




 --
 Mikolaj Rydzewski [EMAIL PROTECTED]


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




How to prevent Tomcat redirect my request

2008-11-20 Thread jim ma
Hi all,
I deployed a web application foo.war into tomcat 5.x .  When I used
httpclient to send post request to http://localhost:8080/foo;, I always
get the http 302 redirect response .  How can I prevent Tomcat to reply
redirect response and directly adding the slash  to my request
url http://localhost:8080/foo/; to get what I want . I see web browser can
automcatically resend the request to redirected location but httpclient
can not.  Is there  configurations for that ?   Could anyone shed  some
lights ?

Thanks

Jim


Re: How to prevent Tomcat redirect my request

2008-11-20 Thread jim ma
Great thanks , Kees.  I will try httpunit .

I still want to know if it is possible to  stop Tomcat from redirecting. If
yes, that will be zero code effort for our current implementation.

Thanks

Jim


On Thu, Nov 20, 2008 at 5:51 PM, Kees Jan Koster [EMAIL PROTECTED] wrote:

 Dear Jim,


  I deployed a web application foo.war into tomcat 5.x .  When I used
 httpclient to send post request to http://localhost:8080/foo;, I always
 get the http 302 redirect response .  How can I prevent Tomcat to reply
 redirect response and directly adding the slash  to my request
 url http://localhost:8080/foo/; to get what I want . I see web browser
 can
 automcatically resend the request to redirected location but httpclient
 can not.  Is there  configurations for that ?   Could anyone shed  some
 lights ?


 I usually use httpunit, not httpclient. The advantage is that it does all
 the cookies, 302 responses and lord knows what else in the HTTP protocol,
 allowing me to focus on the logic instead of the protocol.

 Maybe that's an alternative route for you, if Tomcat cannot be stopped from
 redirecting your app.
 --
 Kees Jan

 http://java-monitor.com/forum/
 [EMAIL PROTECTED]
 06-51838192

 Rule 1 for being in a hole: stop digging.


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: How to prevent Tomcat redirect my request

2008-11-20 Thread jim ma
On Thu, Nov 20, 2008 at 6:19 PM, Mikolaj Rydzewski [EMAIL PROTECTED] wrote:

 jim ma wrote:

 I still want to know if it is possible to  stop Tomcat from redirecting.
 If
 yes, that will be zero code effort for our current implementation.


 Why is it a problem for you to use http://localhost:8080/foo/ URL?


 Because I would like to let tomcat server http://localhost:8080/foo
successfully and do not reply a redirect response and resend that redirected
location .  It
is more efficient , right ?


 --
 Mikolaj Rydzewski [EMAIL PROTECTED]



 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: How to prevent Tomcat redirect my request

2008-11-20 Thread jim ma
On Thu, Nov 20, 2008 at 6:48 PM, André Warnier [EMAIL PROTECTED] wrote:

 Mikolaj Rydzewski wrote:

 jim ma wrote:

 I still want to know if it is possible to  stop Tomcat from redirecting.
 If
 yes, that will be zero code effort for our current implementation.


 Why is it a problem for you to use http://localhost:8080/foo/ URL?

  I agree with the above, but in case it is not an option, you may want to
 look at something like this :

 http://www.tuckey.org/urlrewrite/

 It does many more things, but I guess it can rewrite /foo into /foo/
 internally too.



 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: How to prevent Tomcat redirect my request

2008-11-20 Thread jim ma
On Thu, Nov 20, 2008 at 6:48 PM, André Warnier [EMAIL PROTECTED] wrote:

 Mikolaj Rydzewski wrote:

 jim ma wrote:

 I still want to know if it is possible to  stop Tomcat from redirecting.
 If
 yes, that will be zero code effort for our current implementation.


 Why is it a problem for you to use http://localhost:8080/foo/ URL?

  I agree with the above, but in case it is not an option, you may want to
 look at something like this :

 http://www.tuckey.org/urlrewrite/

 It does many more things, but I guess it can rewrite /foo into /foo/
 internally too.


 I  just debugged the code. It returns http status code 302 and redirected
location  http://localhost:8080/foo/ before reach the code related to url
rewrite configuration in web.xml .





 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: returning error messages from tomcat to http clients?

2008-11-20 Thread jim ma
The simple way is returning the http OK  200 status code instead of  500 ,
and set the error message to response body.  Does it work for you ?

On Thu, Nov 20, 2008 at 9:20 PM, Padraig O'Dowd [EMAIL PROTECTED] wrote:

 Hi, I'm encountering the following problem and just wanted to find out
 if there is a way to disable this in tomcat?

 In my web app in tomcat, I do the following -
 response.setError(My error message);

 but when tomcat returns the response, it detects that the connecting
 client is using http and then embeds the error message in html - is
 there a way to stop this and just get tomcat to return my error message?

 Thanks,
 Padraig O'Dowd


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: How to prevent Tomcat redirect my request

2008-11-20 Thread jim ma
On Thu, Nov 20, 2008 at 10:24 PM, André Warnier [EMAIL PROTECTED] wrote:

 jim ma wrote:

 On Thu, Nov 20, 2008 at 6:48 PM, André Warnier [EMAIL PROTECTED] wrote:

  Mikolaj Rydzewski wrote:

  jim ma wrote:

  I still want to know if it is possible to  stop Tomcat from
 redirecting.
 If
 yes, that will be zero code effort for our current implementation.


  Why is it a problem for you to use http://localhost:8080/foo/ URL?

  I agree with the above, but in case it is not an option, you may want
 to

 look at something like this :

 http://www.tuckey.org/urlrewrite/

 It does many more things, but I guess it can rewrite /foo into /foo/
 internally too.


  I  just debugged the code. It returns http status code 302 and redirected
 location  http://localhost:8080/foo/ before reach the code related to url
 rewrite configuration in web.xml .

  Yes, that's true of course. Stupid me.
 Urlrewrite is a servlet filter, so it will not see the request before it
 has been directed to the webapp, and thus the redirect will happen before.
 Duh.
 I guess you would need some kind of re-directing Valve for that.


I also try to add a rewrite Valve to StandardEngine. And it is also does not
work . Before reach that Valve, tomcat already replied that
redirect response.



 Now, about what Mikolaj wrote before (using the /foo/ URL) I think you
 misunderstand what he is saying.
 What he meant is probably this :
 You seem to be using a http client that is not a browser, but some kind of
 program or module.  Can you not make sure that this program or module does
 not send URLs like /foo, but itself transforms them into /foo/ at the
 source ?


Yes , I can do that . If I get 302 response and write some code to resend
quest to the redirected location, then I can always get what I want . It is
not efficient , you know.  It needs to talk to tomcat server twice . Is
there shortcut way to do that ?