Set pageContext attribute in Filter

I'm writing my own filter by implementing javax.servlet.Filter. I want my filter to set an attribute of pageContext something like pageContext.setAttribute("myAttribute", myAttribute). Unlike servlets, I don't have a reference to pageContext object. Anyone knows how to get the pageContext object in a Filter?

Sure, that's possible. You don't use the pageContext for that, you use the HttpSession. You can obtain it from the ServletRequest received in the doFilter method of your Filter by casting it to an HttpServletRequest (of course this would only work if it was indeed an HttpServletRequest. Remember that J2EE does not have to work over Http...) then calling the getSession() method to obtain the HttpSession reference. Once you've done that, set the attribute using the setAttribute() method to set your attribute.

Similar Messages

  • Checking for existing pageContext attributes

    I have several tags that need to use the same attribute. I create it for the session using pageContext.setAttribute. The problem is that I won't always know which tag gets used first. What I want to do is check to see if I need to set the attribute or get the attribute. How do I do that? Do I need to do that?
    For example
    if (insertMagicCodeHereToFigureOutIfTheAttributeExists)
    whatEver=generateStuff();
    pageContext.setAttribute("stuff",whatEver,SESSION_SCOPE);
    else
    pageContext.getAttribute("stuff",whatEver);
    }

    Object myStuff = pageContext.getAttribute("stuff", PageContext.SESSION_SCOPE);
    if (myStuff == null)
      myStuff = generateStuff();
      pageContext.setAttribute("stuff", myStuff, PageContext.SESSION_SCOPE);
    }

  • Time machine Bulk setting Spotlight attributes failed

    Hi,
    I'm having big, ongoing problems with a customers iMac, 10.6.7, when trying to use Time Machine.
    All i want to do now is start afresh.  And want to make sure i clear out everything.  It's no longer the priority to find out what is the cause.
    Here's the setup, and what i plan to do.  If i miss anything, please point out.
    the setup:
    iMac, connected via ethernet, to a Ethernet over Power plug (Airport switched off on iMac)
    EoP plug then connected to Time Capsule, which is in turn connected to the modem
    Internet connection is fine / other mac connected direct to TC backs up fine.
    Mac with the problem (unfortunately i only get the info second hand, after i've visited):
    TM Sys Pref Pane reports No errors, just that the last completed back up was 7th June
    When TM goes through process, it reports 'Preparing xxxxxxxxx items'
    Then takes forever to back up a reported 40GBs, reports something like '4KB completed', then '225MB completed, then back to 10KB completed...', then 'Calculating Changes...'
    There's never any error message, still reports last back up to be 7th of June.  Finally installed backup buddy widget and got the 'bulk setting Spotlight attributes failed' and "Stopping back up to allow ejection of back up destination disk".
    Things tried:
    repairing sparceimage of back in disk utility
    deleting prefs for TM in /Library/prefs
    Tried forcing new back up (without deleting the old one) by renaming the sparcebundle to '...old.sparcebundle' - it carried on trying to back up to the old one, as indicated by the Date Modified in the Get Info window, and lack of new .sparcebundle on TC.
    What i plan to do, to thoroughly reset Time Machine, when i visit (I won't have time /opportunity to hang around, wait for anything.  I just do this sequence of events, then i have to leave, not by choice.  So it's important i get it right, do a thorough reset.):
    Switch off TM on problematic iMac
    Delete the .sparcebundle for the problematic iMac from the TC
    Delete /Library/Prefs/com.apple.TimeMachine.plist on problematic iMac
    Rebuild spotlight index cache: sudo mdutil -E
    Shutdown
    Unplug EoP plugs for 30 seconds / replace ethernet cables
    Restart iMac
    Turn on TM, set up to backup to TC
    Now, surely, this is starting totally afresh.  It is assumed the TC is ok, because another iMac directly connected backs up, no problem, and the SMART status of the TC drive is not reporting problems.
    If i'm missing anything, any comments, or just reassurance, would love to hear comments.  This has been quite traumatic!  And is dragging on way too long, and made more difficult by the fact i can only visit in short time frames, and the results take so long to come through.
    Many thanks,
    C

    Col Kav wrote:
    Ah, ok,  this would be system.log, and then filter 'backupd' ?
    Yup.  And when you find a problem, it might be worth noting the time, removing the filter, and see if there are other messages at about the same time that might be contributing to the problem.
    But as it's going via Ethernet-over-Power plugs, which are 200mbps, excuse my patchy knowledge, but would this account for slowness?  Speed isn't a priority, i mean, just as long as everything got backed up.
    Of course -- they're getting 10% of the speed.  Earlier you posted "I know Time Machine generally takes ages to do the first backup, but is there any reason why it should take 20 minuites+ to make the backup disk available?"  20 minutes is certainly a long time, but if they're only getting 10% of the speed they should, that's gotta be a big part of it.
    The thing is, the internet access is fine, and this customer has offline backups with carbonite.
    If they're trying to do backups and any serious internet access over the same "pipe," it's gonna be very slow. Depending on what they're doing, they may not notice how slow response time is.
    The external disk isn't an option.  i mean, he has the TC, he wants that to work.  Which is fair enough.
    Even if it's like molasses? 
    Can you even temporarily connect the iMac directly to the TC via Ethernet?  If so, see how much faster it is.
    I don't see the point of the TC.  Is it being used wirelessly for anything at all? 
    Since everything's connected by cable anyway, why not plug an external HD into the iMac? 
    From your first post:
    When TM goes through process, it reports 'Preparing xxxxxxxxx items'
    Then takes forever to back up a reported 40GBs, reports something like '4KB completed', then '225MB completed, then back to 10KB completed...', then 'Calculating Changes...'
    That sounds like TM is simply making two "passes," which is common.  If additional changes are made while it's doing the first one, it will make a second pass to catch up what's ordinarily small and quickly backed-up.  You'll see that in the logs.
    But the network or whatever problem is preventing a completed backup; so on each backup, TM isn't sure it got everything the last time (you'll see a UUID message).  Because of that, it will do a "deep traversal," with a message, comparing everything on the Mac to the most recent completed backup, to figure out what's changed and needs to be backed-up.  With an excruciatingly slow connection, that's going to take forever.  And that will be repeated on each backup attempt until one completes normally.

  • Setting an attribute back to null

    Hi All.
    During provisioning to certain resource, I set an attribute to some value (It gets set properly), Now I want to set it back to null(empty string). It is not setting back to null and still displays the old value
    <set name='user.global.attr1'>
    <null/> or <s></s>
    </set>
    Is there any way to set the attribute value back to null or clear that particular attribute
    Thanks,

    Any update on this, Please reply

  • Problem with setting custom attribute and it being searchable

    I'm having an issue with setting a custom attribute and having it be searchable using Portal 10.1.4. The situation that we have is that we initially added a bunch of files to Oracle Portal using webdrive. Later on, we decided that we needed another custom attribute called "Pinned Item" that will be used for searching (boolean value) and gave it a default value of false. The attribute was then added to the "File" item type in the "Shared Objects" group.
    It appears that since this attribute wasn't initially available on the file object, we couldn't search on it so we decided to set it programatically. First, I tried using wwsbr.set_attribute but it errored out seemingly because the value wasn't set in the first place. If I set a value first by using the web front end, I could then use the set_attribute procedure.
    So, I moved on to using wwsbr_api.modify_item and it appears to set it (although everything is being set to false until I changed it to "text" instead of "boolean" which is OK because that's what I wanted anyway... see metalink bug 390618.1). I'm using the method outlined in metalink doc 413079.1. When I do set it to a "1", and edit the item the check box is checked indicating that it is set correctly. And if I just click "OK" to save the attributes after I open it everything works like it should.
    However, the advanced search (and custom search portlet) and the search APIs are not picking it up. I'm not sure if I'm hitting Metalink bug ID 5592472 or not as that's using the "set_attribute" procedure instead of the modify_item procedure. And their "workaround" of setting the attribute in the UI isn't really feasible for a couple thousand files.
    So far I've tried the following things to get it working:
    1. I am calling wwpro_api_invalidation.execute_cache_invalidation
    2. I have executed wwv_context.sync
    3. I cleared the page group cache
    4. I invalidated all of the web cache
    Does anyone else have any other suggestions?

    I'm having an issue with setting a custom attribute and having it be searchable using Portal 10.1.4. The situation that we have is that we initially added a bunch of files to Oracle Portal using webdrive. Later on, we decided that we needed another custom attribute called "Pinned Item" that will be used for searching (boolean value) and gave it a default value of false. The attribute was then added to the "File" item type in the "Shared Objects" group.
    It appears that since this attribute wasn't initially available on the file object, we couldn't search on it so we decided to set it programatically. First, I tried using wwsbr.set_attribute but it errored out seemingly because the value wasn't set in the first place. If I set a value first by using the web front end, I could then use the set_attribute procedure.
    So, I moved on to using wwsbr_api.modify_item and it appears to set it (although everything is being set to false until I changed it to "text" instead of "boolean" which is OK because that's what I wanted anyway... see metalink bug 390618.1). I'm using the method outlined in metalink doc 413079.1. When I do set it to a "1", and edit the item the check box is checked indicating that it is set correctly. And if I just click "OK" to save the attributes after I open it everything works like it should.
    However, the advanced search (and custom search portlet) and the search APIs are not picking it up. I'm not sure if I'm hitting Metalink bug ID 5592472 or not as that's using the "set_attribute" procedure instead of the modify_item procedure. And their "workaround" of setting the attribute in the UI isn't really feasible for a couple thousand files.
    So far I've tried the following things to get it working:
    1. I am calling wwpro_api_invalidation.execute_cache_invalidation
    2. I have executed wwv_context.sync
    3. I cleared the page group cache
    4. I invalidated all of the web cache
    Does anyone else have any other suggestions?

  • How to set session attributes in a bean?

    How do I set a session attribute in a server-side bean?
    I'm not sure if I asked the question the right way. What I meant is, while it's easy to set session attributes in a JSP page (session.setAttribute("sessionname", "sessionvalue")), I'd want to set such an attribute within a server-side bean defined in this web application. But what is the syntax for doing it?

    Here a simple bean that stores something in the session and retrieves something from it.
    import javax.servlet.http.HttpSession;
    public class TestBean {
      private String value;
      public void doSomething(HttpSession session, int a, int b) {
        if (a+b > 0) {
          session.setAttribute("ab",Boolean.TRUE);
        } else {
          session.setAttribute("ab",Boolean.FALSE);
      public void init(HttpSession session) {
        if (session != null) {
          Boolean b = (Boolean)session.getAttribute("ab");
          if (b == Boolean.TRUE) {
            value = "a + b is greater than zero";
          } else {
            value = "a + b is not greater than zero";
        } else {
          value = "no session";
      public String getValue() {
        return value;
    }In your JSP, use something along the lines of :
    <%
      TestBean bean = new TestBean();
      bean.init(session);
      bean.doSomething(session,1,2);
    %>If your bean only lives during one request, you can pass the session to the constructor, which stores it in a private variable. This saves passing the session each time.
    Hope this helps,
    --Arnout                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Setting an attribute value of a tag equal to a String variable in scope

    Hi,
    I don't think this is possible because I get an "expression not allowed" error when trying it. But long story short I'm trying dynamically set attribute values on a taglib. For example:
    <%
    String value="attributevalue";
    // set the attribute of the tag below equal to this variable value
    %>
    <tag:mytaglib name="<%=value%>"/>
    I looked at the generated jsp page and seems like the variable "value" is not in scope of the method that processes the tag. Does anyone have any ideas or can confirm that there is no way to do this. Thanks!

    You can do it.
    In your tag library (*.tld) file, have an entry as:
        <attribute>
            <name>name</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>This should do the trick.
    Let us know if it worked for you.
    Thanks and regards,
    Pazhanikanthan. P

  • Set type attribute search help in Web UI

    Hello,
    I've created a set type attribute in the SAP GUI in CRM 2007 which links to value table BUT000. On the product in the SAP GUI, the F4 search help brings up the standard BP search help (COM_PARTNER).
    I've assigned the attribute to the web UI, and the field displays correctly, however when I click on the F4 help, the system only shows me a list of BP numbers without even a description description, and not the standard search help. The response to my OSS message is that this is "standard".
    Any suggestions as to how to enable the correct search help for this?
    Thanks,
    Alison

    Hello,
    This is an example :
      READ TABLE lt_multivalues WITH KEY fieldname = 'ZOPERATION_ID'
      INTO ls_multivalues.
      IF sy-subrc NE 0.
        READ TABLE lt_multivalues WITH KEY fieldname = 'ZKIT_ID'
        INTO ls_multivalues.
      ENDIF.
      IF sy-subrc EQ 0.
    Z search
        CALL METHOD me->search_by_kit
          EXPORTING
            it_search_tab          = it_search_tab
            it_multivalues         = lt_multivalues
            iv_number              = iv_number
            iv_item                = iv_item
            iv_archive             = iv_archive
            iv_call_authority_badi = iv_call_authority_badi
          IMPORTING
            et_guidlist            = et_guidlist
            et_return              = et_return.
      ELSE.
    Standard search
        CALL METHOD me->search_standard
          EXPORTING
            it_search_tab          = it_search_tab
            it_multivalues         = lt_multivalues
            iv_number              = iv_number
            iv_item                = iv_item
            iv_archive             = iv_archive
            iv_call_authority_badi = iv_call_authority_badi
          IMPORTING
            et_guidlist            = et_guidlist
            et_return              = et_return.
      ENDIF.
    You have to fill et_guidlist with the results.
    Benoî

  • How to change set type attribute of a product

    Hi ;
    I created additional fields for products by using "COMM_ATTRSET". It created a table and functions but I dont know how to change this additional attributes.I cant use these attribute set functions because i dont know fragment_id yet. I think there must be a function encapsulates them.
    Is there any BAPI to change set type attributes?
    PS: In forums , I found an FM "COM_PRODUCT_MAINTAIN_MULT_API" but I think it hasnt been used anymore in CRM7.0
    Thanks

    Thanks for your reply ;
    but FM 'COM_PRODUCT_UI_MAINTAIN' doesnt have any generic import parameters to send my data to it in form of  newly created attribute set type table "ZPRODUCT".
    I want to set some fields of ZPRODUCT and i need to send them in this structure,  this table has column FRG_ID , if you set an additional  parameter for the first time , it generates new GUID..I think  'COM_PRODUCT_UI_MAINTAIN'  generates this GUID but i dont know how to use it.
    Can you give an example about using this FM?

  • Unable to set volume attribute "min-autosize" for volume

    We have a TDP volume(destination), that is in snapmirrored state from 7Mode to cDOT.While trying to resize/increment the volume size by say 100g we get the following error. clusterName> volume size volumneName -vserver vserverName +100gWarning: Volume "vserver:volumeName" is a SnapMirror destination volume. The Filesystem Size for this volume is derived from its source and cannot be changed. The specified size will be used as the Volume Size.
    Do you want to continue? {y|n}: y Error setting size of volume "vserver:volumeName". Unable to set volume attribute "min-autosize" for volume
    "volumeName" on Vserver "vserverName". Reason: Volume 'volumenName' is a snapmirrored volume.
    vol size: Flexible volume 'volumeName' size limit set to 8022664413184.  Any idea ?  Volumes autosize mode is false.

    Hi    I am not trying to change any setting. I am trying to increase the size of the volume. I understand in case of a Snapmirrored volume the fs_fixed options is ON.But one can always increase the actual volume size using vol size command. Even if I increase the size on ONTAP on the file system side it will show as the size same as source. I understand that. So my question is why is it prevenitng me from increasing the size. RegardsAdai

  • Javascript to JSP question...Can javascript function set session attributes

    hello,
    i have a web app that, on one of its pages, displays "tabbed pane" as an image map at the top (a la amazon.com). my problem is this: each "logical" page contains separate forms that all use the same javabean. in other words, imagine that the tabs represent an account maintenance web ui for an on-line record store. the first tab might be labeled "General," the second "Contact info," the third "Shipping Info." Each uses the same account bean and displays portions of its properties relevant to the tab at hand. what i want to do is allow a user to enter the account maintenance ui, update info on the first tab, click on tab two and have the request with the changes sent to a processing jsp. yet, since each "tab" is actually a separate URL to another page, how do i get the updated info on the first tabe without adding some sort of "SAVE" button on each tab. ive considered using javascript, but dont know how to get the request params out of the first tab whn i click on another tab. is it possible to include an "onClick" function in each URL that "grabs" the updated form fields off the preceeding tab? can a javacript function set session attributes in jsp?

    hello there,
    wow, you've created one big mammy-jammy tool.
    first, javascript cannot access, set values to the session, without having to post to another JSP. javascript is great for manipulating objects, layers, form values, etc.
    you have 2 issues [if i understand correctly]:
    1) you need to able to save user info for a specific tab without having to reloading the page.
    ---you can create a form for EACH of your tabs and POST all the information to a hidden IFRAME or LAYER for NN4. that hidden IFRAME / LAYER will load a JSP page which with all the parameters you posted to it. or you can build a FRAMESET and target that document["frame-name"].src with that same JSP.
    2) handling when the SAVE INFO action should happen: hence some javascript event handler: onMouseOver, onClick, etc
    ---i don't know the dynamics of your tabs, but if store which tab was clicked on last, then if the user clicks on some other tab, javascript can submit that FORM to a JSP [see condition above]
    you have an interesting tool. can i see?
    i hope i wasn't too confusing, but your problem is sooo interesting. =)
    -WJP

  • Setting property attribute values for multiple selected objects.

    Hello,
    Is there an easy way to set the attribute property values for more that one selected Table Operator Attribute (column) at a time. For example the target table has over 100 columns but I only want to INSERT/UPDATE 10 of those columns. The generated MERGE, INSERT and UPDATE statements will perform DML on all of the columns in the target table, setting the 90 columns with no mapping set to NULL. This is due to the Loading Properties 'Load Column when Updating Row' and 'Load Column when Inserting Row' both default to Yes. I would like to select multiple Attributes in the Table Operator and change the 'Load Column when Updating Row' and 'Load Column when Inserting Row' to No. This is similar to what you were able to do in Oracle Forms 9.0 Designer select multiple Items in a Block and change the properties en-masse.
    Thanks

    Hi,
    Using OMB scripting to set attribute properties in a data mapping sort of defeats the purpose of utilizing a graphical user interface to define and set properties for a data mapping? Surely the GUI data mapping tool was created to get away from writing scripts and scripting would also require that you know the name of the data mapping, table operator and the set of attribute names for which you have to write one line of script to set each property value, i.e. 90 lines to set 90 attribute values.
    Cheers,
    Phil

  • How do I get and set column attributes in a table or a treetable with Java?

    Using 11.1.1.4.0
    Hi,
    How do I get and set column attributes in a table or a treetable with Java? For a simple example, say I have a table and want certain roles to see all columns (including address), and other roles can see only certain columns (no address). In a Java method, I want to test if a table's column visible attribute is true and if so, set it to false before rendering it.
    Thanks in advance,
    Troy

    Hi,
    this use case would be a perfect example for using seeded MDS customization. Instead of checking what users are allowed to see or not upon rendering time, you have a customization class and thus the framework doing this for you.
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/31-mds-sample-169173.pdf
    In this paper and sample, specific users see different layouts. It also contains a customization class that shows how this can leverage ADF Security
    Frank

  • Easy and efficient way to set dynamic attributes

    My integration scenario is quite complex involving many different receivers and an integration process. For some receivers I have to set dynamic attributes.
    I know that I can set them by using a UDF, however in my case I mostly use XSLT so this is not applicable.
    Is there any other way to do this relatively easy so that I can avoid Java Mappings? Problem ist that I would need to use several Java Mappings to set the attributes where no transformation to the payload itself is taking place which seems to be too much for me. Especially when I consider that these Java Mappings are hard to maintain as they have to be imported again and again if any changes occur.
    So my question is:
    1. Do I really have to go for several Java Mappings just to set some dynamic attributes ?
    2. If so, should I use different Java Packages or is it advisable to leave all Java Mappings in one package?

    Hi Florian,
    yes, you can!
    set dyn atts in XSLT:
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:map="java:java.util.Map" xmlns:dyn="java:com.sap.aii.mapping.api.DynamicConfiguration" xmlns:key="java:com.sap.aii.mapping.api.DynamicConfigurationKey">
    <xsl:if test="REFERENCEQUALIFIER='MSU'">
         <xsl:variable name="dynamic-conf" select="map:get($inputparam, 'DynamicConfiguration')"></xsl:variable>
         <!--  mit dem folgenden Key-Key-Paar muss dann via UDF die Adresse aus den dyn. Attr. gelesen werden -->
              <xsl:variable name="dynamic-key" select="key:create('http://sap.com/xi/XI/System/Mail', 'MAILADRESS_SU')"></xsl:variable>
              <xsl:variable name="dummy" select="dyn:put($dynamic-conf, $dynamic-key, $MAILADRESS)"></xsl:variable>
              <xsl:comment>Mailadresse SU ermittelt: <xsl:value-of select="$MAILADRESS"></xsl:value-of>
              </xsl:comment>
    Hoffe es hilft.
    Grüße
    Mario
    Edited by: Mario Müller on Oct 15, 2009 1:47 PM

  • How to set a attribute value of a sub node binded to a table.. pls respond.

    Hi friends,
    I have context defined like this.
         Head_node ( table 1)
              Item_node ( table 2, sub node ).  ( now this im saving in global internal table).
    so now when i hit save button, im passing my internal table (it has col1- sales order no, col2 item details(table type, which can have more than one record) to a FM, to create sales order.
    My sales order is getting saved.
    But the function module will return some new values (like sales order number, item number etc).
    Now i want these values to be updated in my context.
    Meaning whenever after that i do get_attribute, i should get these new (sales order no, item no ) also.
    I dont know how to set the context values of sub nodes , so im missing these values.
    kindly respond back to me..
    thanks in advance,
    Niraja

    Its very simple.
    Follow these steps. e.g you want to get the new sales order number. Define a attribute in ur node (or set of attributes in ur case as per reqruirement) say new_so_number.
    Check your FM, if its returning new_so_number then it's fine, otherwise you have to change the FM to return the new_so_number or you have to get from db table somehow, which best suites your req.
    So once you have new_so_number after calling the FM, say in lv_new_so_number field. Then write this code to set the attribute (change the variables as per your context attributes)
    DATA lo_nd_head TYPE REF TO if_wd_context_node.
      DATA lo_el_head TYPE REF TO if_wd_context_element.
      DATA ls_head TYPE wd_this->element_head.
      DATA lv_new_so_number LIKE ls_head-new_so_number.
    * navigate from <CONTEXT> to <HEAD> via lead selection
      lo_nd_head = wd_context->get_child_node( name = wd_this->wdctx_head ).
    * get element via lead selection
      lo_el_head = lo_nd_head->get_element(  ).
    lv_new_so_number = new_so_number. " (You got this as a exporting parameter of FM etc..)
    * get single attribute
      lo_el_head->set_attribute(
        EXPORTING
          name =  `NEW_SO_NUMBER`
          value = lv_new_so_number ).
    Hope it works.

Maybe you are looking for

  • How do I duplicate BOM's as I add inventory items

    My company has hundreds of items, but most are just images transfered onto a substrate.  The BOMs for items are complex, but similar.  If I could create 20 standard BOM's and use them as a starting point as I created new items, we would save time and

  • Why doesn't mail capitalize the first letter of a sentence?

    How do I make "mail" capitalize the first letter of a sentence? If not WHY not? If not WHY hasn't anyone from Apple addressed this annoying problem?

  • Charging iPad using USB port

    I will be traveling to Italy.  Does anyone know if you can charge the iPad using the USB port in a power surge protector, without harming the iPad?

  • Banding issues

    I bought a MacBook Pro 17" a week ago. I thought this computer was aimed at professionals who require CPU power and precision in what is displaied. On my MacBook Pro display I have terrible banding issues. I bought this computer to do my work on, but

  • Cut is disabled in lion ???

    I recently noticed in lion (possibly also in previous versions) that the cut feature (cut and paste file from pictures to desktop for example)  does not work. When i select a file and go to edit, the cut feature is disabled, and command-x beeps back