Win a copy of Head First Android this week in the Android forum!

wayne forrest

Greenhorn
+ Follow
since Aug 23, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by wayne forrest

I have finally resolved this

Seems that if you do not *encode* your urls, the server will not revert back to URL rewriting.

For example:

Should resolve the problem, best of luck.








10 years ago

Hi,

Is it safe/legal to synchronize only for write operations, but not on reads, assuming data
is stored in an array ( or non thread safe collection )?

Also asume there are many getter threads and many setter threads, and that the data stored will be Objects and not primitives.

I am particular concerned about corrupt data, where thread 1 writes and halfway through the process thread 2 reads the data.
(If data is re-read(stale data) it is ok.)




Hi,

I need some help please, or suggestions on how to solve this problem.

I have data stored in a HashMap as below:

key1 ObjectA.
key2 ObjectB.
key3 ObjectC.

There is one producer per key and for example 100 users per key.

Currently I am synchronizing on the entire collection, and I guess this is not optimal, especially since Object(A/B/C) is going to change
very often, up to 5 times a second. And the clients really want the data as fast as possible.

Is it possible to sync on the KEY? is there perhaps a better collection to use?

Or what is the best way to solve this one without moving away from servlets?


thanks.





Finally solved this "2000" mystery.

2000 Hex to Decimal = 8 192

and that I guess is the packet/buffer size of tomcat.



10 years ago
Hello,

I am having some trouble with the servlet API (Tomcat 6).

Setting the content length using the out.setContentLength(len) is not working, the headers is not sent
to the client when I monitor the traffic via WireShark, and yet out.println("Content-Length: "+len) works.

Is there an explanation for this?


10 years ago
Hi ,

Need some help here please;

WireShark shows that the servlet is sending "2000\r\n" as data, yet I am not sending this data.


Any ideas?

10 years ago
I am not sure. One will have to test this.
10 years ago
I can not remember exactly: try this though:

Settings-->Privacy-->Advanced

"tick" "Override automatic cookie handling" :
Allow Third Party and First Party cookies is also ticked.

Hope that helps: I do remember that the problem was that session variables were not saved / persist on subsequent requests.

10 years ago
Finally,

starting to make *SOME* sense with IE9,

what I did not mention was that I have a static html page that is served from TOMCAT, index.html,
and this page has a link to the JSP page.

the link was set to use my LAN IP, 192.168.0.X

And when I test the JSP PAGE I always went to

http://localhost:8080/MyApplication/index.html

and clicked the link (http://192.168.0.x:8080/MyApplication/login.jsp)


Changing localhost to the actual IP: 192.168.0.x made this WORK !!! I find this strange....


10 years ago
JSP

Tomcat comes standard with examples, one is known as the Number Guessing example:

Try it here : http://admin.jsn-server5.com/jsp-examples/num/numguess.jsp

First try it in Chrome and note your score:
and then in IE9.

How does one make this application work in IE9 ???

Lowering the security levels in IE9 helps, but.....


Thanks/




10 years ago
I have looked at the data:

Comparing Chrome against IE9 using an application called "Fidler".

By looking at the data I noticed that the server/tomcat sends a new cookie JSESSIONID for each URL
in this case one for the JSP page and one for the "Capthca" servlet page.

By inspecting further, almost missed this; I noticed that IE9 did not send the cookie to the server for the second call (Capthca servlet),
and that is why the server(tomcat) issues a new JSESSIONID cookie.

by calls I mean
1) Serve JSP page
2) Serve Captcha page

Still not sure how to fix this though

I am starting to think that this is more of an IE9 and Tomcat issue

System.out.println("JSP ID:"+session.getId());

Gives a new ID for each page refresh in IE9, WHY ???
10 years ago
JSP
I am still banging my head at this :

The following seems to persist getServletContext().getAttribute for IE and others.

Still not sure why the session variables are lost.

10 years ago
JSP
I am having some problems with my session variables being lost, currently I think this is only for IE9.
The code seems to work for FireFox/Chrome/Safari/IE8 but not for IE9.


I have noticed that the SESSION IDS' returned are different when I use IE9, whereas with other browsers the ID's are the same.
I think the problem could be in the way that the "Capcha" servlet is called, via a "GET". Whereas the rest of the validation is done via a "POST".


What's wrong with this approach or is there perhaps something I should be doing different ?


Here is the JSP Page snippet: For IE9 the ID produced on Line 2 differs from Line 74 in the second snippet of code.



And the servlet code I got via google slightly modified:


10 years ago
JSP

Is it possible to log multiple messages for example: log the user and their data usage.



How does one accomplish this?

Thanks

Thanks William,

(1)
What do you mean by in the body of the POST, is there perhaps an example of how to do a POST that has
XML as body.

(2)
By safe I meant that there are no funny characters that I need to encode, and that my XML document
will be received exactly the way it was sent.

Thanks.


10 years ago