How to get "/r/n" in servlet after decoding a escaped URL

I am creating a servlet request in Javascript and need to send "/r/n" as value for one request parameter.
So I am doing escape(myURL) in Javascript and sending it to servlet.
escape converts "/r/n" to "%0D%0A".
Now in servlet I am using URLDecoder.decode() with UTF-8 but this translates these chars to "ctrl M".
I am not sure which char encoding type I should use to get "/r/n" chars back in servlets or any other way to do this job.
Any pointers highly appericated.
TIA,Sachin

I'm also having a servlet with some funky UTF-8 characters being passed encoded, but this takes care of it in doGet/Post:
request.setCharacterEncoding("UTF-8");
then,
String param = request.getParameter("PARAM");
puts everything encoded into string as strings are all Unicode as well...
hope this helps

Similar Messages

  • How to get javabean data in Servlets.( JavaBean -- Servlet(Controller)

    how to get javabean data in Servlets.
    1) I am using name ,password in Jsp(View )
    2) when I submit this Bean will be called and Setter methods will be called .
    3) In ServletController (controller) I want to get data of javabean.
    In this I have to do validation of user.
    I want to pass the javabean obj as like -->
    request.getAttribute("beanObj");
    My intention is to get all the poperties in javabean by passing bean id
    or beanobj ,
    Is there any way to get all the data using bean id or beanObj.
    Plz Reply,

    Now in the Servlet we can get the same bean by this code:
    PageContext pageContext = JspFactoryImpl.getDefaultFactory().getPageContext(this, request, response, null, true, 8192, true);
    UserBean userbean = (UserBean)pageContext.getAttribute("userbean", PageContext.SESSION_SCOPE);
    String userid = userbean.getUsername();
    For this code to work it is needed to import 2 files:
    import org.apache.jasper.runtime.JspFactoryImpl;
    import javax.servlet.jsp.PageContext;
    The JspFactoryImpl is in jasper-runtime.jar file provided in tomcat dir.It seems to me that you are exactly knowing what you are doing :-(
    You can get a Bean stored in a Session by
    request.getSession().getAttribute("userbean");
    In the login.jsp page for example we have the code
    <jsp:useBean id="userbean" scope="session"class="com.newproj.UserBean" />
    <jsp:setProperty name="userbean" property="*" />the jsp:setProperty is not called when you click on the submit button
    if fills the bean with the request values from the previous request.
    andi

  • Submit a PDF as a PDF to a servlet, and how to get my PDF from servlet

    Hi all as the title above,
    i have a button typeformat as PDF and sent to a URL( which is my servlet )
    after this step how to get the PDF from my servlet.
    the PDF has sent to my servlet and stop, so is there any way to get the PDF i sent ?
    can someone help me?
    thanks

    You can use the following code:
    byte[] content = getRequestBufferAsBytes(request);
    ...then do whatever you want
    public static byte[] getRequestBufferAsBytes(HttpServletRequest request) throws IOException, ServletException
    // get the RequestBuffer
    ServletInputStream oInput = request.getInputStream();
    long nContentLength = request.getContentLength();
    String contentType = request.getContentType();
    if (nContentLength <= 0)
    return null;
    byte[] cContent = new byte[(int)nContentLength];
    // read the content in 512 bytes chunks
    // a single read does not get all the characters
    int nRead = 0;
    int nToRead = (int)nContentLength;
    int nBlkSize = 512;
    byte[] cTemp = new byte[512];
    do {
    int n = 0;
    int i = 0;
    if (nToRead - nRead < 512)
    nBlkSize = nToRead - nRead;
    n = oInput.read( cTemp,0,nBlkSize);
    for (i = 0; i < n; i++)
    cContent[i+nRead] = cTemp[i];
    nRead += i;
    } while (nRead < nToRead);
    //cContent[nRead] = (byte)'\0';
    Long nBytesRead = new Long( nRead );
    return cContent;
    Jasmin

  • How to get XML file using servlets that XI sent to my J2EE appl?

    Hi All!
    I have a scenario like XI sends xml file to j2ee application. In my J2EE application my servlet receives this xml. Will the xml file be in my HTTPServletRequest object? if so how to get that file from Request object.
    Please help me its urgent, Any code help is highly appreciated.
    My xml file will be like this:
    <ns0:Http_Message_Type_Demo
    xmlns:ns0="http://abcdemo.com">
    <Name>ABC</Name>
    <RollNo>123</RollNo>
    <Address>a-4</Address>
    </ns0:Http_Message_Type_Demo>
    somebody should help me!please
    Thanks

    Hi,
    You can use HTTPServletRequest object to get the XML payload.
    BufferedReader reader = request.getReader(); //gets XML payload
    String line = reader.readLine(); // to read the XML payload line by line
    (request is the HTTPServletRequest object)
    Regards,
    Uma

  • How to get back all lost photos after updating the iOS8?

    When I updated my IOS8 I thought I lost my photos, so I have restored my iPhone but after restoring I have discovered that I lost all my photos, please advise how can get/ retrieve all the lost photos specially since I didn't do backup?

    If you backed up to iCloud, you might be able to choose from more than one backup. Each backup made in iTunes on your computer usually replaces the older one, except if you use a backup to restore from. Go to iTunes/Edit/Preferences/Devices and check if there are more backups listed, which you can then use to restore.
    Check these articles about backups:
    Create and delete iPhone, iPad, and iPod touch backups in iTunes
    Back up and restore your iOS device with iCloud or iTunes
    Choosing an iOS backup method (Should I use iTunes or iCloud to back up my iOS device?)

  • How to get the data in servlet if the request encryption type is multipart/

    I am uploading files to the server.
    at that time,before upload ,I need to validate the upload file names.
    so,i am trying to get the value of those files names using
    request.getParameter("jobsheet"); in servlet.
    its giving null insted of file path.
    how to retrieve the the values of parameters if the request is multipart/form-data.
    any help please...

    I think that package works in struts framework right?
    If wrong ,correct me.
    actually I am following MVC pattern.not using struts.
    If this works even in normal web application also.then ok.
    But,Just I am looking how to get the values of jsp parameters
    I have 5 elements in jsp .
    below code:
    <form name="FileUpload" action="./UploadServlet" method="post" enctype="multipart/form-data">
    country <input type="text" name="country" value="">
    year <input type="text" name="year" value="">
    month <input type="text" name="month" value="">
    File<input type="file" name="file1" value="">
    <input type="submit">
    </form>
    I am trying to get the data in servlet like
    String country=req.getParameter("country");
    its getting null.
    I don't know how to get the values if the enctype is "enctype="multipart/form-data"
    If any one knows ,Please suggest me.

  • How to get XML value using servlet?

    how to get values from a XML file using servlet ? Thank you.
    for example: how can I get the location value (aaa) from this XML file?
    abc.xml:
    <business>
    <location>aaa</location>
    </business>

    Try to use XML Parsers to do the job.
    Use DOM or SAX Parsers that are freely available.
    Some of the popular ones are xerces, DOM, SAX.

  • Hi How to get XML file from servlet that XI sent to my J2EE appl?

    Hi All!
    I have a scenario like XI sends xml file to j2ee application. In my J2EE application my servlet receives this xml. Will the xml file be in my HTTPServletRequest object? if so how to get that file from Request object.
    Please help me its urgent, Any code help is highly appreciated.
    My xml file will be like this:
    <ns0:Http_Message_Type_Demo
    xmlns:ns0="http://abcdemo.com">
    <Name>ABC</Name>
    <RollNo>123</RollNo>
    <Address>a-4</Address>
    </ns0:Http_Message_Type_Demo>
    somebody should help me!please
    Thanks

    Hi,
    You can use HTTPServletRequest object to get the XML payload.
    BufferedReader reader = request.getReader(); //gets XML payload
    String line = reader.readLine(); // to read the XML payload line by line
    (request is the HTTPServletRequest object)
    Regards,
    Uma

  • How to get ArrayCollection's total data after filter

    after i use filterFunction to filter data of some
    ArrayCollection. so how to get the total original data of this
    ArrayCollection?
    NOT use filterFunction = null, because i use the filter data
    to show at the same time!
    thank you!

    You can get the underlying array by accessing the
    ArrayCollection's "source".

  • How to get the screen to dim after a certain time?

    cant remember how to get screen to dim after no screen activity? anyone remember?

    Settings, general, autolock.  Set it for however long you want it.

  • How to get back into Time Machine after restore?

    I have a MacBook. I had to take it in for repairs. Fry's gave me a loaner Macbook. I successfully used the Migration Assistant to copy all my backups onto the loaner Macbook. All my apps and docs seem to be here.
    But now I want to be able to "mount" to my old Time Machine backup "stream". I tried the control-click on Time Machine in the dock to connect to a previous backup, but when I enter Time Machine I can't find any history. I should have like 2 years worth of backups.
    Any hints on how to "get back on" an old time machine sequence after a restore?

    RichieW13 wrote:
    I have a MacBook. I had to take it in for repairs. Fry's gave me a loaner Macbook. I successfully used the Migration Assistant to copy all my backups onto the loaner Macbook. All my apps and docs seem to be here.
    But now I want to be able to "mount" to my old Time Machine backup "stream". I tried the control-click on Time Machine in the dock to connect to a previous backup, but when I enter Time Machine I can't find any history. I should have like 2 years worth of backups.
    Any hints on how to "get back on" an old time machine sequence after a restore?
    TM keeps the backups for each Mac separate, and normally only shows the ones for the Mac it's running on, even if there are other Macs' backups on the same disk/partition.
    Also, sometimes TM will start a new "sequence" of backups, as if they were from a different Mac.
    To see these "other" backups, you need the (badly named) +Browse Other Time Machine Disks+ option. It's available by holding down the Option key while selecting the TM icon in your Menubar, or by control-clicking (right-clicking) the TM icon in your Dock.
    You'll see a selection screen showing all the disks/partitions that have TM backups on them. Select the one you want, and you'll be taken to the normal TM "Star Wars" interface, where you should see all the backups on that disk/partition.

  • HT201250 I have an Time Capsule (1 TB) and do not know how to get my data from it after reformatting my hard drive.

    Due to multiple problems with Lion, I decided to reformat my hard drive with Snow Leopard (10.5.8) and now am unable to retrieve my data from my time capsule (1T).  I tried to import but ended up with 342 pictures of mainly clip art and downloads from emails.  Help.  I don't know how to get to the time capsule.  When I open time capsule, it shows only the dates since I reformatted on Sunday.

    I don't think this helped me!  I am afraid to do the Terminal thing if it can't be undone!  I cannot afford to lose the time machine backups.  When I open the time machine now, it shows only backups from Sunday when I reformatted the disk!!!
    I did open disk utility which is as follows:
                                  Capacity:  464.8 GB (499,113,885,696 Bytes)
                                  Available: 441.6 GB (474,187,837,440 Bytes
                                   Used:  23.2 GM (24,926, 048,256 Bytes)
                                   Number of Files: 634,969
                                  Format:  Mac OS Extended (Journaled)
                                  Owners Enabled:  Yes
                                  Number of Folders:  159,926
    It gives me the option to restore, but then wants a source and destination.  Is this the right place to be?  I have Version 10.5.8. 

  • How to get backed up apps back after restoring it to factory settings

    Hi, I recently tried to update to the new 3.2.1 update, but something happened and it restored my iPad back to factory settings, the good thing was that I backed all my apps before I tried to update, but now I can't figure out how to get them back. I see them in iTunes, but when I sync my iPad it doesn't download them back (and yes, I'm using the same account).

    Have you tried this:
    To restore the software on your iPod touch, iPhone, or iPad:
    Connect your iPod touch, iPhone, or iPad to your computer.
    When the device appears in the iTunes window, select it.
    Click the Summary tab, click Restore, and then follow the onscreen instructions.
    If you back up your iPod touch, iPhone, or iPad, you can restore your settings from the backup at the end of the restore process.
    Good luck.

  • There are many complaints about iMesh, but no answers as to how to get iMesh OFF the browser after it's been uninstalled. Can Firefox PLEASE direct us how to get rid of this program. Thank you. Lucille H

    Many complaints in ASK QUESTIONS about getting rid of iMesh in a browser, but no answer is provided. Please instruct your users how to get rid of this program. I got the install information from iMesh directly but my browser will not clear it, even if I change my home page. It's an impossible program to get rid of. This can't be legal. Thanks,
    Lucille Hunt
    Mack Avenue Records.

    Hi St. Peter. Thanks for your advice. I tried entering firefox.exe as you suggeted, but got the Just Ask Jeeves page again. You suggested uninstalling Just Ask Jeeves, but I`m not sure how to go about this since it doesn`t appear in my programmes. Thanks for your help.

  • How to get bak to my mac after installing linux

    I SEE THE PROHIBITORY SIMBOL AND A FOLDER  FLASHING WITH A QUSTION MARK AT BOOT I WAS TRYING TO INSTALL LINUX, i tryed to boot disk utility but i cant see it by pressing alt when i start my imac

    Unless someone else can assist I'm afraid I don't have the knowledge. When you attempt a dual boot system without using one of the the standard processes such as using a virtualization app you are working in uncharted territory and have figure it out on your own or take it to an AASP that can rescue you.
    Good luck and let  us know how you get it fixed.

Maybe you are looking for

  • Script for folder or file that always has a name that is the CURRENT DATE

    hi all, i tried to get this done a couple times and i either misunderstood how to use the script or there was some complication so i am returning to it. i would like to have a FILE or a FOLDER on my desktop that has a name which is TODAYS DATE. the r

  • Can you increase DFF length on Framework page through personalization?

    Can you increase DFF length on Framework page through personalization? Not sure if this is possible with personalization or only through customization. Please advise. Thanks,

  • [SOLVED] No wireless on my EeePC 900

    Last night I decided to try a full system upgrade (pacman -Syu). I figured upgrading the kernel might negatively affect the delicate balance I had achieved when I initially installed Arch--at least in regards to my wifi--but I had heard that the newe

  • Error at production order cancellation .

    Dear all , I have posted same issue before this but due to technical problem i am not able to see your replies . So plz reply me again for the error at the time of production order cancellation . Production order has been confirmed for operation no 0

  • Can I download FaceTime on a PC?

    Hello, I wonder if you can download FaceTime on a PC. And if you can't. why can't Apple make it happen?