comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * How connect to hsqldb database in jar? - 4 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/abc3be4fb59cfd19 * Storing Objects in HttpSession - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/88fefdf9a4dfbe8e * [Advanced Java/Gurus] JNI/Win32 hWnd JDK 1.4.2_05 freeze on Javascript Callback - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/68e3e47d995f0ac6 * Do empty directories in a .jar cause conflicts in the classloader? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d684f114cb7d0c3c * Where are the server configuration settings stored in WebSphere? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/459f617f3c919834 * What technoligies should I study? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dbf2694694cafb0a * Challenge: Triangles puzzle - 6 messages, 5 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5e013ca5d7daa5f0 * CPU increasing slowly up to 100% - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3970cf07d01d1d5c * Setting up a J2EE AS on Linux - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/82c0aa389344470b * java.exe has encountered problems and needs to close - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3aa458c564052dc2 * Need help w. Image Servlet. - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1bd066386cd1860 * Find all implementing classes in classpath? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/db894e13020738bd * emacs Vs Eclipse? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/58b6f53b3e1b91e1 * Alternative to InstallAnywhere Now? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/42f0205528bd98d8 * Cancel HttpServletRequest using a Filter - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c3a04c1dddd5c58b * inheritance and object creation - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3aa79a7b125fbdbb ========================================================================== TOPIC: How connect to hsqldb database in jar? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/abc3be4fb59cfd19 ========================================================================== == 1 of 4 == Date: Sat, Oct 16 2004 11:11 am From: Brzezi <[EMAIL PROTECTED]> sob, 16 paź 2004 o 18:52 GMT, Jon Martin Solaas napisał(a): > I'm not sure I understand what you want to do, but you can't store the > actual data-files for the database inside a jar file. Maybe, but not > very likely, there is some obscure feature of hsqldb that I don't know > about allowing you to do this, but generally, a database need to shrink > and grow it's data-files, delete files and create new ones. I don't see > how that could happen inside a jar-file. I didn`t write it, database will be read only. before I pack it into *.jar file, I will make database, after that application will only read database... I`v been trying many combinations of jdbc URL, but none worked :/ Pozdrawiam Brzezi -- [ E-mail: [EMAIL PROTECTED] ][ GEEK CODE [Version: 3.12]: GCM dpu s+:- ] [ Ekg: #3781111 ][ a--- C+++ UL++ P+ L+++ E--- W+++ N+++ ] [ LinuxUser: #249916 ][ o-- K- w--- O-- M- V- PS PE Y PGP--- t+ ] [ 5- X++ R* tv+ b- DI- D+ G+ e- h! r y-- ] == 2 of 4 == Date: Sat, Oct 16 2004 12:07 pm From: Andrew Thompson <[EMAIL PROTECTED]> On 16 Oct 2004 18:11:31 GMT, Brzezi wrote: >> I'm not sure I understand what you want to do, but you can't store the >> actual data-files for the database inside a jar file. Maybe, but not >> very likely, there is some obscure feature of hsqldb that I don't know >> about allowing you to do this, but generally, a database need to shrink >> and grow it's data-files, delete files and create new ones. I don't see >> how that could happen inside a jar-file. Beyond that, the way the D/B istelf is written to disk may allow optimizations of fetching data by calc/direct or other more efficient means of accessing the data. > I didn`t write it, database will be read only. > before I pack it into *.jar file, I will make database, after that > application will only read database... I would guess this is not possible, even as read only, but as an alternative, you ,ight try this. Distribute the D/B inside the .jar, but when you go to use it, check for it's existence (unzipped) in 'user.home' or similar, if it is not where you expect it, fetch it out of the .jar and write it to disk. The expansion should only rake a few moments, once, thereafter the D/B can be read straight off disk. HTH -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane == 3 of 4 == Date: Sat, Oct 16 2004 12:11 pm From: Andrew Thompson <[EMAIL PROTECTED]> On Sat, 16 Oct 2004 19:07:59 GMT, Andrew Thompson wrote: > On 16 Oct 2004 18:11:31 GMT, Brzezi wrote: Oops! Messed up the attributions on that one. Sorry Jon.. (Jon Martin Solaas wrote..) >>> I'm not sure I understand what you want to do, but you can't store the >>> actual data-files for the database inside a jar file. ... (snip) -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane == 4 of 4 == Date: Sat, Oct 16 2004 12:34 pm From: Brzezi <[EMAIL PROTECTED]> sob, 16 paź 2004 o 21:07 GMT, Andrew Thompson napisał(a): >> I didn`t write it, database will be read only. >> before I pack it into *.jar file, I will make database, after that >> application will only read database... > > I would guess this is not possible, even as read only, > but as an alternative, you ,ight try this. I`v just visited hsqldb homepage, and I saw new version since I were there before, so I checked the changelog of this release, and now it is posible connect to database which is placed in jar file... so my problem doesen`t exist now :) solution is: jdbc:hsqldb:res:<path in jar> Pozdrawiam Brzezi -- [ E-mail: [EMAIL PROTECTED] ][ I was the best I ever had. ] [ Ekg: #3781111 ][ -- Woody Allen ] [ LinuxUser: #249916 ][ ] ========================================================================== TOPIC: Storing Objects in HttpSession http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/88fefdf9a4dfbe8e ========================================================================== == 1 of 2 == Date: Sat, Oct 16 2004 11:43 am From: [EMAIL PROTECTED] (srcfrguser) Hello all, Can somebody exmplain me whether storing Exception object is right OR wrong? What I meant with this is session.setAttribute("Error",new MyException("MyException")); is right or wrong? where MyException extends Exception and implements Serializable. I have fair amount of idea about Exception/Error and throwable and etc. But wanted to know whether I can store the same in HttpSession? Any help in this regard will be greatly appriciated. Regards Joan H. == 2 of 2 == Date: Sat, Oct 16 2004 12:28 pm From: Sudsy <[EMAIL PROTECTED]> srcfrguser wrote: > Hello all, > Can somebody exmplain me whether storing Exception object is right > OR wrong? > > What I meant with this is > session.setAttribute("Error",new MyException("MyException")); is right > or wrong? > where MyException extends Exception and implements Serializable. Unusual, but nothing wrong with it. Hopefully you're planning on displaying the message on your JSP or otherwise reflect the data to the user? -- Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development. ========================================================================== TOPIC: [Advanced Java/Gurus] JNI/Win32 hWnd JDK 1.4.2_05 freeze on Javascript Callback http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/68e3e47d995f0ac6 ========================================================================== == 1 of 1 == Date: Sat, Oct 16 2004 11:58 am From: [EMAIL PROTECTED] (Storm) Simon, First of all, thank you for your post. It has been a pleasure not to feel alone. Unfortunately a work around was not found, and in my case, I had to turn to an alternate design principle. If you desire it, I could send you snippets relative to the 'hWnd' part. You could then be lucky to find the right sequence of events. Andrei Chiriaev ========================================================================== TOPIC: Do empty directories in a .jar cause conflicts in the classloader? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d684f114cb7d0c3c ========================================================================== == 1 of 1 == Date: Sat, Oct 16 2004 12:50 pm From: "John McGrath" <[EMAIL PROTECTED]> On 10/15/2004 at 7:29:40 PM, Miguel Farah wrote: > I removed the class file but forgot to erase the directory. Is there now > a conflict? I say no, an empty directory does not create a conflict, but > I'm not certain. Does it? I agree that it should not. That does not mean that an implementation will not have a problem with the emty directory, but if they do, I would argue that the implementation is wrong. The "language lawyer" argument on this is: While the Java Language Specification is not very clear about what makes a package *exist*, it is clear that a package is only *observable* if its members are observable. So if one argues that this package exists, it has no members, so it is not observable, and so its name is not in scope. -- Regards, John McGrath ========================================================================== TOPIC: Where are the server configuration settings stored in WebSphere? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/459f617f3c919834 ========================================================================== == 1 of 1 == Date: Sat, Oct 16 2004 1:15 pm From: Jim Palistrant <[EMAIL PROTECTED]> Not all server settings are exposed in the WebSphere Studio server config editor. Some must be entered using the normal WebSphere admin console. Kim wrote: >There are many xml files for various settings under the >Servers/<servername>.wsc/cells/localhost directory for your workspace. > This will have info about virtual hosts, variables, etc. > >What settings are you looking for specifically? > >Thanks! >------------------------ > > >[EMAIL PROTECTED] (Malcolm Weber) wrote in message news:<[EMAIL PROTECTED]>... > > >>In Websphere/Eclipse the developer can setup the server with a lot of options. >> >>Where are all these settings stored? I didn't found certain setting values in the >>properties file for Websphere. >> >>Malcolm >> >> -- Jim Palistrant IBM Rational WW Technical Consultant - WebSphere Development Tools ========================================================================== TOPIC: What technoligies should I study? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dbf2694694cafb0a ========================================================================== == 1 of 1 == Date: Sat, Oct 16 2004 1:24 pm From: [EMAIL PROTECTED] Hi, I must admit that I´m less than a beginner ,since I don´t even Bought my first java book. But I´ve read almost everything that are printed here in Brazil,and a lot of articles in the Internet. I´m actually a Delphi programmer ,I basically write ERP and CRM programs. I choose Delphi in 1997 because it was much faster than Java for the kind of applications I produce. Now that Java is a mature plataform and Delphi is sinking.I´m having problems deciding what technologies to choose . First. What tecnologies should I study in order to create good ERP software(EJB). I guess JSP is something that won´t help me much at first for example. What free IDE to use? What are the limitations of the Free IDES (IBM for example distributes a paid version o Eclipse?) SWT seems to be the right thing to me ,Does Netbeans come with SWT´s support? I never saw a huge product here in Brazil projected and constructed based in UML? The majority of Java programmers(specially those who creates the same kind of program I write Uses or not UML?). What report Generator to Use? My reports in Delphi are half procedural /half OOP. I use banded report engines only for very simple reports. Is there any open source ERP project made with NetBeans or Eclipse? I know I should concentrate in the basics of Java and them decide what Ide to use but I´ve to buy books,make plans and etc. Regards, Neuza Alves da Silva ========================================================================== TOPIC: Challenge: Triangles puzzle http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5e013ca5d7daa5f0 ========================================================================== == 1 of 6 == Date: Sat, Oct 16 2004 1:38 pm From: Frank Buss <[EMAIL PROTECTED]> I've setup a challenge, mainly for C++, Java and Lisp, but every other language is welcome: http://www.frank-buss.de/challenge/index.html There is nothing to win, but I hope there will be some interesting solutions at the end, so the win are the results :-) -- Frank Buß, [EMAIL PROTECTED] http://www.frank-buss.de, http://www.it4-systems.de == 2 of 6 == Date: Sat, Oct 16 2004 12:58 pm From: Jim Newton <[EMAIL PROTECTED]> Sorry, but i do not agree with your solution. You missed many triangles. E.g., P0 -> P8 -> P5 -> P0 is a triangle of zero area. but it is not counted in th solution of 27. -jim Frank Buss wrote: > I've setup a challenge, mainly for C++, Java and Lisp, but every other > language is welcome: > > http://www.frank-buss.de/challenge/index.html > > There is nothing to win, but I hope there will be some interesting > solutions at the end, so the win are the results :-) > == 3 of 6 == Date: Sat, Oct 16 2004 2:04 pm From: Frank Buss <[EMAIL PROTECTED]> Jim Newton <[EMAIL PROTECTED]> wrote: > Sorry, but i do not agree with your solution. > You missed many triangles. > > E.g., P0 -> P8 -> P5 -> P0 is a triangle of zero area. > but it is not counted in th solution of 27. you are right, this was not exact enough, I've updated the web page. Only triangles with area>0 should be counted. -- Frank Buß, [EMAIL PROTECTED] http://www.frank-buss.de, http://www.it4-systems.de == 4 of 6 == Date: Sat, Oct 16 2004 2:29 pm From: "Yogo" <n o s p a m> > Sorry, but i do not agree with your solution. > You missed many triangles. > > E.g., P0 -> P8 -> P5 -> P0 is a triangle of zero area. > but it is not counted in th solution of 27. hmm... What are you talking about? A triangle with an area equal to zero doesn't exist. A triangle has three angles and none of them may be equal to zero, otherwise you just don't have a triangle. What you describe with P0 -> P8 -> P5 -> P0 is a segment of a line not a triangle... == 5 of 6 == Date: Sat, Oct 16 2004 3:59 pm From: Sudsy <[EMAIL PROTECTED]> Frank Buss wrote: > I've setup a challenge, mainly for C++, Java and Lisp, but every other > language is welcome: > > http://www.frank-buss.de/challenge/index.html > > There is nothing to win, but I hope there will be some interesting > solutions at the end, so the win are the results :-) > Your diagram is incorrect. -- Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development. == 6 of 6 == Date: Sat, Oct 16 2004 4:03 pm From: Mikael Brockman <[EMAIL PROTECTED]> Frank Buss <[EMAIL PROTECTED]> writes: > I've setup a challenge, mainly for C++, Java and Lisp, but every other > language is welcome: > > http://www.frank-buss.de/challenge/index.html > > There is nothing to win, but I hope there will be some interesting > solutions at the end, so the win are the results :-) Thanks Frank. Fun way to waste half an hour. :-) ========================================================================== TOPIC: CPU increasing slowly up to 100% http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3970cf07d01d1d5c ========================================================================== == 1 of 1 == Date: Sat, Oct 16 2004 1:41 pm From: [EMAIL PROTECTED] (SLL) Hi all. We have 3 JVM installed on a 4 CPU server running Windows 2000 server. JVM is Sun 1.4.2_04. Under constant load, the cpu usage is SLOWLY increasing from 5% up to 100% in 20-30 hours. The cpu increase is not linear, but parabolic. The cpu usage is equally distributed on the 3 JVM (33% each). Memory usage per JMV remains constant (300-400 MB). We already have investigated the Garbage Collector behavior and seams not to be an issue, because the GC interval and the time used fo GC are constant and <100 ms. When we restart 1 of the 3 JVMs, the CPU usage suddenly decrease to 5% and the observed behavoir restart again. Any idea? Thanks. -=SLL=- ========================================================================== TOPIC: Setting up a J2EE AS on Linux http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/82c0aa389344470b ========================================================================== == 1 of 1 == Date: Sat, Oct 16 2004 1:59 pm From: Edwin Martin <[EMAIL PROTECTED]> Andrew Thompson wrote: > Andy wrote: > >>I have no prior knowledge of J2EE / EJB and the likes and want to set >>up a J2EE application server on my PC running Fedora Linux 2. Can >>anyone please suggest what would be a good and easily available app >>server that I could setup and with which I could test out most of the >>code that I write. > > Apache/Tomcat should do the trick.. > <http://jakarta.apache.org/> > <http://jakarta.apache.org/tomcat/> Tomcat does not support EJB's. J2EE application servers supporting EJB's are: - JBoss: http://www.jboss.org/index.html - Resin: http://www.caucho.com/resin-3.0/ - Geronimo (not stable yet): http://geronimo.apache.org/ They're all free. Edwin Martin -- http://www.bitstorm.org/edwin/en/ ========================================================================== TOPIC: java.exe has encountered problems and needs to close http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3aa458c564052dc2 ========================================================================== == 1 of 2 == Date: Sat, Oct 16 2004 2:04 pm From: "Ryan" <[EMAIL PROTECTED]> I get this whenever i run tomcat. I try to run java.exe by itself and i get the same error. i am on windows xp. any ideas? == 2 of 2 == Date: Sat, Oct 16 2004 4:36 pm From: "Tony Morris" <[EMAIL PROTECTED]> "Ryan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I get this whenever i run tomcat. I try to run java.exe by itself and i get > the same error. > > i am on windows xp. > > any ideas? > > First guess, installation problem. Second guess, JVM bug (the VM should never seg. fault on it's own - without assistance by defective native code) -- Tony Morris http://xdweb.net/~dibblego/ ========================================================================== TOPIC: Need help w. Image Servlet. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1bd066386cd1860 ========================================================================== == 1 of 1 == Date: Sat, Oct 16 2004 2:09 pm From: Steve Burrus <[EMAIL PROTECTED]> Oscar, thank you very much for being THE ONLY RESPONSE back to me so far, but I guess that i should be grateful/thankful for that! Listen, I ended my post on this subject with an offer to submit my servlet code, so here it is for YOU, at least,to look at!! (Incidentally, I got this code from a web page which someone referred me to to try to help me with tbis problem) : >>"// This method is called by the servlet container to process a GET request. public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {* // Get the absolute path of the image ServletContext sc = getServletContext(); String filename = sc.getRealPath("image.gif"); // Get the MIME type of the image String mimeType = sc.getMimeType(filename); if (mimeType == null) { sc.log("Could not get MIME type of "+filename); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); return; } // Set content type resp.setContentType(mimeType); // Set content size File file = new File(filename); resp.setContentLength((int)file.length()); // Open the file and output streams FileInputStream in = new FileInputStream(file); OutputStream out = resp.getOutputStream(); // Copy the contents of the file to the output stream byte[] buf = new byte[1024]; int count = 0; while ((count = in.read(buf)) >= 0) { out.write(buf, 0, count); } in.close(); out.close(); } "<< * The asterisk up at the top of the code means that i noticed that it has only the IOException and not the usual ServletException also in the start of the "doGet()" method, is that correct? Oscar kind wrote: > > Where is the image stored? The easiest way is the classpath, as you can > then use Class#getResource(String) and Class#getResourceAsStream(String). > > ========================================================================== TOPIC: Find all implementing classes in classpath? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/db894e13020738bd ========================================================================== == 1 of 1 == Date: Sat, Oct 16 2004 2:24 pm From: "John McGrath" <[EMAIL PROTECTED]> On 10/16/2004 at 4:14:18 AM, Tor Iver Wilhelmsen wrote: > J2SE has AFAIK two ClassLoader implementations it uses, the > URLClassLoader (for instance used by applets) and the one that uses > the classpath. Just a note: the ClassLoader that uses the classpath is provided by the Sun Java launcher (java.exe). It is known as the System ClassLoader, and it is also a URLClassLoader. In particular, it is of an instance of the class sun.misc.Launcher.AppClassLoader, a subclass of URLClassLoader. I think pretty much all ClassLoaders used by Java are subclasses of URLClassLoader, although that is not necessary. The ClassLoader used by applets depends on the container that sets up the Java Virtual Machine. You may have different ClassLoaders, depending on whether you are running your applet in the AppletViewer, a browser, etc. In the latter case, it will depend on which browser you are using. -- Regards, John McGrath ========================================================================== TOPIC: emacs Vs Eclipse? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/58b6f53b3e1b91e1 ========================================================================== == 1 of 1 == Date: Sat, Oct 16 2004 4:03 am From: Alan Mackenzie <[EMAIL PROTECTED]> Oliver Scholz <[EMAIL PROTECTED]> wrote on Wed, 13 Oct 2004 20:39:36 +0200: > [EMAIL PROTECTED] writes: >> In article <[EMAIL PROTECTED]>, Alan Mackenzie <[EMAIL PROTECTED]> wrote: >>>Phillip Lord <[EMAIL PROTECTED]> wrote on 12 Oct 2004 15:27:09 +0100: >>>> Emacs could definitely do with being easier to use. >>>Hardly. Emacs is phenomenally easy to use. It's just difficult to >>>learn how to use. >> And this is an important distinction to make! >> There are plenty of tools (emacs being one) that are not particularly >> novice-friendly, but are quite expert-friendly. (To paraphrase the >> old joke about Unix, emacs *is* user-friendly -- it's just choosy about >> its friends.) > [...] > I am personally not that convinced that this distinction is that > important. I agree that it might become important, if it should happen > that making some functionality more friendly to beginners would also > make it more tedious to use in the long run. That would be bad UI > design. > But I do think that Emacs could see waste improvements here, .... You mean improvements in the garbage collection algorithm? ;-) > ..... without sacrificing the benefits of the interface it currently > provides. Assistants ("wizards") could be one such improvement for > customization. A better GUI (-framework) than a meagre toolbar and an > unwieldy menu another one. Why, oh why a GUI? Emacs is a program for manipulating _text_. Surely a TUI is wanted, not a GUI. > Oliver -- Alan Mackenzie (Munich, Germany) Email: [EMAIL PROTECTED]; to decode, wherever there is a repeated letter (like "aa"), remove half of them (leaving, say, "a"). ========================================================================== TOPIC: Alternative to InstallAnywhere Now? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/42f0205528bd98d8 ========================================================================== == 1 of 1 == Date: Sat, Oct 16 2004 4:01 pm From: [EMAIL PROTECTED] (BitRock) > I have been using InstallAnywhere Now to install my Java applications on > Windows. It seems that ZeroG has decided to no longer make this free product > available. I can't say that I blame them since having the free version was > surely cutting into their sales. > > I can't afford the $2000 they now want for InstallAnywhere. If they had the > old InstallAnywhere Now for (say) $200 I definitely buy it. > > I can't continue to use the old InstallAnywhere Now because it does not > recognize Java 1.5 and configure the app to run with it. I need an installer > that will install an app to run with java 1.5. Does anyone have any > recommendations for simple installers in the less than $300 range? We have clients happily using our installer to deploy Windows apps with JRE 1.4, 1.5 http://www.bitrock.com You can either download the multiplatform version (Linux, Windows) or, if you just need Windows support, contact us for the (cheaper) Windows-only version. ========================================================================== TOPIC: Cancel HttpServletRequest using a Filter http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c3a04c1dddd5c58b ========================================================================== == 1 of 1 == Date: Sat, Oct 16 2004 4:26 pm From: [EMAIL PROTECTED] (Arvind) [EMAIL PROTECTED] (Tim) wrote in message news:<[EMAIL PROTECTED]>... > I'm trying to stop a file upload from a form post if the file size is > too large, but I need to do it as early as possible in the upload > process. > > When exactly does the Filter kick in? Does the file upload have to > complete before the filter? > > Here's how things are laid out: > 1. JSP form posts multipart request to server > 2. Filter kicks in and looks at the content-length header > 3. If content-length exceeds limit, redirect to a URL > > See my code snippet below: > > public void doFilter(ServletRequest req,ServletResponse > res,FilterChain chain) throws IOException,ServletException { > HttpServletRequest request = (HttpServletRequest) req; > HttpServletResponse response = (HttpServletResponse) res; > > int contentLength = request.getContentLength(); > String contentType = request.getContentType(); > > try { > // if this is a multipart (file upload) request > if (contentLength > 0 && contentType != null > && contentType.startsWith("multipart/form-data")) { > // compare content-length to max file size > if (!acceptFile(request, contentLength)){ > response.sendRedirect(response.encodeRedirectURL(ERROR_URI)); > return; > } > } > > chain.doFilter(request, response); > return; > > } catch (Exception ne) { > throw new ServletException(ne); > } > } > } If you did not know, HttpServers/WebServer typically support the ability to configure the size of upload permissible. (e.g. IBM Http Server) -- Arvind ========================================================================== TOPIC: inheritance and object creation http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3aa79a7b125fbdbb ========================================================================== == 1 of 1 == Date: Sat, Oct 16 2004 4:44 pm From: [EMAIL PROTECTED] (mank) I have a class A which is very big (around 500 lines of code). Now I have to add extra functionality to the class(for which I hv to add a method of 150 lines of code). I don't want to cluster the class A even more. I may need to create Class B having those 150 lines of code and then have a public method loadDatamethod()and then I have following options, which one is better ? 1. let class A inherit class B and call method loadDatamethod() wherever reqd. 2. In class A, Instantiate class B and call the appropriate method. 3. Make the method loadDatamethod() static and then in Class A, call it B.loadDatamethod(). The advantage is, we don't have to create an instance of class B. Any other option? What are the advantages and disadvantages of these and when should one be used over the another? ======================================================================= You received this message because you are subscribed to the Google Groups "comp.lang.java.programmer". comp.lang.java.programmer [EMAIL PROTECTED] Change your subscription type & other preferences: * click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe Report abuse: * send email explaining the problem to [EMAIL PROTECTED] Unsubscribe: * click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe ======================================================================= Google Groups: http://groups-beta.google.com
