Setting response header without scriptlet
Can I set a response header from JSP without using a scriptlet?
With scriptlets I can do <%response.addHeader("name", "header")%>
but is there also a JSTL tag or similar to do it? (Except for writing a custom tag myself)
As far as i know JSTL is not designed for this, as it is designed to work as a view language in the mvc model.
And since you handle requests and responses in a controller, I don't think there will be something for JSTL.
Similar Messages
-
How to set response header in filter
Hi,
i want to set the response header in my security filter:
private void setHeader() {
FacesContext ctx = FacesContext.getCurrentInstance();
if (ctx != null){
HttpServletResponse response = (HttpServletResponse)ctx.getExternalContext().getResponse();
response.setHeader("Pragma", "No-Cache");
response.setDateHeader("Expires",0);
response.setHeader("Cache-Control", "no-cache");
}But ctx is always null? What am i doing wrong?
Regards,
barntiMy understanding is you will not have Faces Context in a filter as you have not yet hit the faces lifecycle..
Try the below to get the context.
* (non-Javadoc)
* @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
public void init(FilterConfig config) throws ServletException {
setFilterCfg(config);
setServletCtx(filterCfg.getServletContext());
* Since your typical FacesContext.getCurrentInstance() will probably be
* null due to the fact we have not hit the faces lifecycle yet, we must dup
* some of the faces servlet code here to create a new current instance.
* @param req
* @param res
* @return FacesContext which is fresh and virtually empty.
protected FacesContext getFacesContext(ServletRequest req,
ServletResponse res) {
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext != null) {
return facesContext;
// Use the FactoryFinder to grab the Lifecycle object
FacesContextFactory contextFactory = (FacesContextFactory) FactoryFinder
.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder
.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
Lifecycle lifecycle = lifecycleFactory
.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
facesContext = contextFactory.getFacesContext(servletCtx, req, res,
lifecycle);
ProtectedFacesContext.setFacesContextAsCurrentInstance(facesContext);
return facesContext;
} -
Setting response header fron JSP
Hi
I would like to know how I can set "If-Modified-Since" header, so that when client refreshes the page again the server should send 304 (Not Modified) status to the client.
I was able to do this in servlets as follows,
{code}
class Servlt extends HttpServlet
private long modifiedTime ;
init()
modifiedTime=System.timeMilliSeconds /1000*1000;
//service method automatically calls getLastModified() for the conditional GET
long getLastModified()
return modifiedTime;
{code}
How I can achieve the same in JSP ?
Is this work for POST method?
Is refreshing the browser submits page with GET or POST ?
Please help me understanding these and the solution for the above using JSP.
Thanks in advance.{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}{code}Try to set "Last-Modified" response header via setDateHeader method.
-
Problem while setting response header in a filter
Hi,
I am intercepting response in a filter and trying to modify the response header, so that my subsequent class would get the header in request .
Somehow i don't get the header in request. I don't know whats going wrong.
I have few more filters other than the one in which i m modifying the response header.
I change the response header before calling doFilter() method.
Where am i going wrong ?The subsequent servlets and filters will get the same request that the first filter has. The passing to the next servlet is via a method call.
-
Setting the header of a Column group in a Advanced table dynamically
Hi All,
There is a requirement to set the Header of a column group in a Advanced table dynamically by fetching the values from a view attribute.
Code :
OAAdvancedTableBean spiderTbl1 ;
Problem:
It is not able to set the value for the header inspite of getting the handle of the bean.
Analysis:
the same piece of code works for
1) Setting the text of the advanced table
2) Setting the header of a column in a column group
Please let me know if there is anything more that needs to be done for setting the prompt of a column group header.
Thanks in advance!I have posted it without giving the complete code by mistake. Below is the code:
OAAdvancedTableBean spiderTbl1 ;
OASortableHeaderBean spiderHdr1;
spiderTbl1 = (OAAdvancedTableBean)webBean.findChildRecursive("SpiderCatTbl1RN");
if (spiderTbl1!=null){
spiderHdr1= (OASortableHeaderBean)spiderTbl1.findChildRecursive("AnalogHdr");
if (spiderHdr1!=null) {
spiderHdr1.setAttributeValue(OAWebBeanConstants.PROMPT_ATTR,
new OADataBoundValueViewObject(spiderHdr1,
"SpiderCategory1",
"ProjRegPVO1"));
} -
Wrong content length in response header, ICM
Hello,
When i checked in the SMICM log file i got the error message:
[Thr 1085303104] *** ERROR => HttpClntHdlResponse: client: premature EOS (28980/59150) - wrong content length in response header
Kindly let me know what may be the cause of this error.
Kind regards
LutzHi Raghu and Anil,
here are some more information:
Kernel-Release 700
Compilation Linux GNU SLES-9
Patch-Level 201
SAP_ABA 700 0019 SAPKA70019
SAP_BASIS 700 0019 SAPKB70019
PI_BASIS 2005_1_700 0019 SAPKIPYJ7J
ST-PI 2008_1_700 0000 -
SAP_BW 700 0021 SAPKW70021
SAP_AP 700 0016 SAPKNA7016
SAP_APPL 600 0015 SAPKH60015
SAP_HR 600 0038 SAPKE60038
ST-A/PI 01L_ECC600 0000 -
ICM Parameter
Services
icm/server_port_0 = PROT=HTTP,PORT=8022
icm/server_port_1 = PROT=SMTP,PORT=0
Hard limits
icm/max_services = 30
icm/listen_queue_len = 512
icm/req_queue_len = 500
icm/max_conn = 500
icm/max_sockets = 2048
Thread handling
icm/min_threads = 10
icm/max_threads = 50
icm/min_spare_threads = 3
Tracing and statistic
rdisp/TRACE = 1
icm/tracefile = dev_icm
icm/log_level = 0
icm/stat_level = 1
icm/security_log = LOGFILE=dev_icm_sec,MAXSIZEKB=500
icm/accept_remote_trace_level = 0
Monitoring
icm/ccms_monitoring = 1
icm/ccms_refresh_rate (sec.) = 30
Timeout handling
icm/keep_alive_timeout (sec.) = 60
icm/conn_timeout (msec.) = 5000
HTTP settings
icm/HTTP/max_request_size_KB = 102400
icm/HTTP/server_cache_0 = PREFIX=/, CACHEDIR=/usr/sap/PF1/DVEBMGS22/dat
a/cache
icm/HTTP/admin_0 = PREFIX=/sap/admin,DOCROOT=/usr/sap/PF1/DVEBMG
S22/data/icmanroot/admin,AUTHFILE=/usr/sap/PF1/SYS
icm/HTTP/auth_0 = PREFIX=/,FILTER=SAP
HTTP(S) error handling
is/HTTP/show_detailed_errors = 1
HTTPS (SSL) settings
icm/HTTPS/verify_client = 1
ssf/name =
ssf/ssfapi_lib =
sec/libsapsecu =
ssl/ssl_lib =
Context Quotas
icm/HTTP/context_quota = 90%
icm/HTTPS/context_quota = 90%
icm/SMTP/context_quota = 90%
Memory Pipe settings
mpi/total_size_MB = 80
mpi/buffer_size = 65536
J2EE settings
rdisp/j2ee_start = 0
is/HTTP/default_root_hdl = J2EE
Content Filter settings
csi/enable = TRUE
csi/SAP/csa_lib = /usr/sap/PF1/DVEBMGS22/exe/libsapcsa.so
Misc
icm/host_name_full = cipf122.ikk.local
icm/cancel_strategy = cancel requests without session (stateless)
rdisp/plugin_auto_logout = 1800
is/HTTP/virt_host_0 = :;
is/SMTP/virt_host_0 = :;
Best regards
Lutz -
Setting Reponse Header in a portlet?
I want to set the 'Content-Disposition' response-header field
as 'attachment;"myfile.csv"'. So that user will be able to
download the cotent as a .csv file.
But the setHeader() of the response object doesn't seem to work
in the portlet.
How do I set the response header in a portlet?
Thanks
SagarThe subsequent servlets and filters will get the same request that the first filter has. The passing to the next servlet is via a method call.
-
hi
how to set (or is it even possible) to set http header (in http request) in JEditorPane (to set referrer, user agent, etc.)
thanks a lotThanks Raja,
I am not an ITS expert by any means. I need help to work out how use the information in OSS Note 494984 to solve my problem.
The note seems to be about setting headers on all incoming requests to ITS.
I need to set the content-type header on an outgoing response generated using a specific (XML) template.
I did the BC440 course back in 2000 but after 2000 I never did another ITS project, focusing on Java and J2EE instead. So I am not sure how to apply what the OSS Note says. Do I need to assign the content type to a Business HTML parameter in the template? The documentation I have with SAP@Web Studio is not helpful. -
RFX Response Header : Fill Display Fields on Header Level
Hi Gurus,
There is a requirement at the client place to add the Display only field for RFx Response Header. Based on this required I have done the following activities.
1. From 'Define Customer Display Fields on Header Level' in SPRO i have appended the ZFIELD in the Response header structure.
2. From 'Configure Control for Fields on Header Level' in SPRO i have made it visible true.
3. From 'Fill Display Fields on Header Level' SPRO i have Enhanced the /SAPSRM/BD_PDO_FE_FILL_HEADER with implementation. And have given required filter criteria. In the implementation Class it has the return parameter as CS_HEADER_DATA. Where i could fill the my ZFIELD.
The field is now displaying in the SRM portal. But the problem is that the ZFIELD is not being filled with any value, even though i supplied it.
Is there any step that is missing to set the value?
Regards,
HobsHi,
The main technique is to do your calculations in PAI of the screen for additional data B for the line item but as you said it is accessed only when you goto-> item -> additional dataB
So you can do one more thing...do the calculation in PAI/PBO of the screen first and in userexit_save_document_prepare recalculate again and overwrite the old ones(or calculate for only the ones which are initial in the item) ..so if he goes to additional data B screen you give the user what he wants and if he doesn't userexit_save_document_prepare takes care of it
user can go to additional dataB only a line item at a time so the chance that he takes all the line items one by one is less(for huge number of line items)..so you just calculate and overwrite the fields in the in the userexit if the field value is empty...or you can recalculate for all the cases and overwrite just in case there may be a problem....
in the screen of the additional dataB
Write logic for calculating the field values
so in the userexit you write like
if the fields are initial..
calculate
else
*already calculated from the screen because user has viewed it
endif.
So you are safe that user can see what he wants and you can reassure that the value will be calculated and stored on the SAVE from user exit
Please check,revert
Reward if helpful
Regards
Byju -
Setting response.setStatus
Dear Sirs,
How can I set the HTTP 1.1 Status Code, for example, for 413 ( Request Entity Too Large ) and then use it on the site.
Thank youSharif wrote:
Dear nclow,
Thanks a lot for your reply.
I understand how to set it but how will I use it after I have set. For example something like
if
response.setStatus(HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE ) (may be if it is larger than say 100 character)
then redirect to, say for example, tooLargeError.jsp.
How will I do that please
Thank youYour question makes no sense. The status code is a string sent in the headers of the response back to the client who made the request. Your code is generating the response. setStatus returns null. You cannot test the result of this because all you are doing is setting something.
If you want to send a 413 code and a response that contains a pretty error message along with it, then YOU have to decide when a 413 is appropriate. Once you have determined in the code that you want to do this, you can set the header to 413, generate that error message however you want (e.g. hard-coded html, calling a method that returns an appropriate html response, calling another servlet, forwarding the processing jsp:forward, etc.) and return the response as normal.
A better description of why you're sending a 413, when you would want to send it, and what you want to happen would elicit a better answer. -
How to change response header from bex application?
HI.
I'd like to change language coding 'charset=gb2312' to 'charset=big5' and don't need to add neither 'big5' language package or unicode in server
because the contents are input as 'big5' so I just need change charset incoding type.
and even if I insert html code
'<meta http-equiv="content-type" content="text/html; charset=big5">'
very top of template.
'big5' is not working because the response header is set as 'gb2312'.
and as I said before don't need to install lanaguage package to server.
just want to change response header
but don't know how to do that.
is there anyone who knows tip for this?
thank you.Just to close this topic.
I have reported a bug to Android project, because bottom-line they are responsible for the error - not SAP BEx.
Anyone interested can see the bug report here:
[http://code.google.com/p/android/issues/detail?id=24257]
If you decide to look at the bug report, please mark it with a Star to bring focus on this problem.
Best regards,
Jacob -
not able to set security group without mail enabled as site collection admin using powershell in sharepoint online site - office 365?
Any idea?after few days test in my lab, I can see that only email enabled group can be added as site collection admin using POWERSHELL.
hope this helps who stuck like me!! :-) -
Payables Open Interface Import pass distribution set for header?
Hi all,
i'm using OEBS 12.1.3. I want to insert data into payables interface tables to create invoice via back-end. Is it possible to pass data for the DISTRIBUTION SET on header level? I searched in the table AP_INVOICES_INTERFACE but no such column founded. I'm able to pass info for the distribution on the line level...
Any ideas?
Thanks in advance,
Bahchevanov.The before report trigger error does occur for n number of reasons...some of the solutions could be
1. Setting up the debug/summarized params to Y or
2. Two payables open interface import programs running at the same time and due to non-incompatibility setups, one of them is getting errored out. Try setting up incompatibility and this error will go away - the only problem with this approach is that if this program needs to run on frequent basis, then one will wait on other to complete and consume lot of time.
3. Try to increase threads of concurrent manager under which this program runs for better resouce management.
4. Check the normal AP side setups such as tax code definition, supplier site 'pay site flag' etc --Although before report error occurs at the place in rdf where these checks are yet not done but thought to share with you if it helps
Thanks
Girish -
Hi, I want to use my Capsule just as a back up via wireless. How do I set this up without connecting it with an ethernet cable to either a router or the iMac??
I misunderstood what Time Capsule is and had hoped for a wireless backup device that didn't have to be connected to the router.
The TC is a wireless backup device.. it does not need to be connected to the main router..
The problem is the computer.. not the TC.. the computer has only one wireless card.. if your current internet is by wireless.. then you must choose.. internet or backup.
But my other suggestion will work.. get a wireless USB stick compatible with Mac OS.. there are plenty and cheap.. since you are in the same room as the TC they will work fine.. plug it in and load the driver.. taint hard.
You should do the first backup by ethernet though.. wireless is too slow.. once you have that, you will do fine.
Search ebay for wireless n usb.. Mac compatible..
http://www.ebay.com/itm/New-EDUP-Mini-Wireless-11N-300M-USB-LAN-Card-WiFi-Adapte r-Nano-Card-Soft-AP-/150864362939?pt=US_USB_Wi_Fi_Adapters_Dongles&hash=item2320 377dbb#ht_3553wt_1165
As you can see.. they are getting smaller and neater.
I have no idea if it works .. haven't tried one.. but I have used USB wireless stick on the Mac to overcome this issue.
You will need to set static IP .. not hard but you need to set specifics if you do buy one post again for the setup. -
How to set the header variables in weblogic
Hi,
We have a following set up in our environment.
We have weblogic and on the top of it we have apex listener deployed which redirects Oracle Apex.
My Issue:
How can we set up the header variables in weblogic once the user is authenticated against weblogic server.
We are struck here, not knowing how to set the header variables in weblogic server. Its fairly straight forward for Oracle Access Manager or others..
Thanks
Ramesh P.maybe you are looking for the routing options
http://docs.oracle.com/cd/E13159_01/osb/docs10gr3/userguide/modelingmessageflow.html#wp1125348
Maybe you are looking for
-
How do I disable printing of my PDF if a text field isn't filled in?
Hello all I'm currently trying to find a way to make the print button of my pdf not work if say a necessary textfield wasn't filled in? I take it that the standard validation scripts won't work? The very helpful fellow from a thread seemed pretty sur
-
How to get notes from icloud to new iphone.
All my old iphone 4S 'notes' are stored in icloud. When I synced up my new iphone 5 it did not transfer the last ten months of notes onto the phone, just everything prior to that. So I'm nervous if I back up the notes I've made since, it may overwrit
-
Two iTunes accounts on one iPad?
Hi. My husband and I have itunes accounts on two separate laptops. However the laptops are now old and both don't work anymore. I can access my itunes from my ipad. Can we have both iTunes accounts on one iPad without merging the accounts? Thank you
-
How to add a new char in Update rule
Hi Gurus: I copied update rules from an old cube. This new cube is a copy of old cube - almost. One of the char is missing in the new cube when compared to old cube. There is a small update routine for that char which I need to introduce to new cube.
-
Transfer received calls by agents directly to another CSQ
Hi! I need advice. We have UCCX 7 Premium. I was asked to create a following script logic: After an IVR greeting a received call comes in the queue "CSQ_Operators". An operator answers and depending on callers needs transfers the call to another spec