Encode URL with h:outputLink

Hi All,
I have used an output Link to access a servlet.
But the problem lies in i want to encode my URL. something like
href='<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/theme/exestyle.css") %>'
I am currently using the url in the following manner.     
<h:outputLink value="#{facesContext.externalContext.requestContextPath}/RProcessorServlet" >

Hi,
Thanks for replying.
At a plain jsf level this does not pose a problem at all for me.
But in our project we use WSRP Portlets.Which has a producer and consumer framework.So any url we hit for file downloading hits the proxy servlet first which rewrites the URL and hits the actual servlet.
At a higher level this is the architecture we support.
Its a very simple requirement there is a pdf icon onclick of that i need to download the report from the database.
I can actually invoke a javascript to handle the url in the following way.
String encodedURL_dtd = response.encodeURL(request.getContextPath()+ "/DownloadServlet");
But here i fail to send the row data to the javascript to be send as request parameters.
So based on a similar post before i used <h:outputLink> in the following manner.
<h:datatable var="item" value="databean.list" >
<h:outputLink rendered="#{(item.strreportFormat == 'P') onclick="<context-path>/DownloadServlet">
<h:graphicImage value="/images/icon/icon_small_pdf.gif" alt="View Reports"></h:graphicImage>
<f:param id="id1" value="item.id" />
<f:param id="sys1" value="item.sysName" />
</h:outputLink>
</h:datatable>
I hope i could explain my query...
Given me a chance i would stick to my jsf application running in the test environment.But things don't work when they go to the framework level.

Similar Messages

  • A peculiar problem with encode url

    Hi,
    I have the following code snippet in jsp
    <a href="<%=urlencoder.encode("cxc.jsp?P1=RWDS") %">> Rewards</a>
    But when this page is requested, the oracle application server responds with response 404 stating requested url not found.we aer using oracle application server 10g release 2.
    But without encoding the response is correctly displayed.
    has it got to do anything with encoding? or will it be required to change the code.
    But the same encoded url works perfectly fine on iplanet application server.
    Thanks in advance

    I was able to solve this by including the google code in an external PHP file as well. However if my template has a repeating region in it, and my contribute user adds a region from it, it breaks the code again :/
    Are there any other suggestions out there??

  • [SOLVED] Encoded URL's are Re-Encoded When Clicked

    Some of our users here are copying URL's of relevant files [from one of our sites] and pasting them into Excel.
    As the need arises, they refer back to the Excel document and click the link to retrieve the document.
    When clicked the already-encoded URL's:
    https://sub.domain/some/path/to/files/My%20Super%20Long%20File%20Name-Thats%20Already%20Encoded.pdf
    Are getting encoded a second time, which result in a URL like:
    https://sub.domain/some/path/to/files/My%2520Super%2520Long%2520File%2520Name-Thats%2520Already%2520Encoded.pdf
    This naturally won't work because its now literally looking for a file called "My%20Super%20Long%20File%20Name-Thats%20Already%20Encoded.pdf" which of course doesn't exist.
    The URL's in Excel appear normal in the cells themselves.
    The editing the actual hyperlink confirms its also correct there as well.
    The URL's also look normal in the formula bar.
    I've reproduced this behavior on multiple company machines: Windows 7 x64 Enterprise SP1 with Office ProPlus 2010 32-bit.
    I was also able to reproduce this on vanilla Windows 7 VM's in Hyper-V using Office ProPlus 2010 and 2013.  Although domain joined, they're in an OU with blocked inheritance enabled and no linked GPO's.
    I can't figure out where the problem is: Excel, Windows, IIS or something else?

    Hi,
    I’ve done a test for this situation, but the url won’t change after reopening the file.
    1. A pdf file in SharePoint, and the file name contains some spaces which is the same with customers.
    2. Input the SharePoint URL into Excel, and each spaces has been replaced by %20
    3. Then, I can open the file in IE
    4. After I closed the website and excel file, I could open it in IE again and the URL didn’t change.
    As you mentioned in the ticket “Are getting encoded a second time, which result in a URL like”, may I know if the re-encoding was done automatically or manually? Based on the test result, it won’t encode a second automatically.
    If it is done manually, the issue should be most likely caused by the space character being encoded twice, because the space character is encoded as %20 as our two url show. However, based on your second url, it turned into %2520, Since the % character
    is encoded as %25, it should be a result of a double encoded. Actually, URLs need their characters to be in a specific format, ASCII characters, so that browsers can correctly interpret and parse the data. For every ASCII character in URLs, it will be encoded
    a string starting with %, and % is also an ASCII character in URLs and encoded to %25. If we double encode a URL, which results that every ASCII character in the URL will be encoded a string starting with %25, and that the URL becomes invalid. Therefore, I
    suggest you name the file using
    alpha-numeric
    characters
    only or do not encode it twice.
    If it is done automatically, since you have reproduced the issue on multiple machines, could you please help check the following Excel settings in several machines to make comparisons with each other.
    Excel Option>Advanced, Scroll to the General section and click Web Options, select Encoding
    If it possible, would you mind sharing a test file with me to do a test from my end?
    Regards,
    Melon Chen
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please click
    here

  • Iisforward and encoded URLs

    I cannot seem to get the iisproxy/iisforward combination to properly handle
    encoded URL session strings.
    I have been performing my tests with WebLogic Sever 5.1.0sp5, IIS 5 and
    Windows 2000 (both IE and Netscape). I use the
    examples.servlets.SessionServlet included with WebLogic server. It has a
    link that tests encoded URL session management. With sp4 and before, the
    iisproxy handled this well, so long as I included the arbitrary extension.
    The forwarding works to hit the servlet the first time, but subsequent
    times present me with a 404, as if the proxy decided it shouldn't forward
    the request and IIS is searching its files. IIS logs confirm this.
    Anyone been able to get encodeURL() calls to work through the proxy?
    Jesse

    Either no one uses encodedURLs or no one bothered trying this. However, I
    found this behavior in both IIS 4 and IIS 5 and filed a bug report. A
    change request has been made and can be tracked via ID 189897.
    Jesse

  • A wierd problem while encoding URLs

    Hi all,
    I'm facing a wierd problem with the java.net.URLEncoder class. The encode function in this class is used for encoding URL based on standards like "UTF-8" etc..
    I need to encode the URLs, because i have to send this information in a XML to another server.. Here's what the URLEncoder is doing if i give it the URL
    http://mydomain.com:80/myServlet?_fileName=filename.mp3&_useStreaming=true
    its encoding this as
    http%3A%2F%2Fmydomain.com%3A80%2FmyServlet%3F_fileName%3Dfilename.mp3%26_useStreaming%3Dtrue
    but, all I wanted is to encode only '&' character ( as XML misinterprets this character with schemes ).
    So, my question is .. is there any way that i can selectively encode the characters in the URL?
    Any help wud be appriciated in this regard. :-)

    I accept what you are saying.. URLEncoder encodes any string that's passed to it..
    I infact have two different problems in hand.. The reason i mentioned only one above is because the solution to the first problem cud as well solve the second.. Anyway, here's the second problem ...
    I'm recieving an XML from a server, where i get the URL info and i have to download the CONTENT from that URL.. Sample xml is given below
    <Music>
    <Singer>Tata Young</Singer>
    <contentURL>http://myMusic.com/sexy naughty.mp3</contentURL>
    </Music>
    if you see the URL in the xml, that infact contains spaces in it.. I have my logic which checks if the given URL is a absolute URL or relative URL
    if( relative URL)
    I append "http://domain name:" stuff to make it absolute
    else
    i connect to the URL directly to get the Content
    I'm using
    URI i = new URI(str);
    i.isAbsolute() method to determine whether its a absolute URL or not..
    but this method doesn't seem to work for URLs that have spaces in them.. So, i encoded the URL and tried passing it to the method.. but it still doesn't work..
    I probed into URI class itself and found out to my amazement that URI class assumes that URL contains only alpha numeric characters and few special characters like '+' , '/' , ':' etc..
    Since the encoded URL has '%' character in it.. its not able to say that its a absolute URL.. Tht's the reason I asked for selective encoding.. ( say, which encodes only [space] character)..

  • Protecting Live Stream Encoding URL

    We set up a Flash Media Server and we are trying to figure out how to protect our live encoding url. Seems like anyone with a Flash Media Encoder and who knew the location of our server could publish a live stream. Can we password protect this in any way?

    Asa,
    Are you able to share details of what the solution being developed by Adobe will involve, and which versions of FMS it will apply to (an update for 3.0, 3.5 or just a feature of 4.0)
    Thanks,
    Michael

  • URLEncoding of URLs with UTF-8 characters

    Hi,
    I'm trying to URL encode a URL with some chinese characters in them. But it isnt working properly.
    i.e. When i decode back the encdoed URL (using java.net.URLDEncoder.decode(String) & java.net.URLDecoder.decode(string) respectively), I dont get the same URL back... The chinese characters are lost some how...
    I tried writing it to a file instead of printing the out put, but no luck...
    input URL=http://down.chinamp3.com/down.php?id=70201&song_name=I%20Will%20Be%20Fine&singer_name=&#33707;&#25991;&#34074;
    encoded URL=http%3a//down.chinamp3.com/down.php%3fid%3d70201%26song_name%3dI%2520Will%2520Be%2520Fine%26singer_name%3d%e8%8e%ab%e6%96%87%e8%94%9a
    decoded URL=http://down.chinamp3.com/down.php?id=70201&song_name=I%20Will%20Be%20Fine&singer_name=���������������������
    Where as the decode URL should be same as the input URL!!!!
    I'm completely stuck, Some advice will be highly appreciated!
    Regards
    Pratim

    I tried something similar in different ways. After spending days.. i came up with something which is working fine for me in any language. I tested the following code from java applet, or input from HTML page, it seems to be working fine. I hope this helps.
    Do not use the request.getParemeter() for retrieving chinese or other 2/3 byte input characters. Instead create your own hashtable and do read ur request input stream directly.
    ------------------- code ----------------
              String queryString = request.getQueryString();
              String paramStr = "";
              if(isPost)
                   StringBuffer buffer = new StringBuffer();
                   char[] buf = new char[4 * 1024]; // 4Kchar buffer
                   int len;
                   BufferedReader reader = request.getReader();
                   while ((len = reader.read(buf, 0, buf.length)) != -1)
                        buffer.append(buf, 0 ,len);
                   paramStr = buffer.toString();
                   paramStr = URLDecoder.decode(paramStr,"UTF-8");
                   p(paramStr);
              Hashtable requestHash = createHash(paramStr);
              Hashtable getRequestHash = createHash(queryString==null?"":queryString );//HttpUtils.parseQueryString( queryString==null?"":queryString );
              for(Enumeration e= getRequestHash.keys();e.hasMoreElements();)
                   Object key = e.nextElement();
                   Object value = getRequestHash.get( key );
                   requestHash.put(key,value);
              p("Request Hash size : " + requestHash.size());
    --- end code ---
    And now the create hash function
    -------------- code -----------
    Hashtable createHash(String str)
         Hashtable hash = new Hashtable();
         StringTokenizer st = new StringTokenizer(str,"&");
         while(st.hasMoreTokens())
              StringTokenizer st1 = new StringTokenizer(st.nextToken(),"=");
              String key = st1.nextToken();
              String value = (st1.hasMoreTokens()?st1.nextToken():"");
              hash.put(key,new String[]{value});
         return hash;
    String getRequestValue(Hashtable requestHash,String key)
         if(requestHash.get(key)==null)
              return null;
         String value = ((String[]) requestHash.get(key))[0];
         return value;
    String[] getRequestValues(Hashtable requestHash,String key)
         if(requestHash.get(key)==null)
              return null;
         String[] value = ((String[]) requestHash.get(key));
         return value;
    --------------------- end code ---------------
    You can get the request value like this:
    String act=getRequestValue(requestHash,"act");
    I hope this one helps

  • URLs with spaces

    I know that's a contradiction in terms but here is my problem. My database contains large numbers of 'URLs' with spaces in them reflecting where the corresponding files actually are in the file system. In the longer term I can get them converted to use %20 but in the meantime I have the problem that h:outputLink translates the spaces into +. I'm just wondering if there's something in JSF that will turn them into %20 for me? ... other than fn:replace() which I guess is not a bad alternative ...
    Thanks in advance.

    SharePoint is a Document Management system which is designed to be user-friendly. Naming all documents in your site farm with no spaces makes the document titles difficult to read for the end users. I agree that, programatically, no spaces is good, but unfortunately,
    systems are used by human beings. So even though your suggestion has been marked as an answer, it's not really a solution is it?
    The solution I came up with that solved my instance of this problem was to add a text column to the List I was working with, then put some JavaScript in the NewForm.aspx file that copies the file name into the text file and the applies an "encodeURI" to
    convert the word spaces into %20 ...
    So when I create a new item in my list, the JavaScript takes the file name, converts the spaces to %20, then copies the string into the text field in the list. When I build the WorkFlow Email, instead of concating the file name into a URL, I use the text
    field that pulls out (for example) "my%20file" and adds the pre-amble (http://myserver/path/) and the suffix (.pdf) and I have a working URL ...
    The full solution is posted at
    my blog ...

  • Why do I have to append URL with /index.htm on one KB?

    I have 7 different KBs I maintain on my webserver. I am using RoboHelp 7. For one of them, I have to append the URL with /index.htm, or it does not show the correct information. Examples of two of the KBs, and what happens with & without the index.htm appendeden
    I will happily provide any other information. I've been wondering about this for a long time, and it's finally driven me batty enough to ask. Thanks so much for any assistance. Greatly appreciate your input, this is a wonderful resource.
    http://wpa10suppliertest.am.mot-mobility.com/ opens a training KB for supplier information. See screenshot of the WebHelp Primary Layout:
    However, for http://wpa10user.am.mot-mobility.com/ if I do not append with http://wpa10user.am.mot-mobility.com/index.htm, I get no content, and the first skin I tried out. The settings are the same:
    http://wpa10user.am.mot-mobility.com/:
    http://wpa10user.am.mot-mobility.com/index.htm:

    Hi William,
    That makes sense - but I had looked at my IIS setups and they appear the same for all KBs, again here are settings for WPA Supplier & User. I created both the same day, the same way, and have compared all tabs which are identical. I can double check on how the DNS aliases that were set up, but they should have been identical as well

  • Printing different URL with javascript

    I am trying to print a URL using javascript but i do not want to print the current page. I have searched google, this forum and a javascript book and can not seem to figure it out. To exlplain in it generic terms i want to be on one page and tell it to print another. Reason being, I am looking at an overview page and want to print a report made in Oracle reports, (Yes I could load the report and print it but i want to print multiple reports from one button)(The reports do work and are valid) Here is a rundown of what I am doing.
    From a button i am calling a 'url' with the following code:
    javascript:V_PRINT('P50_CUSTOMER_ID','P50_YEAR');
    And then in the html header i have the code: (printing same page twice, just an example)
    <script language="JavaScript" type="text/javascript">
    function V_PRINT (formItem1,formItem2) {
    var formVal1 = document.getElementById(formItem1).value;
    var formVal2 = document.getElementById(formItem2).value;
    var url1;
    var url2;
    url1 = 'http://www.google.com/search?hl=en&q=' + formVal1 + '+' + formVal2;
    url2 = 'http://www.google.com/search?hl=en&q=' + formVal1 + '+' + formVal2;
    url1 = print();
    url2 = print();
    </script>
    This code just prints the current page. I know I am calling print incorrectly and thats where i need the help. Of course I might just be approaching it all wrong. Either way I hope someone with javascript knowledge can help.
    Thanks

    Hello,
    To print a page it has to be open in the browser since all it does it call the browsers print dialog.
    Here is one solution http://www.irt.org/script/508.htm and you can also try a iframe instead of a regular frame.
    If it's crossdomain request like your example here that might cause problems as well. There might be additional problems.
    Carl

  • How to read the param in an URL with an applet???

    I will like to read the in an URL with an applet param (after the ?)
    I need the equivalent of: String parm1 = request.getParameter("param"); but for applet
    I think the HttpServletResponse doesn't work in an applet ???
    Tell me if I'am right
    Thanks for your help
    Benoit

    Hi
    What you can do is, just get that URL in the web page. Like as we can get in the ASP. Store the required information in the variables and pass this information as parameters to the applet.
    Hope this helps!

  • Trying to Add Adobe Media Encoder in Creative cloud licenses but its not coming up, is media encoder bundled with another adobe product?

    Trying to Add Adobe Media Encoder in Creative cloud licenses but its not coming up, is media encoder bundled with another adobe product?

    You MUST have a 64bit computer... what is your computer?
    Adobe's MINimums http://helpx.adobe.com/premiere-pro/system-requirements.html
    -Programs won't display if they will not install on your computer
    -http://helpx.adobe.com/creative-cloud/kb/all-apps-displayed-aam.html

  • "there was a problem connecting to the server. URLS with the type 'file' are not supported"

    i have a new macbook pro 13" and every 6 minutes or so it pops up a window that says "there was a problem connecting to the server. URLS with the type 'file' are not supported". it never seems to cause any problems but is supremely annoying. how can i make this come to an end?

    I tried someone's solution of taking another external disc and plugging it in, then when it showed up and time machine asked if I wanted to use it or that someone might be trying to trick me, I chose not use it.  Then I  shut down my computer, plugged in the original Lacie, and rebooted the computer and all seems to work fine now-- the Lacie appears on my desktop and all seeems to be in working order. Who knows why or anything else,- as weird as it gets- but for now things seemed fixed--- maybe others can try this too-- it worked for me so far.

  • "There was a problem connecting to the server.   URLs with the type "file:" are not supported.  Why?  What can be done to eliminate it?

    After upgrading to Mountain Lion, I repeatedly get this message:  "There was a problem connecting to the server.   URLs with the type "file:" are not supported. 
    Why? 
    What can be done to eliminate it?

    Open the Time Machine pane in System Preferences. If it shows that Time Machine is ON, click the padlock icon in the lower left corner, if necessary, to unlock it. Scroll to the bottom of the list of backup drives and click Add or Remove Backup Disk. Remove all the disks, then add them back. Quit System Preferences. Test.

  • Message - There was a problem connecting to the server. URLs with the type "file:" are not supported

    new macbook pro receving this message: There was a problem connecting to the server. URLs with the type "file:" are not supported. What is causing this and how do

    Open the Time Machine pane in System Preferences. If it shows that Time Machine is ON, click the padlock icon in the lower left corner, if necessary, to unlock it. Scroll to the bottom of the list of backup drives and click Add or Remove Backup Disk. Remove all the disks, then add them back. Quit System Preferences. Test.

Maybe you are looking for