tomcat's webdav and Premature End of File error ...

2003-07-15 Thread Dinh, Chinh
Hi ,
I am testing Tomcat's webdav and could open the webdav as a web folder.  When I double 
clicked on a MSOffice (MSWord, PPT, etc.) from the browsed folder, the files could be 
opened fine.  However, with any other files (zip, pdf, txt, xml), it gave me the error 
:
[Fatal Error] :-1:-1: Premature end of file.
org.xml.sax.SAXParseException: Premature end of file.
 at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
 at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
 at WebdavServlet.doPropfind(IMOWebdavServlet.java:356)

The exception was thrown at   Document document = documentBuilder.parse
   (new InputSource(req.getInputStream()));
in webdavservlet's doPropfind() .
Is there a solution for this problem ? Thank you very much .  

Another problem is that , every time I double click on a file, it asks me to log in 
again with the login dialog box (even though I already logged in after browsing to the 
web folder).
- Chinh


-
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

Re: AUTHENTICATE question with WEBDAV.

2003-07-11 Thread Dinh, Chinh
Thanks, Bill . 
In BasicAuthenticator.java , the authenticate() method gets the username and password 
by calling :

String authorization = request.getAuthorization();

which gets the value from the authorization request header, which is  the value to 
be base 64 encoded of username and password.  My goal is to set this request with the 
correct authorization header so that I can bypass the Login dialog if the username 
and password are already got before the request (before the user enters 
http:///webdav to run the webdav servlet).  I have no clue how to do this ... 
What's the purpose of a VALVE class ?  Thanks. 


Bill Barker [EMAIL PROTECTED] wrote:
The simplest solution is to enable the SingleSignOnValve. This allows any
login to any Context to be passes to any other Context. If this doesn't
meet your needs, then you can:
1) Write a custom Valve to pickup the User.
2) Write a custom Authenticator that knows how to pickup the User.

Dinh, Chinh wrote in message
news:[EMAIL PROTECTED]

 I have a question about WEBDAV and How authenticate works.

 If i have this in web.xml

 
 BASIC
 MyCustomRealm
 

 It will get an Popup Log in dialog, and it will invoke my realm's
 authenticate() method, with username and password being entered by
 the user.

 However, I do not want the log in dialog to pop up in all cases.
 There's a case that the user is already authenticated BEFORE he tries
 to run the webdav servlet, and in this case, he wants to bypass the
 log in dialog.

 Do you know How to pass in the Authenticator class some information
 so that it doesn't need to invoke the login dialog if the user is already
 authenticated ? What information would the authenticator need ?

 Thanks.
 - Chinh



 -
 Do you Yahoo!?
 SBC Yahoo! DSL - Now only $29.95 per month!




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

Please Help : STRANGE WEBDAV problem with the setting in WEB.XML

2003-07-11 Thread Dinh, Chinh
Hi,
If you install Tomcat 4, you should be able to open webdav as a webfolder by doing : 
http://localhost:8080/webdav (open as a webfolder).  However, if I change the webdav 
servlet name to another name (eg. mywebdav), and try to open 
http://localhost:8080/mywebdav, it gave me the error cannot open http://.. as a 
web folder !.  
Is there a hard-coded path somewhere ?  Does the implementation of webdav servlet have 
some kind of forward to /webdav  Thanks .
- Chinh
 
servlet
servlet-namemywebdav/servlet-name
servlet-classorg.apache.catalina.servlets.WebdavServlet/servlet-class
init-param
  param-namedebug/param-name
  param-value0/param-value
/init-param
init-param
  param-namelistings/param-name
  param-valuetrue/param-value
/init-param
!-- Uncomment this to enable read and write access --
init-param
  param-namereadonly/param-name
  param-valuefalse/param-value
/init-param
!--load-on-startup1/load-on-startup--
  /servlet
  !-- The mapping for the webdav servlet --
  servlet-mapping
servlet-namemywebdav/servlet-name
url-pattern//url-pattern
  /servlet-mapping



-
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

AUTHENTICATE question with WEBDAV.

2003-07-10 Thread Dinh, Chinh

I have a question about WEBDAV and How authenticate works.

If i have this in web.xml

login-config
  auth-methodBASIC/auth-method
  realm-nameMyCustomRealm/realm-name
/login-config

It will get an Popup Log in dialog, and it will invoke my realm's 
authenticate() method, with username and password being entered by
the user.

However, I do not want the log in dialog to pop up in all cases.
There's a case that the user is already authenticated BEFORE he tries
to run the webdav servlet, and in this case, he wants to bypass the 
log in dialog. 

Do you know How to pass in the Authenticator class some information 
so that it doesn't need to invoke the login dialog if the user is already
authenticated ? What information would the authenticator need ?

Thanks.
- Chinh



-
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

getParameter does not work with webdav servlet

2003-07-10 Thread Dinh, Chinh

Hi 

I found an interesting problem ...

If I run http://../webdavservlet?param1=YYY

 

req.getParameter(param1) returns “YYY”  ONLY IF I run the webdav servlet in the 
regular way (open IE - type in the URL and return).  If I run webdav servlet the 
“webdav” way (File | Open – choose “Open as  webfolder” as you enter the same URL), 
req.getParameter(param1) returns NULL . 



Do you have any idea ? Is it possible to get the parameter from webdav servlet if we 
run webdav as  a webfolder ? Thanks.

- Chinh


-
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

WEBDAV and FORM-Based Authentication

2003-07-10 Thread Dinh, Chinh

Does anyone know if it is possible to have a FORM-based authentication with webdav 
servlet (which is open as a web folder). 

I have tried, but unsuccessfully.  If a servlet runs in a regular way (HTTP://), 
the form log-in page is displayed.  However, if the webdav servlet is open the 
webdav way (as a web folder), the form is never displayed ?  

Thanks . 

- Chinh


-
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

Re: REALM question - please help

2003-06-27 Thread Dinh, Chinh
Thanks for your help . I'm new to TOMCAT , so I may have some confusion.
I thought it's the way that TOMCAT does.  We have to use REALM to authenticate as we 
define this in web.xml :

  login-config
auth-methodBASIC/auth-method
realm-nameMyRealm/realm-name
  /login-config
 
It will pop up a log in box, and Realm's authentication method will does the 
authentication.   After the Login , it 'll call the Servlet's service().   In the 
Realm class, which extends org.apache.catalina.realm.RealmBase, there is no access to 
HttpRequest, Response, or Session at this point .  How do I store a data member of the 
Realm class some where (?) so that my servlet can access to it ? Or is it something 
that should never be done ? What'd be an alternative solution ?  I don't think Filter 
serves the goal that I describe above, am I correct ? 
Thank you very much. - Chinh

Bill Barker [EMAIL PROTECTED] wrote:
I agree with Jean-Francois that the design is less than perfect ;-). You
should probably re-think it. However, I'm willing to give you more than
enough rope to hang yourself ;-).

1) If your custom Realm is configured under a , then simply
have if save an instance of itself into the Session.
2) If not, or otherwise, have it set a request-attribute with itself as the
value.

Dinh, Chinh wrote in message
news:[EMAIL PROTECTED]
 Thanks for the response. My situation is like this:
 - I created my own Realm for webDAV access. When I launch
http://localhost:8080/webdav, it will first call myREalm's authentication().
Within authentication(), I calls some existing authentication class, which
returns a USER object (basically, has some application specific user
properties).
 - After the authentication is successful (from a Log-in Dialog box, for
example), it will get to my servlet (in this case, a webDAVservlet). In this
webDavServlet, I would like to get the USER object that I stored as a data
member in my Realm class.
 - That is the reason I want to be able to get the realm object from the
servlet. Any advise ? Thanks . - Chinh
 Jean-Francois Arcand wrote:


 Dinh, Chinh wrote:

 I have a tomcat question for you .
 
 
 
 In Tomcat's server.xml, we define a realm (only ONE)
 
 
 
 
 
 When tomcat starts, I think it will instantiate a realm object of this
type .
 
 
 
 I am trying to find a way to access this realm object in my servlet (the
servlet that starts after the realm's authentication
 
 succeeds).
 
 There's a method getRealm() from org.apache.catalina.core.ContainerBase
, but how would we get this ContainerBase ?
 
 No. For security reason, a servlet should not have access to any Tomcat
 classes. If your app is able to have access to those methods, any
 malicious app can also have access and snif the information.

 Why do you want to have access to the realm?

 
 Does Tomcat have some kind of global object of this type ?
 

 No...and in Tomcat 5,we have enforced the security protection mechanism
 so it is mostly impossible to invoke Tomcat internal classes (when the
 security manager is turned on)

 
 
 
 Thank you . Chinh
 

 -- Jeanfrancois

 
 
 
 -
 Do you Yahoo!?
 SBC Yahoo! DSL - Now only $29.95 per month!
 
 
 


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 -
 Do you Yahoo!?
 SBC Yahoo! DSL - Now only $29.95 per month!




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

REALM question - please help

2003-06-26 Thread Dinh, Chinh

I have a tomcat question for you . 

 

In Tomcat’s server.xml, we define a realm (only ONE)

Realm classname = “com.mypackage.myRealm” 

 

When tomcat starts, I think it will instantiate a realm object of this type .  

 

I am trying to find a way to access this realm object in my servlet (the servlet that 
starts after the realm's authentication 

succeeds).

There’s a method “getRealm()” from org.apache.catalina.core.ContainerBase , but how 
would we get this ContainerBase ?

Does Tomcat have some kind of global object of this type ?



Thank you . Chinh



-
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

Re: REALM question - please help

2003-06-26 Thread Dinh, Chinh
Thanks for the response. My situation is like this:
-  I created my own Realm for webDAV access.  When I launch 
http://localhost:8080/webdav, it will first call myREalm's authentication().  Within 
authentication(), I calls some existing authentication class, which returns a USER 
object (basically, has some application specific user properties).  
-  After the authentication is successful (from a Log-in Dialog box, for example), it 
will get to my servlet (in this case, a webDAVservlet). In this webDavServlet, I would 
like to get the USER object that I stored as a data member in my Realm class.  
- That is the reason I want to be able to get the realm object from the servlet.   Any 
advise ? Thanks . - Chinh
Jean-Francois Arcand [EMAIL PROTECTED] wrote:


Dinh, Chinh wrote:

I have a tomcat question for you . 

 

In Tomcat’s server.xml, we define a realm (only ONE)

 

 

When tomcat starts, I think it will instantiate a realm object of this type . 

 

I am trying to find a way to access this realm object in my servlet (the servlet that 
starts after the realm's authentication 

succeeds).

There’s a method “getRealm()” from org.apache.catalina.core.ContainerBase , but how 
would we get this ContainerBase ?

No. For security reason, a servlet should not have access to any Tomcat 
classes. If your app is able to have access to those methods, any 
malicious app can also have access and snif the information.

Why do you want to have access to the realm?


Does Tomcat have some kind of global object of this type ?


No...and in Tomcat 5,we have enforced the security protection mechanism 
so it is mostly impossible to invoke Tomcat internal classes (when the 
security manager is turned on)




Thank you . Chinh


-- Jeanfrancois




-
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

TOMCAT webDAV question

2003-06-23 Thread Dinh, Chinh
Hi 
I am trying to use Tomcat's implementation of WEBDAV for my file upload
requirement .After deploying webDAV as a web folder, I need to open to
webdav as a webfolder, and upload files by dragging them over from Windows
Explorer to IE . 
 
By default, Tomcat's webDAV does not have a configurable property where we
can set the rootpath of where the files will be uploaded to (eg. C:/tmp).  I
think TOMCAT's implementation PUTs the file based on a relative path to
the webdav web app directory .
 
Right now, when you drag a file over to the webdav folder, it's treated as a
PUT method, and it will invoke DefaultServlet's service() to do the
uploading.
 
Do you know if it is possible to set an absolute root path with Tomcat's
webDAV ? if it's not configurable, how would we change the code to do this ?

 
I have been looking at WebDAVServlet, but found no solution yet how to
control where the files will be sent to .  
 
- Ch