comp.lang.java.programmer
http://groups-beta.google.com/group/comp.lang.java.programmer
[EMAIL PROTECTED]

Today's topics:

* Tomcat and jTDS - not that stable... - 2 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4c23245a26d17c26
* Advice on persistent storage in Java? - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e1b92789433bcb07
* get Tomcat 5 to compile at startup? - 2 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/80990d518d14af33
* Apache 2.0.52 + Tomcat 5.0.28 + mod_jk - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/109f8ba02c1a89f0
* List<? super String> - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/82c580e853a95768
* Information on nested properties??? - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/77982b15b05606f9
* Problem in IE while loading Java Applets on Macintosh OS X - 1 messages, 1 
author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ed6485b84bbb5c1
* NIO CPU Anomaly - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/987b5a76739f16c8
* Using struts for server validation - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/21986e438a01d706
* javax/comm/SerialPortEventListener - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d845f15727eef628
* jsp, containers, beans and persistence - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/47085d2436bae214
* java.lang.OutOfMemoryError - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7dfb5d2d1250de90
* TCHAR in c++ to string in java - 6 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dce48222b7374509
* Writing to URL connection-concurency - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/399db37022b091b7
* Searching for (and remove) unreferenced methods - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6cf6cff59129ad70
* Help: Display Modification on a sync slideshow program - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2d84ab993c92e5cb
* TCP connection reply - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cdd6db89f754b326
* STRUTS & Active Directory Query - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/33b3bf62773ca33f

==============================================================================
TOPIC: Tomcat and jTDS - not that stable...
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4c23245a26d17c26
==============================================================================

== 1 of 2 ==
Date: Thurs, Dec 16 2004 3:08 am
From: Rico  

On Thu, 16 Dec 2004 02:44:20 +0800, Rico wrote:

> 
> To add on, some rather weird observations:
> 
> (ii) I was previously using 'localhost' in the database connection URL.
> From comparing and double-checking the compilation dates, I am positive
> that I have uploaded onto the server a class that uses the actual computer
> name instead of 'localhost'. Despite restarting Tomcat several times and
> clearing the 'work' directory, the system is thumbing its nose at me for
> when I print out the URL it still says 'localhost'; whereas on my machine
> the computer name is printed out as expected. Where is the catche ?  :)

I hate to be responding to myself... but who cares when it's 3AM ? :P

Anyway, I've _deleted_ the class from WEB-INF/classes/misc ... and
restarted Tomcat.

The class stored the URL as a static final String... and yet Tomcat is
not complaining and happily simply still printing the URL as being the one
with localhost ... I must be missing something very obvious. :S

Rico.



== 2 of 2 ==
Date: Thurs, Dec 16 2004 3:09 am
From: Rico  

On Thu, 16 Dec 2004 03:08:25 +0800, Rico wrote:


> I hate to be responding to myself... but who cares when it's 3AM ? :P
> 
> Anyway, I've _deleted_ the class from WEB-INF/classes/misc ... and
> restarted Tomcat.
> 
> The class stored the URL as a static final String... and yet Tomcat is
> not complaining and happily simply still printing the URL as being the one
> with localhost ... I must be missing something very obvious. :S

That calls for a beer. I need a beer. Now.

Rico.





==============================================================================
TOPIC: Advice on persistent storage in Java?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e1b92789433bcb07
==============================================================================

== 1 of 1 ==
Date: Wed, Dec 15 2004 11:04 am
From: "Yamin"  

heh,

1.  Are you worried about runtime memory (that is you don't actually
want to load all the data into your program at once)?
2.  Are you  worried about the size of the persistane storage?
3.  Do you need search abilities that aren't part of your data objects?

If you answer yes to 1, then a database is probably your only choice.
I'd really only worry about this, if your data starts running into the
10s/100s of megabytes.

How about the standard java XMLEncoder class (I think its in the beans
package) as an option even though you don't want XLM or flat file.  Why
XMLEncoder/decoder? ...because its really easy to use, even though you
don't actually want to use it :)

As long as all the object you want to store:
1.  have default constructors
2.  have get/set in standard form for all members

you should be okay.  You can perform custom delegates and stuff, but
for the most part, the two rules above are plenty.

The big advantage of XMLEncoder is that you can add/delete members
without dropping file support.  I've had to use this 'feature' many
many many times.

Suppose in version1 of class ABC, there are 3 member variables m1, m2,
m3.  I save several XMLencoder files in under version1.  In version2, I
add member variable m4, and remove m2.  A version2 program can still
read a version1 file.

The downside is of course a larger file size.  If you really wanted to
be cool, you could zip the file as well, and unzip on load
(java.util.zip).  This way, you get the ease of XML encoder, with
little persistance storage.





==============================================================================
TOPIC: get Tomcat 5 to compile at startup?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/80990d518d14af33
==============================================================================

== 1 of 2 ==
Date: Wed, Dec 15 2004 7:02 pm
From: Juha Laiho  

"Mads" <[EMAIL PROTECTED]> said:
>Thanks for the quick reply, but what I'm looking for is some kind of
>setting in Tomcat 5.

AFAIK, no such thing exists -- but you can explicitly compile your
JSPs before deployment with the Jasper tool included in Tomcat
distribution. THere are even ready ant tasks to handle the
compilation.
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)



== 2 of 2 ==
Date: Tues, Dec 14 2004 4:21 am
From: [EMAIL PROTECTED] (Mads Kristiansen) 

Hi!

Is it possible to make Tomcat 5 compile all *.jsp's on startup? - Or
do something similar that will make the server compile all pages at
once?

Right now it's compiling a page the first time you make the request
from a browser  - and it takes forever to load the page. It's really a
pain.

Best regards
Mads (DK)




==============================================================================
TOPIC: Apache 2.0.52 + Tomcat 5.0.28 + mod_jk
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/109f8ba02c1a89f0
==============================================================================

== 1 of 1 ==
Date: Wed, Dec 15 2004 7:13 pm
From: Juha Laiho  

"Brent" <[EMAIL PROTECTED]> said:
>I'm trying to connect Apache 2.0.52 with Tomcat 5.0.28 using the mod_jk
>connector, to no avail.
>
>The documentation at
>http://jakarta.apache.org/tomcat/connectors-doc/index.html only really
>covers Tomcat 4.*.

There shouldn't be any major changes after that regarding mod_jk set-up.

>Has anyone been able to do this on a Windows or Linux platform?  Are
>there any good resources out there that anyone knows of that I can look
>to?

>From top of my mind, it's three/four files you're looking for:
- httpd.conf
  - module loading/initialization directives for mod_jk
  - either including mod_jk.conf to httpd.conf by a directive or
    having more or less copy of mod_jk.conf copied into httpd.conf
- mod_jk.conf
  - JkMount directives for declaring HTTP resources that should be
    served by Tomcat; here the subtrees are assigned to named
    "worker"s
  - it's possible to get Tomcat to automatically generate pretty much
    correct mod_jk.conf -files on startup
- server.xml
  - you need to set some listener for AJP13 protocol, at some given
    port (not the same as your actual WWW service port); additionally,
    I tend to limit this listener to localhost address only
- workers.properties
  - port number in here must match the port number you set up in server.xml
  - worker name in here must match the worker name you use in httpd.conf

That's pretty much it. Sorry for the lack of details, but I hope this
provides at least a checklist.

Are you seeing any error messages in any log, or are things just plain not
working without any diagnostics anywhere?
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)




==============================================================================
TOPIC: List<? super String>
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/82c580e853a95768
==============================================================================

== 1 of 1 ==
Date: Wed, Dec 15 2004 2:20 pm
From: "hilz"  

> I'm not sure what the "JDT Preview plugin" is, but even the latest eclipse
beta
> release 3.1M2 does not handle generics very well and sometimes shows
problems that
> disappear when you "clean" the Project or even persist even though the
code
> compiles fine with javac.

That's why you need to try NetBeans 4.0 (just released)!

Me ducks :)






==============================================================================
TOPIC: Information on nested properties???
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/77982b15b05606f9
==============================================================================

== 1 of 1 ==
Date: Wed, Dec 15 2004 11:21 am
From: "milkyway"  

Hello all,

Is there any place where one can find information on implementing
nested properties in a jsp? I am using the Tomcat server. It seems that
information on the net on this subject is kind of scarce ...
Is this type of approach stable as well?

Regards.





==============================================================================
TOPIC: Problem in IE while loading Java Applets on Macintosh OS X
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ed6485b84bbb5c1
==============================================================================

== 1 of 1 ==
Date: Wed, Dec 15 2004 1:47 pm
From: "Steve W. Jackson"  

In article <[EMAIL PROTECTED]>,
 "Vinu" <[EMAIL PROTECTED]> wrote:

>:Hi All,
>:
>:I am Vinodh from India. I am facing a problem in Macintosh.
>:Currently we are testing Oracle based Forms Application using Oracle 9i
>:which is entirely based on Applets.
>:
>:For invoking that application, we will be given an URL, which
>:invokes the instance for starting the oracle, basically being an Oracle
>:9i Web Services Application, initally the IE loads the Applet screen
>:followed by the application. We need to test it in Safari, Netscape and
>:IE. For Safari and Netscape, we downloaded the MRJ 2.2.5 and installed
>:the Applet Run Time Java (MRJ). The applicaiton is running smoothly in
>:Netscape and Safari.
>:
>:Where as in case of IE, the applet is not recognized while loading
>:the application. I dont know the exact reason. I think it may be the
>:problem of IE, bcoz in preferences settings there is no inclusion of
>:MRJ in Java tab. But we enabled all the predefined settings like
>:"Alert" and so on...
>:
>:
>:Till we are yet into the problem, so thats why i need your
>:suggestion in order to solve the problem.
>:
>:In case of MAc 9.2 we are testing the application using IE 5.1, in
>:that whenever we type the URL in the browser, the status bar says that
>:"Applet-Instance Started".... "Contacting the Server..." and finally it
>:says..."Applet - Error - Closing...". Also the application is not
>:viewing in the browser.
>:
>:Awaiting for your solution...
>:Vinodh

The reply from Andrew will help you clarify your problem.  But you've 
got some other troubles going on here as well.

Safari is available ONLY for Mac OS X.  The MRJ 2.2.5 to which you refer 
does NOT install in OS X, therefore it has no bearing on Safari.  Just 
what exactly is it you're trying to do?

In Mac OS 9.2 with MRJ 2.2.5, you can only do Java up to 1.1.8.  Nothing 
newer is supported, nor will it ever be.  If you have an Oracle 9i 
application, you probably should not be trying to make it work for 
anyone using any Mac OS version before 10.2.  Better still, go to 10.3 
with the latest Java 1.4.2 Update applied.

In Mac OS X, the ONLY available web browser that uses the installed Java 
environment is Safari.  If you want to enable Netscape to use it, you 
need to add a plug-in for that.  And IE on OS X is no longer being 
developed -- it's dead.
-- 
Steve W. Jackson
Montgomery, Alabama




==============================================================================
TOPIC: NIO CPU Anomaly
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/987b5a76739f16c8
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 14 2004 3:35 am
From: [EMAIL PROTECTED] 

I have recently run into an anomaly using the NIO packages in a
multithread thick client.  Can anybody help?
The app opens a few of IP connection (about 20) for two way
communication.  It was recently migrated across to use the NIO API and
this has caused the client CPU to hit 100% even when idle.  On the old
IO packages this was <1% CPU.
(This is my first newsgroup posting so please let me know if I should
include more/less info).


Nick





==============================================================================
TOPIC: Using struts for server validation
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/21986e438a01d706
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 14 2004 12:31 am
From: "milkyway"  

Hello,

I am using the Tomcat container and jsp ;-)

Are there any examples out there where one uses Struts to validate
entries made by a user on the client side?

Kindest Regards.





==============================================================================
TOPIC: javax/comm/SerialPortEventListener
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d845f15727eef628
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 14 2004 3:58 am
From: [EMAIL PROTECTED] (Abhishek) 

When i try to run a file using comm package it is giving me an error.
please can any body tell me how to resolve this one

C:\Progra~1\Java\j2sdk1.5.0\bin\java neW -classpath "C:\comm.jar"


Exception in thread "main" java.lang.NoClassDefFoundError:
javax/comm/SerialPortEventListener
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:604)
        at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access+100(URLClassLoader.java:56)
        at java.net.URLClassLoader+1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:279)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)




==============================================================================
TOPIC: jsp, containers, beans and persistence
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/47085d2436bae214
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 14 2004 12:12 am
From: "milkyway"  

Hello there,

I have heard that one can set a .jsp page so that the content is valid
over an entire session. Is this true? Are there any examples where one
may see this?

Also, if it is true, then has anyone come across any problems with the
use of the Tomcat container to pass variables for use from one jsp page
to another? Are there any limits to what the container can hold - for
example, if I have 5 jsp pages:

first.jsp
second.jsp
third.jsp
fourth.jsp
fifth.jsp

and I use a setName for first.jsp, can use a getName on fifth.jsp
(assuming that the variable is in the cloud called "the container"
somewhere)?

I hope I am making sense ;-) 

Kindest Regards.





==============================================================================
TOPIC: java.lang.OutOfMemoryError
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7dfb5d2d1250de90
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 14 2004 6:34 am
From: "srh"  

ok I change the code like this :
Statement stmt = cx.createStatement();
FileReader fr = new FileReader( file );
BufferedReader br = new BufferedReader( fr );
String lineData = null;
String insertStatementSQL = "";
int recordCount = 0;
while ( (lineData = br.readLine()) != null ) {
....
if ( recordCount == 1000 ) {
stmt.executeBatch();
stmt.clearBatch();
recordCount = 0;
}
recordCount++;
stmt.addBatch(insertStatementSQL);
}

if ( recordCount > 0 ) {
stmt.executeBatch();
}


It executes the first 1000 successfully but on second 1000 it again
gives the same error message of java.lang.OutOfMemoryError
Am I doing missing something here? 

Thanks





==============================================================================
TOPIC: TCHAR in c++ to string in java
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dce48222b7374509
==============================================================================

== 1 of 6 ==
Date: Tues, Dec 14 2004 5:39 am
From: "Bobby"  

Hi-

No, my host is working very well when I use the client which was done
in c++, but it was the problem with the client written in java, what
could be wrong???

Thanks,
dwurity


Michael Borgwardt wrote:
> [EMAIL PROTECTED] wrote:
> > The client will reads all the specified information, but i am
getting
> > some blocks in the middle, I hope the problem will be at the
reading
> > side. The host will sends the data in form of win32_find_data
format,
> > and here i am reading the information, so i want how to process the
> > fileName which is the field of the structure win32_find_data, at
the
> > client side (java side), should i use the charsetdecoder to convert
the
> > type TCHAR(fileName) data to string at java???
>
> No, you should define a portable communications protocol. C structs
are
> not portable. When the protocol is clearly defined (that includes
> specifying the charset of Strings) then implementing it on the Java
side
> will be straightforward.
> 
> As it is, your host is fundamentally broken.




== 2 of 6 ==
Date: Tues, Dec 14 2004 5:37 am
From: "Bobby"  

Hi-

No, my host is working very well when I use the client which was done
in c++, but it was the problem with the client written in java, what
could be wrong???

Thanks,
dwurity




== 3 of 6 ==
Date: Tues, Dec 14 2004 5:26 am
From: "Bobby"  

No, i verified the host with another client which was writtened in c++
and its working great with out any problems, the problem occured only
with the java client! 

what is the problem???

Thanks,
dwurity




== 4 of 6 ==
Date: Tues, Dec 14 2004 5:21 am
From: "Bobby"  

Hi-

I am developing a file transfer application, in which the host is
written in c++ and the client is written in java,the host will sends
the information through the stream to the client.

The host uses the win32_find_data, which will retrieve the file
information and sends it to the client, when reading the data from the
stream at client side there are some unwanted blocks. I think the
problem is at the client side when reading the filename which is the
variable of the structure win32_find_data, the fileName variable is of
type TCHAR at the host side, and how can i process it at the client
side?

Should I use the charsetDecoder at the client side??? if so how can i
do that??

Thanks in advance,
dwurity




== 5 of 6 ==
Date: Tues, Dec 14 2004 5:36 am
From: "Bobby"  

Hi-

No, my host is working very well when I use the client which was done
in c++, but it was the problem with the client written in java, what
could be wrong???

Thanks,
dwurity




== 6 of 6 ==
Date: Tues, Dec 14 2004 5:02 am
From: [EMAIL PROTECTED] 

Hi-
I am developing file transfer application, the host is in c++ and the
client is in java. In c++ I am using win32_find_data to get all the
files list and i am sending it to the client through the stream.

The client will reads all the specified information, but i am getting
some blocks in the middle, I hope the problem will be at the reading
side. The host will sends the data in form of win32_find_data format,
and here i am reading the information, so i want how to process the
fileName which is the field of the structure win32_find_data, at the
client side (java side), should i use the charsetdecoder to convert the
type TCHAR(fileName) data to string at java???
Thanks in advance,
dwurity





==============================================================================
TOPIC: Writing to URL connection-concurency
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/399db37022b091b7
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 14 2004 4:28 am
From: [EMAIL PROTECTED] (TonY) 

Hi,
Is there any support for concurrency when writin to URL connection?
Assume this is a simple text file. Or this is not supported by Operating System.

Remark that this is possible with database, DBMS role?




==============================================================================
TOPIC: Searching for (and remove) unreferenced methods
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6cf6cff59129ad70
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 14 2004 7:22 am
From: "Rogue Chameleon"  

Thanks for the tips!





==============================================================================
TOPIC: Help: Display Modification on a sync slideshow program
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2d84ab993c92e5cb
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 14 2004 7:47 am
From: [EMAIL PROTECTED] 

I'm trying to modify some source code from a sourceforge project. I'm
very green with java. In short, the program is designed to webcast
images to a java browser. By the programmer's code, it checks the size
of the user's screen and runs java at full screen. The end user can
adjust the window size through right clicking (2 or 3 mouse button) or
click and hold (one mouse button). However, I need the window to be
decorative and be defined by a certain size, ex 360x270.

There are some variables and settings in awt that I don't have any clue
on setting. I believe that the changes to define the window size and
make the window decorative are at line 138. Ultimately, I'll aim to
produce a jar out of all of the classes.

A demonstration of the project in action can be found at
http://schedule.itre.ad.ncsu.edu/jpresenter/index.html


Documentation for the project is very good. I've put the documents and
source code up at
http://schedule.itre.ad.ncsu.edu/jpresenter/doc/html/files.html


My theory on where the code could be modified is
at line 138

JWPFrameSS(String s, String d, String c, String b, String f, boolean
app) {
setSize(Toolkit.getDefaultToolkit().getScreenSize()); //
maximize me
setDefaultCloseOperation(app?DISPOSE_ON_CLOSE:EXIT_ON_CLOSE);
setUndecorated(true); // this require JRE 1.4 or above.
getContentPane().add(new JWPPanelSS(this, s, d, c, b, f, app));


Any help is appreciate.
Cheers,
-Dave
[EMAIL PROTECTED] remove NOSPAM





==============================================================================
TOPIC: TCP connection reply
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cdd6db89f754b326
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 14 2004 7:28 am
From: [EMAIL PROTECTED] 

Thanks!





==============================================================================
TOPIC: STRUTS & Active Directory Query
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/33b3bf62773ca33f
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 14 2004 8:20 am
From: "JavaNinna72"  

I'm having a strange problem.  I'm executing the following code in a
utility class to extract the user's Active Directory Id from the
request object.  However, when this is done - the beanUtils's
responsible for loading the FormBean cease to function on doPost
requests.  I have noticed that anytime a header is changed in the
response object, the client re-sends the request.

Somehow, this is messing up the normal behavior of struts:

Any Ideas are appreciated :

private static String getLogonID(HttpServletResponse response,
HttpServletRequest request) {
String userID = null;
String auth = request.getHeader("Authorization");


if (auth == null) {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.setHeader("WWW-Authenticate", "NTLM");
return userID;
}


if (auth.startsWith("NTLM ")) {
byte[] msg = null;

try {
msg = new
sun.misc.BASE64Decoder().decodeBuffer(auth.substring(
5));
} catch (IOException e) {

e.printStackTrace();
}

int off = 0;
int length;
int offset;
String s;

if (msg[8] == 1) { // first step of authentication
off = 18;
byte z = 0;
byte[] msg1 = {
(byte) 'N', (byte) 'T', (byte) 'L', (byte) 'M',
(byte) 'S',
(byte) 'S', (byte) 'P', z, (byte) 2, z, z, z, z, z,
z, z,
(byte) 40, z, z, z, (byte) 1, (byte) 130, z, z, z,
(byte) 2,
(byte) 2, (byte) 2, z, z, z, z, // this line is
'nonce'
z, z, z, z, z, z, z, z
};

// remove next lines if you want see the result of
first step

response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.setHeader("WWW-Authenticate",
"NTLM " +
new
sun.misc.BASE64Encoder().encodeBuffer(msg1).trim());

return userID;
} else if (msg[8] == 3) {
off = 30;
length = (msg[off + 17] * 256) + msg[off + 16];
offset = (msg[off + 19] * 256) + msg[off + 18];
s = new String(msg, offset, length);
} else {
return userID;
}

length = (msg[off + 1] * 256) + msg[off];
offset = (msg[off + 3] * 256) + msg[off + 2];
s = new String(msg, offset, length);

length = (msg[off + 9] * 256) + msg[off + 8];
offset = (msg[off + 11] * 256) + msg[off + 10];
s = new String(msg, offset, length);
char[] userName = s.toCharArray();
StringBuffer userNameBuffer = new StringBuffer();
for (int i = 0; i<userName.length;i++){
if(i%2==0 ){
userNameBuffer.append(userName[i]);
}
}
userID = userNameBuffer.toString();
}

        return userID;
    }




==============================================================================

You received this message because you are subscribed to the Google
Groups "comp.lang.java.programmer" group.

To post to this group, send email to [EMAIL PROTECTED] or
visit http://groups-beta.google.com/group/comp.lang.java.programmer

To unsubscribe from this group, send email to
[EMAIL PROTECTED]

To change the way you get mail from this group, visit:
http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe

To report abuse, send email explaining the problem to [EMAIL PROTECTED]

==============================================================================
Google Groups: http://groups-beta.google.com 

Reply via email to