Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!

Tim Koop

Greenhorn
+ Follow
since Jun 23, 2005
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tim Koop

Originally posted by Ben Souther:
The return; statement doesn't do it for you?



No it doesn't. When I start uploading a large file, the code quickly detects that it has exceeded the maximum limit (if the maximum limit is small enough). I can even write a note to the log saying that the limit has been reached and we should close the connection, but the complete file still gets uploaded the whole way even long after we don't want to listen any more. I want to get a hold of the tcp socket and close that connection, or tell someone else to please close it for me because I'm not going to listen any more.

--
Tim
13 years ago
JSP
Hi everyone.

Does anybody know how, in a jsp or servlet, to forcibly close the http connection so the client (browser) shows some sort of page saying the server closed the connection?

For those of you who will want to know why I need to do this, I'll tell you. We have a file upload page and we want to set a maximum limit. I have already figured out how to do this with commons fileUpload, and that works fine, but after I detect the fact that the user is sending us way too much data, I want to close the connection. It just saves bandwidth charges this way.

I've tried request.getInputStream().close(), but that doesn't seem to do it.

Any other ideas?

Thanks in advance.

--
Tim
13 years ago
JSP
I've got a little program that does backups using java.util.zip, and I would like to add the ability to password-protect the zip file.

Does anybody know how to do this or can anyone point me in the right direction? I've looked around and found nothing. Maybe somebody here knows something. If so, I would greatly appreciate it.

Thanks a lot!

--
Tim

p.s. I'm trying add encryption to http://snazzybackup.sf.net
13 years ago
If you are talking screen widgets, then a jsp or asp or html doesn't make a difference, since they run on the server and only html are returned to the web browser.

So you're choices are using SWT in a java applet, or using javascript. I can't think of a way to use javascript, so I guess your choice is applet.
14 years ago
Hi everyone.

I have a swing application, and I want it to look like the System's look and feel, so I have this line at the begining:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

However, I also want the user to be able to pick his/her favourite other look and feel if it is different, such as with a -D in the command or a setting in the swing.properties file. The only problem is that if nothing is defined, it defaults to swing Metal, which doesn't look as good as anything else.

Does anyone know a good way to allow the user to pick any LookAndFeel, but still set it to be the SystemLookAndFeel if nothing else is explicitly chosen?

Thanks in advance.
14 years ago
OK So I've concluded that it's impossible to restrict the parameters that are going into an included page, at least not without a bit of programming. If you really need this and you're not afraid of a bit of programming, do this:

Make yourself a class called CustomRequest that implements HttpServletRequest. In the constructor, pass in your request object and the new parameters you want as a Hashtable. In all the many many methods that you have to implement, simply call the request object's method on that method, except for the getParameter... methods where you should return values from your own hashtable. Make one more public static method called "include" that takes as parameters: request, response, out, the filename to include, an array of new parameter names, and an array of parameter values.

Then in this "include" method, do this:
1. flush out
2. pack your parameters from the arrays into a hashtable called params.
3. construct the uri of the include file, based on request.getRequestURI() and the filename passed in. Call it uri.
4. run the following lines of code

HttpServletRequest customRequest = new CustomRequest(request, params);
request.getRequestDispatcher(uri).include(customRequest, response);


In your jsp, call it like this:


Please don't ask me for the code; it's copywrited out of my control. And I'm going to stop monitoring this thread, so have a nice day.
14 years ago
JSP
OK Let's say I want to display some information on a side bar of every page on my site, and this side bar is an include to a search page (called search.jsp) that returns the latest however many things you want. Let's say it returns a list of cars for sale.

I can override the parameters like this:

Now let's say this search.jsp can also take a parameter called "new". If "new" is not null, search.jsp only returns new cars. This would be usefull if search.jsp was being called from a form and the form contained a checkbox called "new". If it wasn't checked, there would be no "new" parameter being passed in to search.jsp.

But if any page on my web site contains a parameter "new", it will be passed in to searc.jsp and it will only return new cars.

So my question is now: Is there a way to null out or remove certain parameters from being passed into an include page?
14 years ago
JSP
Hi everyone!

I'm looking for a way to include another jsp page in a jsp page without passing in all this page's parameters.

I know you can include a page with <jsp:include page="nextpage.jsp"> or <%@ include file="nextpage.jsp" %>, but the problem is that in nextpage.jsp if you call request.getParameter(...), it will have all the parameters that the original page has.

Is there some way to not pass in all the parameters automatically?

Thanks for your ideas.
14 years ago
JSP