Re: How to use a gzip javascript file in a webapp running under tomcat
Hi chris, Thx for the reply. just after posting the question i tried the same steps and the files are getting gzip. Thank you, bala. On 6/11/09, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Bala, On 6/10/2009 8:37 AM, balachandra maddina wrote: I'm wondering if its possible to refer [to] a javascript file something like script ... src ='scriptfile.js.gz' in a html page where the script file is located in one of the tomcat webapps? Sure, you can do that. It just won't do what you expect it to. if not how to send a gzip javascript file to browser? any help would be appreciated. Try enabling gzip compression in the Connector. http://tomcat.apache.org/tomcat-6.0-doc/config/http.html#Standard%20Implementation Look for the compression attribute. You'll probably have to change the compressablemimeType setting from the default to include text/css. I don't think there's a way to trick Tomcat into using a pre-compressed image of a file in this way. Alternatively, you could probably do something like the following: create a servlet that does nothing but serve a file off the disk (you might even extend the DefaultServlet). Make sure that your servlet reads your gzip'd CSS file and serves it without modification, except to add a Content-Encoding header. Remember to ensure that the client has Accept-Encoding: gzip set in the request headers... otherwise you will be serving a file that the browser claims it can't read. Good luck, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkowG2MACgkQ9CaO5/Lv0PC98ACgnQZ2/PKp5QgYsQJkTgPYGVep vKgAniqftK7UQndCyoax6Fb+pR3C+vwl =irZW -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Using tomcat as standalone
Hi Chuck, Thx for the detailed info. i'll keep a note of these details during deployment. Thank you, bala. On 6/11/09, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: balachandra maddina [mailto:chandu2...@gmail.com] Subject: Using tomcat as standalone Im wondering what are the performance implications of using tomcat as standalone? many suggested to use the tomcat along with IIS. but im not sure why is this required? Front-ending Tomcat with IIS would create a lot of extra overhead and administrative workload - don't do it unless you're already using IIS as your primary web server for the domain of interest. Tomcat does very well at serving static content by itself these days (better than IIS). If you're using SSL and have stringent performance requirements, consider installing the APR native library with Tomcat; this uses OpenSSL rather than the Java libraries and is noticeably faster. APR may get you a performance improvement for non-encrypted requests as well, but you'd have to measure your webapps with it to be sure. Use the latest Tomcat (6.0.20) and JVM (6u14) in server mode for the best performance starting point; use a 64-bit version of the JVM if you need the heap space and your platform supports it. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
How to use a gzip javascript file in a webapp running under tomcat
Hi There, Im wondering if its possible to referr a javascript file something like script ... src ='scriptfile.js.gz' in a html page where the script file is located in one of the tomcat webapps? if not how to send a gzip javascript file to browser? any help would be appreciated. Thx, bala.
Using tomcat as standalone
Hi There, Im wondering what are the performance implications of using tomcat as standalone? many suggested to use the tomcat along with IIS. but im not sure why is this required? could somebody help me on this please. Thank you, bala.
What is the working flow of chat example
Hi, When i try the chat example. it asks me to enter some details in text box after filling the text box and hitting the enter the same page is displayed asking me to enter details in text box. what aspect of Comet is this example representing. Thank you, bala.
Trouble Implementing CometProcessor
Hi All, Im trying to implement the comet chat example that is provided in tomcat docs. its said that when a servlet implements CometProcessor interface then when this servlet is called instead of calling the service method the event method will be invoked. but after implementing the interface if i call the servlet from browser with something like http://localhost/app/chat;, event method was not invoked instead request goes to service method. could anyone please let me know what shd be the client URL so that the event method will be invoked instead of service method. Thank you, bala.
Re: Trouble Implementing CometProcessor
I just created a simple example implementing the CometProcessor interface and seems the request is calling event method. i just need to work furthour on this. sorry for the trouble. Thank you, bala. On Wed, May 6, 2009 at 12:43 PM, balachandra maddina chandu2...@gmail.comwrote: Hi All, Im trying to implement the comet chat example that is provided in tomcat docs. its said that when a servlet implements CometProcessor interface then when this servlet is called instead of calling the service method the event method will be invoked. but after implementing the interface if i call the servlet from browser with something like http://localhost/app/chat;, event method was not invoked instead request goes to service method. could anyone please let me know what shd be the client URL so that the event method will be invoked instead of service method. Thank you, bala.
comet with httpclient
Hi All, Is it possible to use HttpClient as a client to comet servlet when i tried a simple HttpClient the response is never returned back. below is my comet client code... HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet(http://localhost:8080/serverpush/comet;); ResponseHandlerString responseHandler = new BasicResponseHandler(); String responseBody = httpclient.execute(httpget, responseHandler); httpclient.getConnectionManager().shutdown(); if the above implementation is not preferred then what is the preferred client for a comet servlet. could somebody point me to a link or doc on comet client please. any help would be very much appreciated Thank you, bala.
Re: comet with httpclient
Hi Martin, I have the same implementation as a servlet please find the servlet code i used blow. public class CometServlet extends HttpServlet implements CometProcessor { protected ArrayListHttpServletResponse connections = new ArrayListHttpServletResponse(); protected MessageSender messageSender = null; public void init() throws ServletException { messageSender = new MessageSender(); Thread messageSenderThread = new Thread(messageSender, MessageSender[ + getServletContext().getContextPath() + ]); messageSenderThread.setDaemon(true); messageSenderThread.start(); } public void destroy() { connections.clear(); messageSender.stop(); messageSender = null; } @Override public void service(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException { System.out.println(Inside service method); super.service(arg0, arg1); } @Override public void event(CometEvent event) throws IOException, ServletException { HttpServletRequest request = event.getHttpServletRequest(); HttpServletResponse response = event.getHttpServletResponse(); if (event.getEventType() == CometEvent.EventType.BEGIN) { log(Begin for session: + request.getSession(true).getId()); PrintWriter writer = response.getWriter(); writer .println(!doctype html public \-//w3c//dtd html 4.0 transitional//en\); writer .println(headtitleJSP Chat/title/headbody bgcolor=\#FF\); writer.flush(); synchronized (connections) { connections.add(response); } } else if (event.getEventType() == CometEvent.EventType.ERROR) { log(Error for session: + request.getSession(true).getId()); synchronized (connections) { connections.remove(response); } event.close(); } else if (event.getEventType() == CometEvent.EventType.END) { log(End for session: + request.getSession(true).getId()); synchronized (connections) { connections.remove(response); } PrintWriter writer = response.getWriter(); writer.println(/body/html); event.close(); } else if (event.getEventType() == CometEvent.EventType.READ) { InputStream is = request.getInputStream(); byte[] buf = new byte[512]; do { int n = is.read(buf); // can throw an IOException if (n 0) { log(Read + n + bytes: + new String(buf, 0, n) + for session: + request.getSession(true).getId()); } else if (n 0) { // error(event, request, response); return; } } while (is.available() 0); } } public class MessageSender implements Runnable { protected boolean running = true; protected ArrayListString messages = new ArrayListString(); public MessageSender() { } public void stop() { running = false; } /** * Add message for sending. */ public void send(String user, String message) { synchronized (messages) { messages.add([ + user + ]: + message); messages.notify(); } } public void run() { while (running) { if (messages.size() == 0) { try { synchronized (messages) { messages.wait(); } } catch (InterruptedException e) { // Ignore } } synchronized (connections) { String[] pendingMessages = null; synchronized (messages) { pendingMessages = messages.toArray(new String[0]); messages.clear(); } // Send any pending message on all the open connections for (int i = 0; i connections.size(); i++) { try { PrintWriter writer = connections.get(i).getWriter(); for (int j = 0; j pendingMessages.length; j++) { writer.println(pendingMessages[j] + br); } writer.flush(); } catch (IOException e) { log(IOExeption sending message, e); } } } } } } } Please let me know if im doing anything
StandardServer.await: Invalid command 'GET / HTTP/1.1' received
Hi All, When i tried to configure the tomcat6 with eclipse im getting following error 5 May, 2009 3:24:11 PM org.apache.catalina.core.StandardServer await WARNING: StandardServer.await: Invalid command 'GET / HTTP/1.1' received im using eclipse ganymede and the the server configuration is set to use tomcat6 installation and both http/1.1 and admin port values are set to 8080. not sure whats causing the issue. any help would be appreciated. Thank you, bala.
Re: StandardServer.await: Invalid command 'GET / HTTP/1.1' received
Hi Rainer, Thx a lot for the solution. yes, you are right, after changing the admin port to 8005 in the config it worked fine. Thank you, bala. On 5/5/09, Rainer Frey rainer.f...@inxmail.de wrote: On Tuesday 05 May 2009 12:01:24 balachandra maddina wrote: Hi All, 5 May, 2009 3:24:11 PM org.apache.catalina.core.StandardServer await WARNING: StandardServer.await: Invalid command 'GET / HTTP/1.1' received im using eclipse ganymede and the the server configuration is set to use tomcat6 installation and both http/1.1 and admin port values are set to 8080. not sure whats causing the issue. any help would be appreciated. Exactly that *is* the issue! The admin port is for receiving admin commands, and the HTTP port is for receiving HTTP requests. You must use different ports. What happened is: the HTTP connector could not start, because the server already opened that port. Your browser/client/whatever sent the request to the admin port , the server does not understand HTTP and logs this error. Thank you, bala. Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Comet implimentation
Hi Andreas, Thx for the reply. but im looking towards a hand code solution rather using an additional framework. i have downloaded the comet example that is placed in tomcat wiki which uses an Applet as a client. and trying to understand this better so i can use this with other clients like an Ajax page. If anybody had worked on this, could you share your exp please. Thank you, bala. 2009/4/30 Andreas Prieß a...@metaphysis.net Bala chandra wrote: Im wondering if it is possible to implement a Comet using Tomcat6. if so could somebody point me over the implementation please. https://atmosphere.dev.java.net/ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org