How to remove request parameters in a filter

Hello,
I wanted to make a filter that removes all the GET parameters except for a few exceptions.
How do I remove parameters from a ServletRequest or HttpServletRequest? I am trying to make a webapp that only uses POST variables, and not GET (except a few exceptions).
Can someone point me in the right direction?
Thanks!

Arrowx7 wrote:
Hey, thanks for the replies.
Actually, I have a bunch of action forms in my webapp, which use request.getParameter(). This method doesn't distinguish between get and post. For security reasons, I don't want any of those parameters coming in with the URL as GET.
At first I wanted to have the filter take the request URL, parse the variables, loop through them, and remove ones that aren't on the EXEMPT list.
So a request like this:
http://myweb.com/messageAction.do?method=send&to=bahuser&subject=i+am+stupid&body=you+stink
would be turned into this:
http://myweb.com/messageAction.do?method=send
because the 'method' param is the only one that is on the EXEMPT list.
Perhaps there is a way I can get the request URL with the GET params, and then redirect to the safe URL after taking out parameters?If you actually mean take out those parameters (ie make them not attainable anymore) then yes, you can do
if ("get".equals(request.getMethod().toLowerCase()) {
  response.sendRedirect("http://myweb.com/messageAction.do?method="+request.getParameter("method"));
} else {
  filterChain.doFilter(request, response);
}>
Thanks!
Edited by: Arrowx7 on Jul 24, 2008 9:03 AM

Similar Messages

  • How to remove obsolete parameters in oracle

    hi,
    can anyone tell me how to delete a obsolete parameter in oracle,wat are the steps to follow or is there any command
    Thanks
    renjy

    how to remove obsolete parameters.

  • How to encode request parameters?

    Hi I'm running a small web application developed with JSP pages. But it turns out that it relies on cookies to maintain sessions, which is a limitation if the client's cookie setting disables cookies.
    I know that I could encode the request parameters and use GET method to communicate information between client and server, but have no idea how this is done.
    Can you give me some code, or recommend some tutorial to me? Thanks!

    1. If you don't want to use cookies, you could use URL rewriting to append the session ID. When you redirect to another page, do something like the following:
    a. first choose whether you want to forward or sendRedirect: (the following example is a redirect)
    //encode the parameter values to encode special characters, such as spaces
    String parameterOne = java.net.URLEncoder.encode("some value");
    String parameterTwo = java.net.URLEncoder.encode("some other value");
    //build the query string any way you want
    String queryString="?key1="+parameterOne+"&key2="+parameterTwo;
    /* Use response.encodeRedirectURL if running it through a sendRedirect.
       Doing so will rewrite the url with the session ID appended to the
       end. */
    response.sendRedirect(response.encodeRedirectURL("some.jsp"+queryString));This little code snippet demonstrates two things. It shows that URL rewriting can be used to append the session ID. It also shows you how to encode parameters (i.e. use URLEncoder.encode()).
    If you want to encode your string in the JSP, you could also do it using javascript:
    <script language="JavaScript">
    <!--
       //this is just an example javascript function
       function openPage() {
          var thisForm=document.formName;
          /* get your form element values (these are text boxes).
             Note: the javascript escape() function url encodes the values.
                   there are also other js functions to do this. */
          var paramOne=escape(thisForm.paramOne);
          var paramTwo=escape(thisForm.paramTwo);
          var queryString="?paramOne="+paramOne+"&paramTwo="+paramTwo;
          window.open("some.jsp"+queryString,"some_window_name");
       }//end openPage
    //-->
    </script>Or, you could build it using JSP expressions and scriptlets. Its really up to you. These are just rudimentary examples to help you get started.

  • How to pass request parameters using html:link in struts

    Hi All,
    I am trying to send parameters to action class using <html:link>.
    Can anybody give sample code how to do it?
    Thanks in advance.
    By
    K.Siva Prasad Reddy

    hi,
    you can pass the parameters in link like this
    http://www.xyz.com&username=someuserID&password=somePassword
    username and password are parameters which you want to pass as paramets to server..hope this will work for you...
    Thanks
    Surya

  • How To Remove Tone and Use As Filter

    My Canon HV20 HDV camcorder makes a high-pitched tone that apparently is right at the 8kHz mark throughout my videos when I record live directly into Premiere Pro CS6 through FireWire.
    Is there a way to use Audition CS6 or Premiere Pro CS6 to remove that tone and then somehow save that as a filter to use on all my videos?  It'd be great if I could do it without leaving Premiere Pro and having to open Audition.
    I already use the DeNoiser effect in Premiere Pro and it takes care of white noise, but not this tone.
    I tried the High Pass Filter (or the Low Pass Filter - I can't remember), but it just ruins the quality.
    I was able to use the Healing Brush Tool and the Lasso Tool in Audition to remove pieces of the tone, just to experiment.  I've include a screen shot of it below.  I can't tell any difference in quality in the cut out areas, but I can't see doing this to every clip.
    Do ya'll know of a better, easier way to do this and be able to use it as a filter for all my videos?
    Also, when I use the DeNoiser effect in Premiere Pro, it removes white noise beautifully, but when I export, the first 2 seconds of the exported video has the white noise on it, but after the first 2 seconds, the white noise disappears.  But in the sequence, the first 2 seconds as well as the rest of the clip, has had the white noise removed.
    Any idea as to why this happens?
    Thanks for any help ya'll might offer.

    If the tone really is a single (or at least narrow band) frequency like the picture shows, I'd try the Notch Filter on the Audition/Effects/Filter and EQ menu.  It might take some playing around to get the exact frequency and tweak the amount of cut you apply vs. the effect it will have on surrounding frequencies--but if you can get the right balance, you can then easily apply this to the whole of every file.
    Sorry, can't help on the Premiere Pro question since I only use Audition.

  • How to remove Dublicate values in Variable Filter screen?

    Hi All,
    I have Master data Object, ABC, XYZ and XYZ Description, and below i have given the data for the same
    Ex  ABC    XYZ      Description
           A        1           Abc
           A        2           Bbc
           A        3           Ccd
           B       1            Abc
           B       2            Bbc
           B       3            Ccd
           C       1            Abc
           C       2            Bbc
           C       3            Ccd
    While executing the Query, we want to do Drill Down on XYZ, In Variable Filter screen we are able to see the Dublicate values, which is making confusion to endusers as which is realed to ABC i.e A or B or C?
    Regards,
    Kiran

    Hi Surendra,
    Say we have executed query using WAD, in Query when we do drill down on B, we are getting all dulicate values like Abc, Abc.
    So client is not able to find which is what.?
    Regards,
    Kiran

  • How to hide request parameters from URL

    Hi ,
    I do not want to have userId of the logged on user in the URL as the request parameter.What options do i have ?

    Then, I do not need to build the URL as below
    http://localhost:80/app/something?userId=123
    and the URL would like:
    http://localhost:80/app/something

  • How to remove tag using filter

    I want to use a filter to remove tags already on emails. I can add tags using a filter but cannot see how to remove tag using filter.

    The FiltaQuilla add-on provides a "remove tag" option.
    https://addons.mozilla.org/en-US/thunderbird/addon/filtaquilla/
    http://www.ramsden.org.uk/3_How_to_install_Add-ons_in_Thunderbird.html
    But, out of interest, what's the use case for removing tags by filter? Tags are normally used to facilitate or prompt human intervention and I don't immediately see the value of clearing a tag in a filter. Why tag if a filter will be dealing with it anyway?

  • How to get the page request parameters in Command Button code

    Hi everyone,
    I am new to JSF and working on some Command Buttons. I put my java code via Edit Event, it works fine. But I don't know how to get some parameters from HttpServletRequest.
    Can anyone give some guidance? It would be much appreciated.
    Mike

    Thanks a lot for your tip. Unfortunately I could not open the link you provided due to some network issue.
    Yes, I intend to get some parameters from URL. I did try to put your code and get the parameters predefined in the URL, however I got the null returned. By the way, I put the following code in the page source part and it works. Just don't know how to get the value being passed to the command button event code.
    <%
    String userID = request.getParameter("u");
    System.out.println("this is from head - the userID is :: " + userID);
    %>
    Thanks again and hope you could give me further advice.

  • How to remove the underline in the parameters in the selection screen?

    how to remove the underline from the parameters in the selection screen?
    i came through the comment statements in the forum is there any other ways like setting some fields in the declarattion of the parameter itself?
    like
    parameter:p1 type string .......?

    I dont think there is an alternative to removing the underlines other than to go for COMMENT. In the selection texts (of text elements) we can just give the parameter name or take the standard text from dictionary, but theres no option to remove the underlines.
    SELECTION-SCREEN BEGIN OF BLOCK rbg WITH FRAME TITLE tit.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) text-001 MODIF ID sc1.
    PARAMETERS:
      p_param TYPE vbak-vbeln.
    SELECTION-SCREEN END OF LINE.
    PARAMETERS:
      p_posnr TYPE vbap-posnr.
    SELECTION-SCREEN END OF BLOCK rbg.

  • How to remove filter or effect  ?

    I cannot remove effect .

    I cannot use undo after save project. 
    I need to remove effect but I don't need remove any task after effect added.
    Example
    Task 1 crop photo
    Task 2 apply effect
    Task 3 add layer
    I need to remove task 2 but I don't need remove task 3.
    If I use undo function . I will lost task 3.
    ส่งจาก iPad ของฉัน
    ณ 13 มี.ค. 2555 เวลา 3:10 Luanne Seymour <[email protected]> เขียน:
    Re: How to remove filter or effect ?
    created by Luanne Seymour in Adobe Photoshop Touch - View the full discussion
    Hi hugo2002,
    You can remove an effect by using the Undo button. Here is a picture of where you will find it:
    http://forums.adobe.com/servlet/JiveServlet/downloadImage/2-4262185-174700/450-337/Undo.pn g
    I like to make a copy of my original before I start using effects. I do this by choosing Duplicate Layer from the Add Layers menu. That way I always have the original image to go back to in case I don't like some of my image experiments.
    I hope this helps,
    Luanne
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4262185#4262185
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4262185#4262185. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Adobe Photoshop Touch by email or at Adobe Forums
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • How can I request to remove the sign "explicit"

    Dear all,
    I've uploaded a Song in iTunes Store. Apple has marked my song with the "signature" EXPLICIT. How can I request to remove this Explicit? My Song is not aggressive, nothing with sex & drugs, but it's a language they don't know. It's a very old language: Aramaic (Wiki: http://en.wikipedia.org/wiki/Aramaic_language). The song is about the love and about joy and something like this, but with the signature EXPLICIT it shows like a killer-song hehe
    It will be great if someone can help me or give me a contact to write them an email.
    Many thanks and kind regards.

    Once you login to Course Manager, a link to the Content / Services Agreement is provided on the bottom-right of the page.

  • How to obtain POST request parameters

    Does anyone know how to obtain POST request parameters after form submit like we can get GET parameters after form submission via {module_url, parameterName}?

    "garry.b" <[email protected]> wrote in
    message
    news:gnndbf$i2q$[email protected]..
    > Hi,
    >
    > When using AS3 to generate an HTTP POST request:
    >
    > var service:HTTPService = new HTTPService ();
    > service.url = "
    http://localhost:9090/service";
    > service.method = "post";
    > // service.request = {itemId: "12345"};
    > service.send ({itemId: "12345"});
    >
    > my CherryPy web server complains about unexpected body
    parameters:
    >
    > HTTPError: (400, 'Unexpected body parameters: itemId')
    >
    > Using Firebug's Network display, its Post tab shows the
    following content:
    >
    > Referer:
    http://localhost:8080/log/log-1.0-SNAPSHOT.swf
    > Content-type: application/x-www-form-urlencoded
    > Content-length: 12
    >
    > itemId=12345
    >
    > which looks very strange to me as I would expect the
    Referer, etc.,
    > request
    > headers to show up in the Request Headers section and
    not as POST body
    > content.
    > While this could be some Firebug issue, I think the
    request message is
    > really
    > formatted incorrectly. When the web server gets the
    request, it does
    > recognize
    > 'itemId' as a body parameter but then complains that
    it's unexpected.
    >
    > I've googled the error message, studied HTTPService
    examples, spent
    > several
    > hours playing with it and am stumped. Tracy Spratt
    suggested setting the
    > service 'request' to force a POST and I tried it but am
    getting the same
    > error.
    > How do I make a POST request? Can I get POST data into
    the message body?
    > Stick with URL parameters only?
    What happens if you post to the same service using an html
    form?

  • How to remove '#' field in Filter

    Hi gurus,
        I am working in BEx-Analyzer. I have created a workbook with some filters such as dropdown, check box etc..
        While using check box, there is an additional option named as '#' is displayed in the check box...
         Can anyone pls guide me to remove the '#' symbol from the filter criteria...
    With Thanks & Regards,
       Yokesh.

    Hi Sundar,
          I had done it already. But the thing is while opening the workbook for the next time, it again shows the ' # ' value again by default.
         This value is displayed only upto the refreshing of workbook. After refreshing, it is automatically excluded from the filter.
          So I need a solution so that it won't appear while opening the workbook for the first time itself.
           Pls help me in this problem...
    With regards,
    Yokesh.

  • Excel Filter Shows Non Existent Missing Members How to Remove them?

    I have a tabular model cube in SSAS 2012 I am adding a filter to my excel pivot table and it shows a blank member that does not exist.  If I use a slicer I can "hide empty members" but when I use a filter there is no such option.  Is
    there a way to remove this selection for an empty member?

    Hi Jimlaf,
    In your scenario, you connect to a SQL Server Analysis Server Tabular model cube in Excel. It shows a blank member that does not exist in the filter, however the empty member were hidden automatically in the slicer. Now what you want is removing the empty
    members in filter, right?
    I have tested it on my local environment, I got the same results with yours. And based on my research, it seems that this is the default setting, there is no such an option to remove the empty members in filter.
    If I have anything misunderstood, please point it out. Thank you for your understanding.
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here.
    Charlie Liao
    TechNet Community Support

Maybe you are looking for

  • My video clips go red in iMovie

    Whenever I open a file in iMovie it goes red even after I've rendered it my clip is coming from Quick Time Player does anyone know how to stop this?

  • Up/download html-page including all images

    Hi y'all, I'm developing a quite normal Webbrowser-Webserver-DatabaseServer application with Web-Frontend, Servlets, Jsp, Beans and good old JDBC-Technique. It's kind of a small dictionary. What I need is a solution for the following problem: Every i

  • Problen when using log4j.jar in my web service application

    Hi, i have a little problem. I have to migrate an existing java application to web services, and this application uses log4j.jar. So i put that jar file in the lib dir in WEB-INF. However, when i try to deploy the application, i get an error saying o

  • Can't Export to EPS

    I am working on a MacBook Pro. I have created a logo in Freehand . It consists simply of type over a black box with a silver no-fill rectangle as a border. I converted my fonts to paths, grouped all of the pieces, and I tried to export the logo (sele

  • Report: Material, customer order, internal order,... without Profit Center

    Hello dear colleagues, I can remember there is following report available: Report where you can find out material, internal order... without Profit Center. Can someone tell me fuction or program please. Many thanks for your help. I am lookinf forward