Cache Response Headers in Dispatcher?

Hi,
I noticed in the following link:  http://dev.day.com/docs/en/cq/current/deploying/dispatcher.html
"Due to this, the Dispatcher stores only the HTML code of the page - it does not store the HTTP headers. This can be an issue if you use different encodings within your website, as these may get lost."
I created a JSON renderer, which sets the content type in the header to be JSON:
response.addHeader("Content-Type", "application/json");
This works the first time (before caching)
However, once cached by the dispatcher, the server sets the content type as "application/x-javascript"
I am guessing there is no way to override this.  Any ideas?
Thanks

Thanks Sham HC.
Just to clarify - you meant registering this at the WebServer (Apache level), correct?  You weren't referring to any configuration in the author, publish or Dispatcher.any file.  Is that correct?

Similar Messages

  • Disable Pagma and Cache-Control headers in SunOne WebServer 6.1

    Hi,
    I want the [Pragma] and [Cache-Control] headers completely disappear from SunOne WebServer 6.1 JSP responses (like the SunOne WebServer 6.0 SP8, http/1.1 but no [Pragma] and [Cache-Control] headers), can I achieve this?
    Thanks,
    Harry

    Hi Harry
    Do you mean that WebServer 6.0 SP8 provide a way to disable these two attributes? If so, that will be a regression issue for WS6..

  • Request Response Headers

    Hello All,
    Is there any way for me to get back the HTTP Response Headers using the J2EE framework in the format as given below ? I have a Filter which gets me the Request headers but I want to get the corresponding Response Headers also. Can it be done ?
    HTTP/1.1 200 OK
    Date: Mon, 19 Oct 2004 22:12:57 GMT
    Pragma: no-cache
    Server: WebLogic WebLogic Server 6.1 SP1 09/18/2001 14:28:44 #138716
    Content-Length: 297
    Content-Type: text/html
    Expires: Thu, 01 Dec 2004 16:00:00 GMT
    Set-Cookie: SessionID=null; path=/
    Set-Cookie:
    JSESSIONID=O1mD6qo4DcTRQPV3IuQFKR2TBiANadyyzQG2WqsRLOuyPjIABhPQ!1713637281!-
    1073741567!7001!7002; path=/
    Cache-Control: no-cache, post-check=0, pre-check=0
    I am printing out the request headers right now but I want the corresponding response headers sent by the server to the request headers.
    I am using IE. Basically I am trying to track a JSESSIONID which is being lost somewhere. Thus I have to do it programatically.
    Thanks

    http://www.fawcette.com/Archives/premier/mgznarch/javapro/2001/07jul01/kj0107/kj0107-2.asp
    look for "Listing 4" for the code to get the response headers.
    basically he uses a wrapper class around the response object. When any header is added to the reponse he logs the header name and value. When the wrapped response returns to the Filter he then prints out the logged values.

  • Need help on extensibility of response headers

    hi everyone
    Is it possible toextend the functionality of response headers through servlets
    help wud be greatly appreciated
    thanks in advance

    You can add extra header information through the use of the HttpServletResponse.setHeader( String name, String value ) or HttpServletResponse.addHeader( String name, String value ).

  • Reading response headers on HttpService response

    I'm trying to figure out if there is a way to read response headers on a response from a request to an HTTPService.  I've been scouring the internet for any indication that it might be possible to read them without any luck so I'm guessing its not possible but I figured it would be worth asking here.  I've noticed that ResultEvent.headers is set to null but maybe there is some way to activate them?
    Another possible solution for me would exist if there is any way within an AIR application to read all of the cookies that have been set.  So, if there is any call to query the AIR runtime for all of its cookies that would also be extremely helpful.

    Hello Sir,
    Plese guide me how to access data from other server by using
    http request

  • Can't propagate Cache-Control headers with Surrogate-Control header

    My application may set the following response header to cause webcache to process the esi:include's:
    Surrogate-Control: content=ORAESI/9.0.4, max-age=3600
    It and also may set the following intended for the browser cache:
    Cache-Control: private
    or say:
    Cache-Control: max-age=3600
    However Webcache removes this and always adds the following whenever surrogate-control has been set:
    Cache-Control: max-age=0
    This means I can't have browser caching and esi page compilation, just one or the other.
    This seems to be designed behaviour can someone explain why this is and if it can be worked around?
    I realise that the Cache-Control header should be ignored by webcache but why cant I propagate it to higher caches?

    Patrik,
    You'll need to convert the meta http-equiv tags into actual HTTP headers before sending for Web Cache to be able to parse it.

  • How do I add data to HTTP response headers in Tomcat?

    Hello
    I am in the process of making our site Platform for Privacy Preferences(P3P) compliant. We are running Tomcat 3.2.2(standalone) on a Linux box. I am looking for information regarding adding data to HTTP header responses(see example below). One of the aspects of P3P compliancy is referencing where a Policy is located and referencing the "Compact Policy" via the "CP" tag. I need to add these values and as I am
    new to Tomcat I need know where to find the header information.
    <!-- example -->
    HTTP/1.1 200 OK
    P3P: policyref="http://somesite.com/P3P/PolicyReferences.xml",
    CP="NON DSP COR CURa ADMa DEVa CUSa TAIa OUR SAMa IND"
    Content-Type: text/html
    Content-Length: 8104
    Server: ...
    ...content...
    <!-- end example -->
    Any suggestions would be appreciated.
    Joe Dalessandro
    e: [email protected]

    Hmm... If you check your server.xml -file, you'll probably find that Tomcat has been configured to use org.apache.tomcat.service.http.HttpConnectionHandler as the connection handler (right under the "Connector classname" value)...
    Would it be possible to tweak that handler or extend it in such a way that you could add your headers?
    Unfortunately I don't work with Tomcat myself, otherwise I could try it...
    If this seems too complicated, I'd just recommend you to install Apache, and do it there...

  • Where do i get All possible response headers

    Hi...
    Where doi get all the possible headers which i can set in response.setHeader(...)of JSP or Servlet
    Thanks

    not 100% sure but you might have a look at http://www.w3c.org (www consortium).
    alternatively you might use google or another search engine to search for something like "hypertext transfer protocol" and "headers"

  • Controlling Cache-Control headers

    We have an application written in BC4J 9.0.3.4 riding atop 9iAS 9.0.3.1.0.
    The release notes for this version of 9iAS say
    2484551 Microsoft Internet Explorer cannot open some file directories due to HTTP NO-STORE header
    If users use Microsoft Internet Explorer 6.0.2600.0000, then they cannot open some attachments, such as Microsoft PowerPoint or voicemail directly. They have to save the file and open it from their file system. The file cannot be opened because Microsoft Internet Explorer 6.0 doesn't save the file to the <code>temp</code> folder when an HTTP no-store header is set.
    Saying that this is fixed is, to say the least, iffy. A packet dump clearly shows the following headers being set at some point after JSP filters get a chance to kick in (i.e., probably by mod_oc4j itself):
    Pragma: no-cache
    Cache-Control: no-store
    Surrogate-Control: no-store
    Cache-Control: private
    There doesn't seem to be any way of turning these headers off other than using .htaccess and mod_headers to explicitly delete them (which is definitely not ideal). Further, my tests indicate that these headers (probably only Cache-Control: no-store) prevent IE5.5 and IE6 both from launching external applications on the basis of Content-Type / extension, and from saving the page at all.
    This is, admittedly, a violation of RFC2616 on IE's part: that RFC states that no-store is meant to apply to intermediate proxies, not to user agents themselves. But nonetheless I think Oracle should at least allow pandering to this particular bug; i.e., even if Cache-Control: no-store is on by default, it should be possible to turn it off.
    Am I missing something? Is there any way to stop mod_oc4j adding these headers?

    I tried the brute-force approach:
    Header set Cache-Control: no-cache
    Header set Surrogate-Control: no-cache
    in .htaccess.
    Alas, .htaccess isn't being read, even with
    <Directory /oracle/product/ias_903/j2ee/OC4J_DEV/applications>
    AllowOverride FileInfo
    </Directory>
    in the httpd.conf.
    This is confusing. Does mod_oc4j somehow ban the processing of .htaccess files even if the AllowOverride says otherwise?

  • Reduce the number of response headers on getting image from storage

    Hello,
    I would like to know if it's possible to get an image from the storage without all the x-ms-* header, Etag and Content-MD5
    I m trying to server images as fast as possible with less overhead possible and the blobs are unique and cannot change.
    can it be done at the blog level or storage level?
    Thank you

    Hi,
      >> So if I can turn them off for serving images from the storage to the browser it would be better.
    As a matter of fact, these headers are always returned, the exception is Content-MD5, if you use an old API (earlier than 2012-02-12) and you don't explicitly
    upload the MD5 when uploading the blob, MD5 will not be automatically calculated and will not be returned in the response, however these headers are not large anyway, it is recommended to bear with them. 
    Best Regards,
    Ming Xu
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Mozilla Firefox 32.0.1 caching objects without cache control headers

    Mozilla firefox is caching objects without any cache-control or expires header in response. The response does contain etag and date header but doesnt indicate anything about the duration it should be caching it. An example URL is https://www.priceless.com/content/dam/priceless/us/en/newyork/component/backgroundimages/NewYork_1920x596.jpg
    Am I missing something very obvious here.

    That is a beautiful picture. I understand that you are looking for a return header information about expiration. The about:cache page will show that information akaik there is a column information about expiration time. Some expire and some don't. I am pretty sure the later is the case you are seeing.

  • How to cache json files with dispatcher?

    Our project is unique in that we want to cache particular json files. Our performance will rely on it. However it seems dispatcher is only capable of caching HTML. This will be real bad news for us if it's impossible.
    In our /cache configuration, we'd like to do:
    /rules
      /0000
        /glob "*.html"
        /type "allow"
      /0001
        /glob "*.docache.json"
        /type "allow"
    Unfortunately, after requesting the json file through the dispatcher, the file is not cached at all, even if doing /glob "*" /type "allow"

    Depends what you mean by clear out. Dispatcher does two things on activation request: invalidate and evict.
    Invalidation:
    find the /invalidate section of your dispatcher.any and add :
    /0001
                /glob "*.json"
                /type "allow"
    Obviously you'll need to change the numeric ID of the rule from 0001 to whatever makes sense for you.
    Eviction (deletion):
    If /mypath/mypage is being activated, then only files meeting globbing pattern /mypath/mypage.* will be deleted, such as /mypath/mypage.html and /mypath/mypage.json... however, child directories WILL NOT be evicted, such as /mypath/mypage/jcr_content/parsys/mycomponent.json
    Bang - buncha info for yah.

  • Caching response using filter without closing response

    Hi all SAP J2EE Gurus!
    I have implemented a servlet filter that caches the response to the client in memory and then uses the cached page for the following calls until the TimeToLive has been reached and this caching is repeated.
    This works fine, except for the actual call that creates the cache. This call, once I have read the response through the responsewrapper, is empty, hence the requesting user gets a blank page and needs to hit refresh to see the cached output.
    All the other calls work fine when we just return the cached page in the response.
    I have gathered so far that the reason for this behaviour is in the implementation of the servlet container in the J2EE engine and hence the behaviour differs between different server implementations.
    I have wrapped the outputstream and its write methods with custom implementation as well as extended the HttpServletResponseWrapper and overwritten the getWriter and getOutputstream methods with custom implementations.
    I am using this filter with the ISA 4.0 which is basically a Struts application.
    Does anyone have some experience with caching the response of the SAP J2EE engine without closing the stream? If yes then would be interested to hear how this was achieved.
    I will add some code snippets with explanation later if someone has some relevant ideas that would need them for clarification.

    i run your codes and get the following:
    PRE
    This is a testpage. You should see
    this text when you invoke filter3.jsp,
    as well as the additional material added
    by the PrePostFilter.
    POST
    my testing environment is
    sun j2ee ri 1.3.1
    and i deploy filter3.jsp and set the filter Mapping as the following
    Filter Name: PrePostFilter
    Target Type: Url Pattern
    Target : /*

  • Reading http redirect response headers in swf

    Hi all,
    I have a URL requested by a ULRLoader object. I know that the URL will redirect to another URL (HTTP 307). What I need to know is the URL the URLLoader is redirected to, not so much the data it receives (which works fine).
    The HTTPStatus event only fires once and only for the status 200 when the data comes in. I was hoping it would fire for the http status 307 as well with some additional info, but no such luck.
    AIR has the httpResponseStatus event which seems to do just what I need, but waddayaknow, I need it in the Flash player.
    Thanks in advance,
    Manno

    I've spent most of the day with this problem and the only solution I could find was to disable KeepAlive support on our Apache web server. I haven't been able to find anything else relating to this problem and would appreciate anyone who could comment because I'm sure Java Web Start should work with KeepAlive (shouldn't it be using HTTP 1.1 and persistent connections anyway?)

  • How to implement content caching for jsp page ?

    Hello everyone,
    I am reading an article <Servlets and Jsp Best Practice>,at
    http://developer.java.sun.com/developer/technicalArticles/javaserverpages/servlets_jsp/#author, on one section it is saying :
    "Cache content: You should never dynamically regenerate content that doesn't
    change between requests. You can cache content on the client-side, proxy-
    side,or server-side. "
    Now I am working on a project. For every user, some of the content servlet generated will be the same for at least a week . I am thinking if I implement caching for these jsp pages, that would increase performace a lot.
    But I have no idea how to implement it either client-side or server-side, can someone give me a hint ?
    Thanks,
    Rachel

    You mean actually you are caching the response stream
    and the key to distinguish between different response
    streams are made of user's different request
    parameters. And the filter's function is to intercept
    the request to see if this request parameter's
    combination already exists in the Hashmap,then either
    use the cached response or forward to
    servlet.....really interesting...Do I get it right ?Yes that's it in a nutshell.
    >
    Then how do you build those response streams in
    advance ? You did it manually or have some mechanism
    to build it automatically ?
    The data gets cached the first time somebody visits the page.
    Find some examples on Filters, and take a look at the HttpServletResponseWrapper class. You need to cache response headers as well as the body. Another pitfall that you might run into is handling an If-modified-since header on the request. Don't cache the results of those requests.
    -Jonathan
    >
    Thanks again !
    Rachel

Maybe you are looking for