473,626 Members | 3,247 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HttpServletResp onse doesn't set the header



I'm using Jetty(version 4.2.19). In my servlet I put following lines:

System.out.prin tln("before: " + resp.containsHe ader("aaa"));

resp.setHeader(
"aaa",
"test" );
System.out.prin tln("after: " + resp.containsHe ader("aaa"));

and I don't understand why I get the following output:

before: false
after: false
it means that header hasn't been set:/ Has anyone had similar problem?
and it would be great you knew the solution :D
thanks in advance for reponse...
--
regards,
Jakub Pawlowski
Jul 17 '05 #1
2 3954

"Jakub Pawlowski" <qo****@poczta. onet.pl> wrote in message
news:cb******** **@news.onet.pl ...


I'm using Jetty(version 4.2.19). In my servlet I put following lines:

System.out.prin tln("before: " + resp.containsHe ader("aaa"));

resp.setHeader(
"aaa",
"test" );
System.out.prin tln("after: " + resp.containsHe ader("aaa"));

and I don't understand why I get the following output:

before: false
after: false
it means that header hasn't been set:/ Has anyone had similar problem?
and it would be great you knew the solution :D
thanks in advance for reponse...
--
regards,
Jakub Pawlowski


For questions about Jetty go to the Jetty mailing lists. You will get any
information you want from the people who know the internals.

Silvio Bierman
Jul 17 '05 #2
hi Jakub ,
If I am right the resp header is set by jetty after your servlet has
executed. So i dont think it will be available to you in the context
of the execution of the servlet.

- Karthik
"Silvio Bierman" <sb******@idfix .nl> wrote in message news:<40******* *************** *@news.xs4all.n l>...
"Jakub Pawlowski" <qo****@poczta. onet.pl> wrote in message
news:cb******** **@news.onet.pl ...


I'm using Jetty(version 4.2.19). In my servlet I put following lines:

System.out.prin tln("before: " + resp.containsHe ader("aaa"));

resp.setHeader(
"aaa",
"test" );
System.out.prin tln("after: " + resp.containsHe ader("aaa"));

and I don't understand why I get the following output:

before: false
after: false
it means that header hasn't been set:/ Has anyone had similar problem?
and it would be great you knew the solution :D
thanks in advance for reponse...
--
regards,
Jakub Pawlowski


For questions about Jetty go to the Jetty mailing lists. You will get any
information you want from the people who know the internals.

Silvio Bierman

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1352
by: ensnare | last post by:
Anyone know why this code just deletes random messages and not ALL the messages? $this->headers is simply imap_headers() $i=0; foreach ($this->headers as $header){ #Trim the header $header = trim($header); #Retrieve the ID of the mesage. if (substr($header,0,2) === 'U ' ||
4
16055
by: Eric West | last post by:
Greetings- I have a web application that has a form that triggers a server process that I would like to provide a "Searching..." page for. My strategy was to send the browser the "top half" of a web page, including an animated "Searching..." gif. I write the contents of this page to the HttpServletResponse output, and then flush the buffer (which I had thought would cause the bytes written thus-far to make their way to the client). I...
1
3324
by: Naresh Agarwal | last post by:
Hi I'm developing a webapp using servlets, which processes a HTTP Post request and sent back MIME message (multipart/related - essentially SOAP message with Attachments). I'm constructing the MIME message manually (as I need to stream it to the client) and writing it to OutputStream (few bytes everytime). In the end, I close the OutputStream, but still client keeps on
0
2998
by: Naresh Agarwal | last post by:
Hi I want HTTPServletResponse to *close* the socket after sending the response. For this I'm closing the OutputStream after writing the data. But still socket is not closed and client keeps on waiting to read data from socket. And surprisingly this happens only if I use multipart/related in Content-Type in the response.
1
27773
by: Java script Dude | last post by:
I am investigating a solution to build all pages sent from my application servlet in UTF-8 encoding. From what I understand, I should be using HttpServletResponse.setCharacterEncoding("UTF-8"). The J2EE API clearly shows that this method is available with superclass ServletResponse but I am getting compile errors using NetBeans 3.6 final. Thanks for your help! Tim
14
2087
by: Tom.PesterDELETETHISSS | last post by:
Hi, I think this question requires an in depth understanding of how a browser cache works. I hope I can reach an expert here. I may have found a quirk in the asp.net documentation or I don't understand what the SetAllowResponseInBrowserHistory does. While researching caching I tried the code sample at the following page : http://msdn2.microsoft.com/library/97wcd0a4(en-us,vs.80).aspx
16
2908
by: a | last post by:
Hi everybody, My config: Win XP (or 2003), Apache 2.0.54, PHP 5.1.2. I have been trying to handle the case of a lenghty opearation on the server while providing the user with feedback and ability to cancel, and nothing seems to work so far. The following code is one attempt to address this, and it is called as result of a POST:
2
2169
by: JRough | last post by:
I have this code that switches templates depending on if the user fills in a form with a request. The request asks for the $mark & $number. If that request gets input then it displays a list otherwise it re-displays the form request. The $template variable changes the value of which template is displayed. if($mark&&$num){ $mark = $mark = strtoupper($mark); $TPL_carnumbers = GetHeaders($_SESSION); $xclheader =
2
2025
by: xinariscy | last post by:
Hello everyone! I have a webpage with a form with two text boxes and the action of the form it's a servlet. I know how to get the HttpServletResponse response from a servlet like this: .... PrintWriter out = response.getWriter(); try { out.println("<html>");
0
8269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8203
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8368
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7203
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4094
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4206
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2630
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1515
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.