Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to set the Authorization header to java

843841Apr 27 2006
I have gone through the Web Authentication mechanism explain on http://www.ietf.org/rfc/rfc2617.txt
http://unixpapa.com/auth/index.html

1. I know I can connect to authenticated site using HTTPClient like appche for java (using user credintial)
2. Every time when server sends 401 unauthorized response then browser handles that automatically and send the use credintial with MD5 encrypted.

The most import question here is if I can connect thruogh HTTPClient and I am able to receive the authorization header then Can I set that header to browse by using customized program like java to bypass the login popup.

I want to give the bypass for login popup because I konw the required username and password for the particular site.

Thanks in Advance
Ramesh

Comments

843802
Any reason why you call getSourceDataLine() twice? This is quite handy, thank you.
User_64CKJ
JLudwig wrote:
Any reason why you call getSourceDataLine() twice? ..
Oh wait, I know this one (..snaps fingers. yes) it is because I am a mor0n, and forgot the class level (static) attribute declared earlier in the source when I (re)declared the local attribute and called getSourceDatLine (which was redundant, given the next line, which as you point out also called getSourceDataLine).

There are (at least) two ways to correct this problem.
1) Remove the class level attribute and the second call.
2) Remove the local attribute as well as the first call (all on the same code line).

Method 1 makes more sense, unless you intend to refactor the code to only instantiate a single SDL for however many times the user presses (what was it? Oh yeah..) 'Generate Tone'.

My 'excuse' for my odd programming is that this was 'hacked down' from a longer program to form an SSCCE. I should have paid more attention to the fine details (and perhaps run a lint checker on it).

Thanks for pointing that out. I guess from the fact you spotted it, that you have already corrected the problem. That you thought to report it, gives me confidence that you 'will go far (and be well thought of, besides)' in the open source community.
..This is quite handy, thank you.
You're welcome. Thanks for letting us know about the error (OK - the pointless redundancy). Thanks to your report, other people who see this code later, will not have to wonder what (the heck) I was thinking when I did that.

Another thing I noted, now I run the source on a 400MHz laptop (it's hard times, here) is that the logic could be improved. At the speeds that my laptop can feed data into the SDL, the sound that comes out the speakers approximates the sound of flatulence (with embedded static, as a free bonus!).

Edit 1: Changed one descriptive word so that it might get by the net-nanny.

Edited by: AndrewThompson64 on Mar 27, 2008 11:09 PM
843802
Please help I'm trying to use your code as a guide to create DTMF tones.
The DTMF requirements are to produce 2 tones at different frequencies. If you do a search on wikipedia they have a nice little table.
I can get the first tone to produce the right note and I can get the second note to produce the right note, individually. However when I do:
            
double angle = i / (frequency / hz1)* ttpi;
double angle2 = i / (frequency / hz2) * ttpi;
buf[0] = (byte) (Math.sin(angle) * volume);
buf[1] = (byte) (Math.sin(2*angle2) * (volume));
sdl.write(buf, 0, 2);
I dont get the two tones to be produced in the proper manner. Can you help me adjust this code to work?
User_64CKJ
The problem is most probably in the code you did not write.

Post an SSCCE* to a new thread, add some dukes, and if I see it and have time, I'll look into it (assuming somebody else does not see the code and solve it first).

* Google it.
843802
Started a new thread

Edited by: karlmarxxx on Apr 16, 2008 1:43 AM
843802
AndrewThompson64 wrote:
sTone.setToolTipText(
"Tone (in Hertz or cycles per second - middle C is 441 Hz)");
middle c is certainly not 441 hz. : )
frequencies
User_64CKJ
TuringPest wrote:
AndrewThompson64 wrote:
sTone.setToolTipText(
"Tone (in Hertz or cycles per second - middle C is 441 Hz)");
middle c is certainly not 441 hz. : )
frequencies
That's a pity. In that case, amend that to..
    sTone.setToolTipText(
      "Tone (in Hertz or cycles per second)");
;-)
843802
First of all I thank you for posting this code. It is very much what I need.

Now, when I run the program I get hard sounds at both beginning and end of the tone. Is this just a symptom of a crappy sound system, poor quality headphones, or is it avoidable by coding? I am trying to convert a Morse code training program that I wrote quite a few years ago in C. The hard sounds in the headphones would get very tiring very quickly. Any help you can give me would be greatly appreciated.

I think that I might have to ramp up the volume at the beginning of the tone and ramp it down again at the end. First, is this possible and second, is there a better way to eliminate the hard sounds?

Thanks.
843802
To avoid static:

In the generateTone method, you have put sdl.start() just after sdl.open(af).
Instead put sdl.start() and put it just after the for loop and just before sdl.drain().

Hope that helps.

Ram
--
843802
you might want to look at JSyn:

[http://www.softsynth.com/jsyn/|http://www.softsynth.com/jsyn/]




or leave the world altogether and look at SuperCollider :

[http://supercollider.sourceforge.net/|http://supercollider.sourceforge.net/]

sc3*2
PhHein
Please stop posting to years old threads. Locking.
1 - 11
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on May 25 2006
Added on Apr 27 2006
0 comments
273 views