Url of the current component

Hi Guys,
I've developped a component using the PDK. In runtime, when running this component, can this component have access to its own url?
how?
Best regards,
Marc

Hi Marc,
this worked for me (inside a JSPDynPage), in a servlet you should be able to access the HttpServletRequest directly:
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import javax.servlet.http.HttpServletRequest;
IPortalComponentRequest request = (IPortalComponentRequest)this.getRequest();
HttpServletRequest servletrequest = request.getServletRequest();
String url = servletrequest.getScheme() + "://";
url += servletrequest.getServerName();
url += ":" + servletrequest.getServerPort();
url += servletrequest.getRequestURI();
Hope it helps ...
Best regards,
Kilian

Similar Messages

  • URL of the current portal page loaded using Javascript ?

    Hello:
    I am trying to add programmatically the url of the current
    page loaded in the portal to the 'Favorites List'. There
    is a pre-built KM iview to store your 'favorites'.
    I can extract and write to this 'favorites' using KM java
    API. But only challenge is to extract the current loaded
    page URL and title using Javascript.
    I would appreciate any help in this regard.
    Thank you very much,
    Prasad Nutalapati

    Dude i was having the exact same problem. I solved it using the SAP-provided EPCM (javascript client framework).
    Javascript Code
    var pageName = "";
    var URL = "";
    function bookmarkPage()
         /* page url */
         var fullURL = "https://<%=request.getServerName()%>/irj/portal?NavigationTarget=" + URL;
         /* IE bookmark */
         if(EPCM.getUAType() == EPCM.MSIE)
              window.external.AddFavorite(fullURL , pageName);
         else
              var msg = "Sorry. The \"Add To Favorites\" feature only works with Internet Explorer. " +
                          "The URL to this page is " + fullURL;
              alert(msg);
    /* get pagename from eventObject from subscribed event */
    function getPageObject(eventObj) {
        pageName = eventObj.dataObject.title;
        URL = eventObj.dataObject.URL;
    /* subscribe to event in pagetoolbar area */
    EPCM.subscribeEvent("urn:com.sapportals:navigation", "AddNavTargetAllowDuplicate", getPageObject);
    End of code
    Basically, what this does is that everytime a page loads, the innerpage, where the content is, raises an event using  the EPCM.raiseEvent() method. EPCM.subscribeEvent subscribes to an event called AddNavTargetAllowDuplicate which has an object holding the page information (i.e. page title and URL (ROLE://...)). Everytime that it notices an event raised, the function getPageObject gets called to go get data from the event object that is available globally in the framework.
    You should be able to put this code anywhere in any iview and it should work. Thou i have only tried putting it in the masthead. Try and if you still have questions please let me know.

  • How do I open a duplicate tab or window that points to the same URL as the current tab?

    In earlier versions of browsers, not necessarily Firefox, it used to be possible to launch a new tab or window with the same URL as the current window. I can't find a way to do this in Firefox. It always opens new windows with no URL specified.

    Hold down the control key, then drag the tab that you want to duplicate onto the tab bar.

  • Return url for the current page

    Hi,
    I would like to know how to return the url for the current page?

    These are my preferred choices:
    request.getRequestURI() will give you the relative path from root. For example:
    /mypages/thepageIamon.jsp
    request.getRequestURL().toString() will give you the full path. For example:
    http://www.mysite.com/mypages/thepageIamon.jsp
    Hope this helps.

  • Hi, problem occurs when I'm clicking a button or a new url on the current site. For instance, when i clicked that "Ask This" button on this web site, It redirects me to the default homepage. I cant go back and I'm losing the previous web site HELP PLEASE!

    Hi, problem occurs when I'm clicking a button or a new url on the current site. For instance, when i clicked that "Ask This" button on this web site, It redirects me to the default homepage. I cant go back and I'm losing the previous web site HELP PLEASE!

    Try the Firefox SafeMode. <br />
    ''A troubleshooting mode, which disables most Add-ons.'' <br />
    ''(If you're not using it, switch to the Default Theme.)''
    # You can open the Firefox 4.0 SafeMode by holding the '''Shft''' key when you use the Firefox desktop or Start menu shortcut.
    # Or use the Help menu item, click on '''Restart with Add-ons Disabled...''' while Firefox is running. <br />
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shft key) to open it again.''
    If it is good in the Firefox SafeMode, your problem is probably caused by an extension, and you need to figure out which one. <br />
    http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes

  • Collecting the URL for the current page..

    I'd like to collect the complete URL that created the current page. I'd like to pas this information to a succeding dynamic page, so that I can return to the current page.
    I have tries using the OWA_UTIL.get_cgi... routines but they seem to be lacking the parameter list to make them complete. The path and page, but no parameters.
    Is there an API routine or a technique to accomplish this in PL/SQL?
    Thanks,
    Stuart

    We had the same problem at a project, we solved it with the use of javascript. If you want an example mail me at [email protected]
    arny

  • WebUtil getting the URL of the current form

    Hi after reading through the documentation on WebUtil I am not sure whether the utility will allow you to get the URL that is in the browser that the user is using to display the Oracle Form that it is running from. I need this as I have to issue web.show_document commands based on the users URL and need to know the URL to figure out which server they have come from in order to issue a web.show_document command with a URL that the user will be able to read. Does anyone know if this is possible or other ways of achieving the same result
    Also has anyone got an unsupported version of WebUtil for Forms 6i as I am currently on AIX 4.3.3 and need to get our Unix teams to upgrade to AIX 5 before I can even start to think about Forms9i/10g and Oracle 9i/10g
    regards,
    [email protected]

    Mark,
    wweb.show_document() can take relative Web addresses too, which means that automatically the server that the Forms was downloaded from will be referref by the URL. Assuming
    http://myserv1:9999/forms90/f90servlet...
    is the address you started Forms Services on,
    web.show_document('/mydir/mytest.html','_blank');
    requets for a URL
    http://myserv1:9999/mydir/mytest.html
    So in fact you don't need to know of the URL.
    WebUtil does not provide this functionality, but it would be easy to add. So let me know if my suggestion using web.show_document() doesn't work as you want it and I'll add this as an ER for WebUtil.
    Fran

  • How do I force firefox to open a new URl on the current viewed tab or a new one. It opnes the URl on an existing Non viewed tab

    I have tried all the tab option and can not get Firefox to act like it did on the previous version. Firefox does not display the new url in the existing open tab or a new tab. Since installing the update, it opens the url in an existing backgound tab.

    Open link/bookmark in new tab in same window:
    *Middle-click (press the mouse scroll wheel) the link
    *Ctrl+left click the link
    *right-click the link, choose "Open Link in New Tab"
    Open link/bookmark in new window:
    * Shift+Enter on the link
    * Shift+left click on the link
    See: http://www.7is7.com/software/firefox/shortcuts.html

  • How to get the local file system path of an image that loaded into the image component in cq5?

    Hi,
    I'm having hard time uploading image from filesystem where as drag and drop works.
    I'm not getting a path of image selected from filesystem.
    here is my code..
    private String populateImage() throws Exception {
                        if (currentNode != null && currentNode.isNode()) {
                                       Node ImageNode = JcrResourceUtil.createPath(currentNode, "image",
                                                                          null, "nt:unstructured", true);
                                       imageUrl = ImageNode.hasProperty("fileReference") ? ImageNode.getProperty("fileReference").getValue().getString() : "";
           imageUrl = imageUrl.trim();
            log.info("MANAGE PROFILE BEAN IMAGE URL INSIDE IF IS: " + imageUrl);
                        } else {
                                            imageUrl = properties.get("fileReference", "");
                                            imageUrl = imageUrl.trim();
                                            log.info("MANAGE PROFILE BEAN IMAGE URL INSIDE ELSE IS: " + imageUrl);
                        return imageUrl;
    So if I drag and drop..
    ImageNode.hasProperty("fileReference") is returning a valid path
    but if I upload an image  it is returning Null.
    So how to get the path? any suggestions around would be appreciated...

    When you say path you mean you want the path to print out in your HTML? Is that accurate? If so you generally need to constructe that path based on the path to the current component. So if you component is located at /content/mysite/en/about/mypage/jcr:content/parsys/image then the path to the image would generally be something like /content/mysite/en/about/mypage/jcr:content/parsys/image.img.jpg/1283829292873.jpg. The .img. selector triggers the servlet associated with the foundation parbase - /libs/foundation/components/parbase/img.GET.java. The reason you reference it this way is that there is no filesystem path to the image - it is stored in the repository not on the file system, and it requires a servlet or script to ge the binary from the repository and steam it.
    Normally the way you'd construct this is to use the out of the box Image class - so look at /libs/foundation/components/image/image.jsp. Now this example assumes that your component where you loaded the image extends /libs/foundation/components/parbase. If it doesn't then you either have to change your sling:superResourceType to /libs/foundation/components/parbase or some other component that does exten /libs/foundation/components/parbase.

  • How to read the current value of hyperlink java bean in multiple record,

    I have used a java bean for a multi-record block item. On When-new form-instance I m using fbean package as follows
    FBean.Register_Bean(hHyperlink,1,'oracle.forms.demos.beans.Hyperlink');
    FBean.Invoke(hHyperlink,1,'setURL','Abc_Entry');
    FBean.Invoke(hHyperlink,1,'setLabel','Abc Document');
    FBean.Enable_Event(hHyperlink,1,'actionListener',true);
    You can see that I am using the number 1 which is hardcoded,for which I will replace with a incremental loop and remove it. Now when I m using the When-Custom-Item-Event, I want to read the URL for the current instance.
    I m using
    vcEventData := Fbean.Invoke_Char('CONTROL.HYPERLINK',2,'getURL');
    to get the second record value , where in I want to avoid the hardcoded 2 or 1
    Thank you

    I recommend you these forums for your question:
    Forums Home » Oracle Technology Network (OTN) » Products » Database » JVM
    Java in the Oracle Database
    Forums Home » Oracle Technology Network (OTN) » Technologies » Java » Java Server Pages (JSP)
    Java Server Pages (JSP)
    Forums Home » Oracle Technology Network (OTN) » Technologies » Java
    http://forums.oracle.com/forums/index.jsp?cat=24
    Joel Pérez

  • How do I get the address bar to show the url of the site that I'm on?

    In the old version of firefox, the address bar would show the url of the site I was on. When I would change tabs, the address bar would change to reflect the url of the tab. In the new version, the url of the current site will not show unless I hit the identity info button. This is really frustrating because I want the url to show up automatically, instead of showing the last thing I typed or the last site that I was on. If there is a way to fix this, I would really appreciate it. Thanks.

    https://support.mozilla.com/en-US/kb/Basic%20Troubleshooting

  • Determining the Current Tab

    I am currently on a project dealing with tabs as defined by the 3.0.9 portal.
    It is an absolute showstopper if we cannot determine which tab page a portlet is on, that is if we cannot know the identity/state of the currently rendered tab in a page.
    Either we need to know how to hook to a tab so that when it is clicked we can get some info, or we must have the state of the currently visible tab page.
    There is no apparent API for this.
    We have tried to construct a tab page monitor, but cannot attach aportlet to the page which we can guarantee will be rendered first, and therefor use that to guarantee the rest of the portlets on the page will be rendered properly.
    Once again, this is a showstopper for the client. There must be a reliable workaround for this, but we have not found it.
    Help!

    I'm concerned...
    It has been suggested that I could essentiall parse the "_pageid" variable from the current page URL to get the information about which tab is visible, by matching what I know to be the page, and tab numbers for the tabs on the page. I certainly can do that.
    Even a brute force approach such as this requires that I have access to the current Page URL.
    Perhaps I have missed something, but is there a method in PL.SQL for me to get the URL for the current page, rather than for the current portlet?
    I cannot guarantee which sequence portlets will be rendered on the page, only that they will all start and finish ( or time out ) before the page is displayed to me.
    So, Is there a method to get the Page URL( with query string attached ) between the time when it is sent (completed) to the server to be rendered, and time when the page is displayed in my browser.
    This is the time when the portlets on the page need the information to do their jobs.
    Or, is there a way to hook into the tab, and when it is pressed, set some state variable that will serve the purpose as well.
    We are using only the standard components and PL/SQL as required to promote maintenance and eventual reuse.
    null

  • Sending the current page in a mailto link

    I want to create a mailto link that will attach the url of the current page to the body of the e-mail message.
    I have created a display only item and added the following code to the default value:
    <anchor href='mailto:?subject=Please Review the attached Lessons Learned&body=Please review the following Lessons Learned: Copy and Paste link here'>Send the Lesson Learned for Review</anchor>
    (I have replaced the a tag with anchor so the code will show up)
    This is working and opening up the mail client with a blank recipient list and the subject and body filled in. Now where I have "Copy and Paste link here", I would like for the URL of the current page to be filled in. Is there a way to do this?
    Thanks,
    MIchelle

    Hi
    I use the following computation for the field, which is used as a parameter of a send_mail procedure.
    SERVER_NAME and DAD NAME are described somewhere in APEX help - they are usefull if you need to switch between development/testing/production environment with different server host names and Oracle database names.
    P50_INTEREST_ID contains the value to be set on the linked page 38, more precisely to it's attribute P38_INTEREST_ID. The value could be reffered also as v('P50_INTEREST_ID') or &P50_INTEREST_ID. instead of :P50_INTEREST_ID.
    IAL_NICKNAME is an application variable containing users nickname.
    Roman
    'Hi,' ||
    CHR(13) || CHR(10) || CHR(13) || CHR(10) ||
    'Please, look at ' || 'http://' || owa_util.get_cgi_env ('SERVER_NAME') || '/pls/' || owa_util.get_cgi_env ('DAD_NAME') || '/' || 'f?p=' || V('APP_ID') || ':38:::NO:38:P38_INTEREST_ID:' || :P50_INTEREST_ID || ' .' ||
    CHR(13) || CHR(10) || CHR(13) || CHR(10) ||
    V('IAL_NICKNAME')

  • Res.getPathTranslated() does not return correct URL of the page requested

    Hi,
    The res.getPathTranslated() statement in the below code (in doFilter method) does not return the correct URL of the requested webpage.
    Whenever a web page is accessed using a return statement (eg : return "nextPage"; ) inside a button's action method or a hyperlink's action method, the res.getPathTranslated() returns the URL of the current webpage instead of returning the URL of the webpage that is actually requested.
    For example if there is a button on the page http://localhost:29080/MyJaas/faces/firstPage.jsp
    And the button_action() is as follows
    button_action()
    return "nextPage";
    The res.getPageTranslaged() returns "http://localhost:29080/MyJaas/faces/firstPage.jsp" instead of "http://localhost:29080/MyJaas/faces/nextPage.jsp"
    However, if the webpage is requested by populating the URL property of the hyerlink in creator IDE, the res.getPathTranslated() returns the correct (requested) web page.
    How to make res.getPathTranslagted() return the correct URL when the webpage is accessed from hyperlink's / button's action method?
    I know that the explation is not very clear, so please bear with me. Let me know if you need more clarificatons. Thanks in advance for showing interest in this issue.
    And by the way, the code below is the same as that used in Jaas Authentication tutorial :- http://developers.sun.com/prodtech/javatools/jscreator/reference/techart/2/jaas_authentication.html
    package jaasauthentication;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.http.HttpSession;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class SecurityFilter implements Filter{
        /** Creates a new instance of SecurityFilter */
        private final static String FILTER_APPLIED = "_security_filter_applied";
        public SecurityFilter() {
        public void init(FilterConfig filterConfig) {
        public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws java.io.IOException, ServletException{
            HttpServletRequest req = (HttpServletRequest)request;
            HttpServletResponse res = (HttpServletResponse)response;
            HttpSession session = req.getSession();
            String requestedPage = req.getPathTranslated();
            String user=null;
            //We dont want to filter certain pages which include the Login.jsp/Register.jsp/Help.jsp
            if(request.getAttribute(FILTER_APPLIED) == null) {
                //check if the page requested is the login page or register page
                if((!requestedPage.endsWith("Login.jsp")) && (!requestedPage.endsWith("Register.jsp")) && (!requestedPage.endsWith("Help.jsp"))){
                    //Requested page is not login.jsp or register.jsp therefore check for user logged in..
                    //set the FILTER_APPLIED attribute to true
                    request.setAttribute(FILTER_APPLIED, Boolean.TRUE);
                    //Check that the session bean is not null and get the session bean property username.
                    if(((jaasauthentication.SessionBean1)session.getAttribute("SessionBean1"))!=null) {
                        user = ((jaasauthentication.SessionBean1)session.getAttribute("SessionBean1")).getUsername();
                    if((user==null)||(user.equals(""))) {
                        res.sendRedirect("Login.jsp");
                        return;
            //deliver request to next filter
            chain.doFilter(request, response);
        public void destroy(){
    }

    Guys any solution for the above problem?
    Right answer fetches 10 duke dollars..

  • Determine if current component is being pulled in by paragraph reference?

    Is there a way to determine at the component level if the current component is currently being imported into a paragraph reference component? A simple example would look like this in the component's jsp:
    if (/* Being Referenced */) {
         out.write("This component is pulled in by a paragraph reference");
    } else {
         out.write("This component is the original");
    I thought i'd be able to tell by using resource.getParent(), but that returns the original component's parent.
    I know i could compare the page path with the component's resource path if they were on different pages, but that wouldn't work out if the reference component and original component were on the same page.

    Sure, this is what we're doing (i'm sure there must be a better way) -
    Our pages will serve many users across different areas and roles. The authors wanted the ability to create one master page that will display certain components to only a certain area or role. For example, one text box should only be displayed to "south" users and another only to "west" users. To accomplish this we added tagging for each component and when a component loads on a page it does a check to display if the user has the same tags it has been tagged with. Looks something like this in the component jsp -
    <% if (componentAreaTag == userAreaTag) { %>
         <h1>Component Is Displayed</h1>
    <% } %>
    The problem with this is that a reference component also needs to be tagged independently of the component it is referencing. So right now it processes the reference component's tags to see if the user can access the component and then checks the referenced component before displaying. Ends up processing something like this -
    <% if (referenceComponentTag == userTag) { %> //From reference component
         <% if (componentTag == userTag) { %> //From component being referenced
              <h1>Component Is Displayed</h1>
         <% } %>
    <% } %>
    We need it not to care about the original component's tag when coming in through a reference component.

Maybe you are looking for

  • Urgent: problems in  report creation

    Hi All, My requirement is to report on opportunities cube with product hierarchy I have loaded product hierarchy first followed by opportunities but my problem is when i open opportunities cube in BEx analyzer i can see only key that is present in OP

  • No access on podcast share from Windows clients

    Hello together! I have the following scenatio at home: * 1 Server with Windows 2008 R2 with logged in user and iTunes running (everything is shared) * 1 Laptop with Windows 7 x64 & iTunes * 1 Desktop with Windows 7 x86 & iTunes * 1 Macbook with Mac O

  • A query with row and colum numbers?

    Hello, i have my java code divided into if conditions and in each if clause i need to select a certain field from a table. Is it somehow possible to select a table field which for example is in the third row and fifth column? So basically, how to sel

  • Plot multi curves in one window

    Is there anyone who can tell me how to plot multi-curves in one window using LabVIEW? The sample chart is attached. I have LabVIEW 7.1. If you think it is impossible in LabVIEW7.1, can LabVIEW 8.0 do the job? Thanks for your help in advance. Jane Att

  • Apple returns Ipod unrepaired without explaining why!!!

    Hey Ipod nano users! I just received an email from apple that my Ipod was being mistreated and therefor they are gonna send it back unrepaired! What can I do to get at least an explanation what I did wrong with my Ipod? And one more question: I alway