Currently I am working on web project which uses JSP/Servlet and struts framework. We are using cache mechanism. I want to clean some of the session attribute from all the active sessions on particular event (For e.g. in case of refreshing cache). So what is best way to implement same ?
...
Hi Gurus,
I have been using tomcat for sometime and still can't find a good way to do file upload. Just wonder how you guys handle file upload.
You know how you can create a symlink in the application to another fs. but then by default tomcat removes your symlink and everything within the symlink. so this add extra steps to auto deploy...
hi there,
i do have a communication probleme here between my java servlet and an ajax request. more about it:
Absolute path to the index.html (including javascript/ajax request):
http://localhost:9080/chat/index.html
In the same folder the servlet:
MyChat.class
And the Request is working like this:
var url = "http://localhost:9080/...
I've created a Java class that connects to an IIS website requiring NTLM authentication. The Java class uses the JCIFS library and is based on the following example:
Config.registerSmbURLHandler();
Config.setProperty("jcifs.smb.client.domain", domain);
Config.setProperty("jcifs.smb.client.username", user);
Config.setProperty("jcifs.smb....
Hi guys,
I'm creating a small servlet. It's hosted at root, "/", and whatever comes after "/" is a resource, like "/myanim.swf". Most of the files are public, but some are private. For public files, they are just served, but for private files, I wish the browser to present an authentication box and have a Digest authentication sent back ...
We have been debating between using servlets or JSP pages and we want to know what the common uses of one versus the other. If you read any online guide that you can point us out, will be very grateful.
...
I am having a web form(JSP) which submits the data to different application, hosted on different server. After submitting the form data, that application redirect back to same JSP page. Now, I want to save the entered the data. What are the different approaches to retain the submitted data in web form. I would not prefer to store the dat...
Hi,
Could anyone please clarify the defination of attribute?
for example, in the following code, what is an attribute:
request.setAttribute("ja",new foo.Employee());
Is the attribute in the above code an object of type foo.Employee(), or it is key/value pair, or it is actually "ja"?
...
Is it possible to write a servlet filter to take inspect HTTP response codes?
I want to write a filter that will non-destructively inspect outgoing HTTP response codes. But, there does not seem to be a getResponseCode() like method on the Response object.
It is also not clear to me how unhandled exceptions from the servlet are supp...
Hi
my Java based webapp has a servlet which streams PDF content back to the browser based on request parameter.
e.g. user clicks on an A tag with an href of "myApp/FetchPDFServlet?id=123". Servlet mapping picks up request, streams PDF data to response as mime-type application/pdf, closes flushes buffers.
However the browser title ba...
Hi,
I'm really confused in the following two lines of Head First servlets & JSP book of page no. 349:
The is a way of declaring and initializing the actual bean object you're using in .
2.Declare and intializea bean attribute with
<jsp:useBean> <jsp:useBean id="person"class="foo.Person" scope="request"/>
In the first line, why...
I'm trying to create a series of sites that all run as one application, but have different designs (to localise them).
My idea is to map separate domain names to the one site. E.g: www.mysite1.com maps to www.mysite.appspot.com/mysite1 and www.mysite2.com maps to www.mysite.appspot.com/mysite2
I'm guessing that there must be a url p...
Hi,
I'm trying to get the contents of a HttpServletRequest. Here is how I'm doing it:
// Extract the request content
StringBuilder stringBuilder = new StringBuilder();
BufferedReader bufferedReader = null;
String content = "";
try {
InputStream inputStream = request.getInputStream();
if (inputStream != null) {
bufferedReader = new...
I would like to implement a socket server that will be connected to by multiple clients. In order to make the implementation as simple as possible and not have to code management of threads and connections etc I'd like to use Tomcat. We already use tomcat as part of our solution.
I am sure that Tomcat can be used for non http servlets a...
I'm playing with dynamic updates to Google Earth KML files.
The updates are of the form
<kml...>
<NetworkLinkControl>
<Update>
<targetHref="...">
<Change>
<Placemark targetId="...">
...stuff to update...
</Placemark>
</Change>
</Update>
</NetworkLinkControl>
</kml>
And it all work...
sock = new Socket("www.google.com", 80);
out = new BufferedOutputStream(sock.getOutputStream());
in = new BufferedInputStream(sock.getInputStream());
When i try to do printing out of content inside "in" like below
BufferedInputStream bin = new BufferedInputStream(in);
int b;
while ( ( b = bin.read() ) != -1 )
{
...
Hi, I've coded some algorithms in java and I need to include those algorithm in my web application.
I'm using Apache Tomcat and what I need to do is that when, for example, I click on the start button on my web page a java class should be executed. I think this done by using servlets, am I right? If so, do you know where I can find some...
HttpGet httpget = new HttpGet("http://www.google.com/");
System.out.println("executing request " + httpget.getURI());
// Create a response handler
ResponseHandler<String> responseHandler = new BasicResponseHandler();
String responseBody = httpclient.execute(httpget, responseHandler);
this will get responseBody as...
My java servlet call httpclient to get page content. may I know what is the best practice to re-use same session for same user when doing multiple sub sequence request from servlet
...
pseudo code
service(..){
//httpclient get http://www.facebook.com
}
the above is pseudo code for java servlet, when user call this servlet service(..) from browser repeatly
for instance
1. call http://localhost:8080/callService?url=facebook.com/index.php
2. call http://localhost:8080/callService?url=facebook.com/editprofile.p...