Problem with Apache 2.* + tomcat 4.1.* using mod_jk2
hi guys, I am trying to hook up my tomcat 4.1.29 with the Apache 2.0.49 server (running mod_ssl if that makes any difference) with the mod_jk2 2.0.2 version. I downloaded the mod_jk2 source and built it on my own for linux. Everything works fine - I can get to tomcat JSPs and Servlets (using struts in tomcat by the way). But what I notice is if the response is larger than 8K, the mod_jk2 connector in apache is logging an error and throwing away the response on the floor. This is what I see in the apache error log: [Fri Mar 26 01:05:41 2004] [error] msgAjp.receive(): Incoming message is too big 8196 [Fri Mar 26 01:05:41 2004] [error] channelSocket.receive(): Bad header [Fri Mar 26 01:05:41 2004] [error] workerEnv.processCallbacks() Error reading reply [Fri Mar 26 01:05:41 2004] [error] ajp13.service() ajpGetReply unrecoverable error 12 [Fri Mar 26 01:05:41 2004] [error] ajp13.service() Error forwarding ajp13:localhost:8009 0 1 [Fri Mar 26 01:05:41 2004] [notice] ajp13.done() close endpoint ajp13:localhost:8009 error_state 1 [Fri Mar 26 01:05:41 2004] [error] mod_jk.handler() Error connecting to tomcat 12 Any ideas on what I might be doing wrong ? Is the response size configurable in mod_jk2 (I looked in the source but couldn't find a way to do that)? Please let me know if I need to send this mail to a different mailing list. thanks in advance. Praveen __ Introducing the New Netscape Internet Service. Only $9.95 a month -- Sign up today at http://isp.netscape.com/register Netscape. Just the Net You Need. New! Netscape Toolbar for Internet Explorer Search from anywhere on the Web and block those annoying pop-ups. Download now at http://channels.netscape.com/ns/search/install.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to customize HTTPSession
thanks for the good suggestion Chris - that is what exactly I am looking for. I tried it and got part that involves reading the cookie from the Request and setting a request object (easy part though). I seem to have problems implementing the HttpServletResponseWrapper to collect the response from the resource and process it to add my cookie into it before returning it back to the tomcat. Do you by any chance have any sample code on how to do that ? For some reason my response wrapper doesn't contain any data when I try to read the data after the chain.doFilter(req, myres) method. I am wondering if I am missing anything. I even went through the tutorial @ http://www.orionserver.com/tutorials/filters/3.html#stream-1 - but couldn't even get their working :-/ thanks for your help -Praveem Christopher Schultz <[EMAIL PROTECTED]> wrote: >Tim, > >> With the functionality you desire, stay away from the Session classes as >> defined in the servlet API. > >I completely agree. > >> Instead, look into Filters and HttpServletRequestWrapper and >> HttpServletResponse wrapper. >> >> Ideally, you'd create some helper classes which do the gets and sets on >> the servletrequests and responses. How they get instantiated is up to you. > >Yeah, the filter is the way to go. A Filter gets to execute both before >and after your "application" code handles the request. > >You can do some clever things like gather all the cookies from a request >that match a certain pattern (regexp), convert them to objects, and >shove them into request attribute (or perhaps a Map of name->value, with >the whole map in the request). Then, have your app code handle the request. > >After your app code executes, look for an attribute in the request >(since response objects, unfortunately for your, can't have attributes) >that should be converted back into cookies. > >Let me know if you need some sample code. This seems interesting enough >that I'd be willing to bang some simple stuff out for you :) > >-chris > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > __ McAfee VirusScan Online from the Netscape Network. Comprehensive protection for your entire computer. Get your free trial today! http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397 Get AOL Instant Messenger 5.1 free of charge. Download Now! http://aim.aol.com/aimnew/Aim/register.adp?promo=380455 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to customize HTTPSession
Thanks Mark - the problem with using HTTPSessionBindingListener is that the unbound event is not triggered unless someone calls the session.removeAttribute() or session.setAttribute(name, null). So there is no way for me to set the cookie from the unbound() event without explicitly calling one of the above 2 methods, which ofcourse is not possible in real world. Please correct me if I am wrong. I think what I should be looking for is a way to attach a listener to the HTTPRequest itself, which the HTTPRequest can notify corresponding to an attribute when it is set in the request using the request.setAttribute() method and when it is removed either using the request.removeAttribute() method or when the HTTPRequest itself unbinds the attribute when it is done processing a request. thanks Praveen "Mark R. Diggory" <[EMAIL PROTECTED]> wrote: >You might look into implementing the >javax.servlet.hhtp.HttpSessionBindingListener interface, this will allow >you to act when an object is added/removed from the session. Simply put, >you could write valueBound/UnBound methods that set Cookies into the >HttpResponse. > >-Mark > >[EMAIL PROTECTED] wrote: > >> Hi, >> >> I am new to the java webapp development. I want to store some user >> data for my app in a client side cookie rather than as a server side >> object and referencing it with a sessionId. One of the main reasons >> for that is - we will be running multiple servers load balancing. >> Since the HTTPSessions are java container instance specific - I don't >> want to use them. I have read about distributed Session support - but >> it does involve complicated setup and seems to be a overkill when >> compared to the data that I want to store. >> >> Anyway - in that aspect - I have these 2 questions : >> >> 1. Is there a way to override the HTTPSession and HTTPResponse >> provided by tomcat to save the contents of the Session as a cookie >> instead of just storing the sessionId ? >> >> 2. If I implement my own Session class, and store it as a attribute >> in the HTTPRequest object, how can I write the contents of the >> session as a cookie right before I return the response ? The way I >> used to do it in other apps in C++ is to write a destructor for my >> session object, which will get called when the request is being >> terminated and I could write the cookie in the response. But the java >> equivalent to destructor "finalize()" is not gauranteed to be called >> until the GC wakes up. So how can I make sure I set the cookie after >> the request is completely processed? >> >> Please pardon my ignorance if made any wrong assumptions. I would >> appreciate any help. regards, Praveen >> >-- >Mark Diggory >Software Developer >Harvard MIT Data Center >http://www.hmdc.harvard.edu > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > __ McAfee VirusScan Online from the Netscape Network. Comprehensive protection for your entire computer. Get your free trial today! http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397 Get AOL Instant Messenger 5.1 free of charge. Download Now! http://aim.aol.com/aimnew/Aim/register.adp?promo=380455 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to customize HTTPSession
Hi, I am new to the java webapp development. I want to store some user data for my app in a client side cookie rather than as a server side object and referencing it with a sessionId. One of the main reasons for that is - we will be running multiple servers load balancing. Since the HTTPSessions are java container instance specific - I don't want to use them. I have read about distributed Session support - but it does involve complicated setup and seems to be a overkill when compared to the data that I want to store. Anyway - in that aspect - I have these 2 questions : 1. Is there a way to override the HTTPSession and HTTPResponse provided by tomcat to save the contents of the Session as a cookie instead of just storing the sessionId ? 2. If I implement my own Session class, and store it as a attribute in the HTTPRequest object, how can I write the contents of the session as a cookie right before I return the response ? The way I used to do it in other apps in C++ is to write a destructor for my session object, which will get called when the request is being terminated and I could write the cookie in the response. But the java equivalent to destructor "finalize()" is not gauranteed to be called until the GC wakes up. So how can I make sure I set the cookie after the request is completely processed? Please pardon my ignorance if made any wrong assumptions. I would appreciate any help. regards, Praveen __ McAfee VirusScan Online from the Netscape Network. Comprehensive protection for your entire computer. Get your free trial today! http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397 Get AOL Instant Messenger 5.1 free of charge. Download Now! http://aim.aol.com/aimnew/Aim/register.adp?promo=380455 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]