CustomTag reading a relative URI on the webserver

Hi All,
I am coding a CustomTag which reads a servlet(it resides on the same webserver) output and prints in the UI when this customtag is included in any jsp.
I am have some issues connecting to the servlet with relative URL. I can connect and get the servlet response by using
URL url = new URL("http://localhost:9080/buildMenu/");
URLConnection uc = url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream()));
The above code works perfectly fine and i am able read the response. But to make this generic (working on any port and even in other environments)
i am planning to reading using the relative path "/buildMenu" instead of full path. I was not able to find a way to do that. I would really appreciate if you
can point me in the right direction.
Thanks a lot.
Regards,
VJ

hi,
am not sure..
better you to try with
getRemoteAddr()
getRemoteHost()
to get your Ip and
add that into
URL url = new URL( getCurrentIPhere + "/buildMenu" );

Similar Messages

  • OSB invoking RESTful webservices:issue with relative-URI instead of

    Hi,
    We have a requirement where we need to pass the request content as string in the URL.
    we need to send the request in the URL like:
    http://abc.com/rest/xvf/nas<Employee><name>abc</name><empid>1234</empid>...<Employee>
    we have used a servicecallout action which is invoking a business service which has the base uri value like:
    http://abc.com/rest
    and in the insert action we are trying to appened the remaining uri in the rest command i.e
    <http:relative-URI>/xvf/nas{fn-bea:serialize($xmldata)}</http:relative-URI>
    here $xmldata is <Employee><name>abc</name><empid>1234</empid>...<Employee>
    while trying to invoke the service we are getting the error like:
    BEA-380000: General runtime error: Illegal character in path at index 36: http://abc.com/rest/xvf/nas& lt ; Employee>& lt ; name>abc& lt ; /name>& lt ; empid>1234>...& lt ; Employee>
    before to that we used fn-bea:inlinedXML and fn:bea:serialize functions on the retrieved xml and stored it into the xmldata variable and this variable is displaying the request in the proper xml file, but while appending it to the relative URI method the xml data is changing as like shown above i.e instead of < it is coming as & lt ; and at the end with out invoking the servie it is stoppeing at the OSB with the above error as illegal character, please advice..
    how to append the proper xml to the URL/URI in the relative-URI method in the proxy transport??
    as here it is coming & lt ; (combined with out space) as < i am changing it as like & lt ; for better understanding
    Thanks..
    Edited by: user12679330 on May 13, 2010 9:36 AM
    Edited by: user12679330 on May 13, 2010 9:40 AM
    Edited by: user12679330 on May 13, 2010 9:40 AM

    Not sure what you are trying to do but if I am not wrong, you are trying to use HTTP get with REST. You may refer -
    http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/httppollertransport/transports.html#wp1083292
    http://blogs.oracle.com/jeffdavies/2009/06/restful_services_with_oracle_s_1.html
    http://blogs.oracle.com/jamesbayer/2008/07/using_rest_with_oracle_service.html
    http://blogs.oracle.com/woa/2009/04/restify_your_world_and_put_it.html
    Regards,
    Anuj

  • Using relative-URI  in creating the REST based proxy service

    Hi,
    I am facing an issue when i am trying to create REST based proxy. i am looking at the urls given in the forum post Using Business Service that supports XML over HTTP in OSB
    I have created a conditional branch with xpath expression like *./ctx:transport/ctx:request/http:relative-URI/text()*
    and i am copying this value to $inbound as showin in the blog http://blogs.oracle.com/jeffdavies/2009/06/restful_services_with_oracle_s_1.html. But when i typed the uri in browser its saying xml parser error unable to find <.
    Not sure of the reason. If i modify my proxy to use http-method as shown in the blog its working fine and that too only when i copied ./ctx:transport/ctx:request/http:http-metho/text() to $inbound. But when i copied the same to another variable like branchcond, i am getting same parsing error. And Is it that the variable has to be always $inbound?  So what should be the variable name for using relativeURI
    And my uri is going to be like the following, thats why i am planning to create the conditonal branch on relative-uri.
    http:/localhost:8001/proxy/RESTbasedPS/getGreeting?name=23
    http:/localhost:8001/proxy/RESTbasedPS/getFullName?firstName=Some&lastName=Thing
    Any leads in above error will help me.
    Thanks
    Siva

    When i created the Conditonal branch, its asking for two mandatory properties. One is 'selected path' and the other is 'variable'. My scenario i am trying to base my conditional branch based on relative uri, so i have given './ctx:transport/ctx:request/http:relative-URI/text()' for 'selected path' variable and giving the value 'inbound' for 'variable' property of conditional branch.
    i was trying to do this in similar fashion as given in the blog http://blogs.oracle.com/jeffdavies/2009/06/restful_services_with_oracle_s_1.html, only thing is that i am using http:relative-URI rather http:http-method as shown in the blog.
    I am geting the following error in exact:
    XML Parsing Error: no element found
    Location: http://localhost:7001/proxy/RESTBasedPS/getGreeting?name=siva
    Line Number 1, Column 1:
    Please let me know if i am missing something or doing wrong with inbound variable.
    Thanks
    Siva

  • BPEL designer default relative URI when importing wsdl

    I'm using BPEL designer 10.1.3.1.0 The designer generated a reference service wsdl file "MyServiceRef.wsdl" that imports the service "MyService.wsdl" I intended to use.
    The import line reads like:
    <import namespace="http://my.namespace/" location="../public_html/WEB-INF/wsdl/MyService.wsdl"/>
    When deploying the BPEL project, I got error that "Failed to read wsdl", in which the deploying process looked for the wsdl file at location
    <BPEL HOME>\domains\default\tmp\.bpel_ProjectName_ff8d276f54525c078b0828ce6f764002.tmp
    I tried to modify the line to use the full URI to point to the correct location but it wouldn't compile. Can someone help point out what is wrong?
    Thanks,
    Wen

    1. The web service "MyService" was generated using BPEL designer's wizard: New -> Business Tier -> Java Web Services (There's one java class compiled within the project.)
    2. When I was adding the service into my BPEL flow, jdeveloper automatically generated the reference "MyServiceRef" as mentioned in the first post. This reference service imports MyService, at relative URI as correctly described in the import statement.
    3. Compiling the BPEL ->success
    4. Deploying BPEL, somehow it looks for MyService.wsdl at a wrong location
    MyService.wsdl
    <definitions
    name="MyService"
    targetNamespace="http://my.target/"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:tns="http://my.target/"
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    >
    <types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema">
    <import namespace="http://my.namespace/FlowName" schemaLocation="FlowName.xsd"/>
    </schema>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://my.target/"
    elementFormDefault="qualified" xmlns:tns="http://my.namespace/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/">
    <import namespace="http://my.namespace/FlowName" schemaLocation="FlowName.xsd"/>
    <element name="Demo_ServiceElement">
    <complexType>
    <sequence>
    <element name="String_1" type="string" nillable="true"/>
    <element name="String_2" type="string" nillable="true"/>
    </sequence>
    </complexType>
    </element>
    <element name="Demo_ServiceResponseElement">
    <complexType>
    <sequence>
    <element name="result" type="string" nillable="true"/>
    </sequence>
    </complexType>
    </element>
    </schema>
    </types>
    <message name="MyService_Demo_Service">
    <part name="parameters" element="tns:Demo_ServiceElement"/>
    </message>
    <message name="MyService_Demo_ServiceResponse">
    <part name="parameters" element="tns:Demo_ServiceResponseElement"/>
    </message>
    <portType name="MyService">
    <operation name="Demo_Service">
    <input message="tns:MyService_Demo_Service"/>
    <output message="tns:MyService_Demo_ServiceResponse"/>
    </operation>
    </portType>
    <binding name="MyServiceSoapHttp" type="tns:MyService">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="Demo_Service">
    <soap:operation soapAction="http://oracle.crm.dnbconnect//Demo_Service"/>
    <input>
    <soap:body use="literal"/>
    </input>
    <output>
    <soap:body use="literal"/>
    </output>
    </operation>
    </binding>
    <service name="MyService">
    <port name="MyServiceSoapHttpPort" binding="tns:MyServiceSoapHttp">
    <soap:address location="http://130.35.75.232:8888/QuickStartWrkspc-DnBFlow-context-root/MyServiceSoapHttpPort"/>
    </port>
    </service>
    </definitions>
    Error:
    #### Deployment incomplete. ####
    BUILD FAILED
    D:\work\jdevhome\jdev\mywork\QuickStartWrkspc\FlowName\build.xml:79: A problem occured while connecting to server "localhost" using port "8888": bpel_FlowName_1.0.jar failed to deploy. Exception message is: ORABPEL-05215
    Error while loading process.
    The process domain encountered the following errors while loading the process "FlowName" (revision "1.0"): Failed to read wsdl.
    Error happened when reading wsdl at "D:\product\10.1.3.1\OracleAS_1\bpel\domains\default\tmp\.bpel_FlowName_1.0_ff8d276f54525c078b0828ce6f764002.tmp\MyServiceRef.wsdl", because "Error reading import of file:/D:/product/10.1.3.1/OracleAS_1/bpel/domains/default/tmp/.bpel_FlowName_1.0_ff8d276f54525c078b0828ce6f764002.tmp/MyServiceRef.wsdl: Failed to read wsdl file at: "file:/D:/product/10.1.3.1/OracleAS_1/bpel/domains/default/tmp/public_html/WEB-INF/wsdl/MyService.wsdl", caused by: java.io.FileNotFoundException. : D:\product\10.1.3.1\OracleAS_1\bpel\domains\default\tmp\public_html\WEB-INF\wsdl\MyService.wsdl (The system cannot find the path specified)".
    Make sure wsdl exists at that URL and is valid.

  • Resolving relative URIs in MIDP 2.0 / CLDC 1.1

    Hi, all.
    Is there a method in MIDP 2.0 / CLDC 1.1 for resolving relative URIs against absolute URIs similar to J2SE's URI.resolve method?
    Thanks very much!

    ... or, given an open connection to a URI via the Connector class, is there a way to resolve a relative URI against that?

  • Configuring the CGI-Executables folder on the webserver

    would like to install w3perl for squid statistics on a MAC running 10.5, the folder in which to place the perl scripts is indicated as /Library/WebServer/CGI-Executables/w3perl, the scripts are already in this folder
    When i run the installation from the browser, I get an error
    The requested URL /w3perl/confstat.pl was not found on this server
    what could be the problem? the w3perl folder is in the CGI-Executables and the file confstat.pl is in the folder w3per;
    have I not defined the CGI executables folder properly? how do i know i have configured the CGI-executables properly

    If your script is in /Library/WebServer/CGI-Executables/w3perl/confstat.pl then the URL for that CGI would be:
    http://your.server.net/cgi-bin/w3perl/confstat.pl
    The URI needs the leading /cgi-bin in order for Apache to interpret it as a CGI request and route it to the CGI-Executables directory.

  • Help reading a .txt file from the hard drive....

    Hi guys,
    Ok... I need to know how to read a .txt file from the hard drive... I have an example on how to read from a disk, but I don't have a disk drive. I could be confusing terminology, but I don't think I am. Here is the code I have for reading from a disk.. please let me know how I should change it to read from a hard drive.
    Also, when the error pops up, it says that it can't read another .txt file that is not specified in the code... any ideas how that is occuring? Please advise.
    import java.io.*;
    public class TEST {
    public static void main(String args[]) throws Exception{
    FileReader fr = new FileReader("customer.txt");
    BufferedReader bfr = new BufferedReader (fr);
    String s;
    while ((s=bfr.readLine())!= null){
    System.out.println (s);
    fr.close();
    }

    Ok... I need to know how to read a .txt file from the
    hard drive... I have an example on how to read from a
    disk, but I don't have a disk drive. I could be
    confusing terminology, but I don't think I am. Here
    is the code I have for reading from a disk.. please
    let me know how I should change it to read from a
    hard drive.The code will be the same, regardless of where the file is located. It's just the filename that will be different.
    Also, when the error pops up, it says that it can't
    read another .txt file that is not specified in the
    code... any ideas how that is occuring? Please
    advise.Probably becuase the class file (compiled version of the source code) is a different version to the source code, i.e. the source code hasn't been recompiled since the source code was changed.
    How does this relate to EJBs?

  • MacBook Pro (Retina, 15-inch, Mid 2014) will not read an SD card in the SDXC card reader. Does anyone know whats going on?

    MacBook Pro (Retina, 15-inch, Mid 2014) will not read an SD card in the SDXC card reader. Does anyone know whats going on?

    Hi David.  I don't have as modern a Macbook Pro as you, mine is a 2012 model, but perhaps I can help.  I often find that my SD card will not load when I first insert it.  I have to remove it and then put it into the slot again firmly.
    You also haven't posted any information about the SD card.  What size is it, do you know how it is formatted, has it worked in that same mac previously, where did it come from, does it currently work in another device (such as your camera)?  This sort of information will help to narrow down the problem.
    If you post some more information I'm sure people will try to help you.  In the meantime, if you look at your post again you should see "More Like This" at the bottom of the page and you may find an answer in some of those related posts.
    Hope that helps.
    Ivan

  • How do I get Firefox to display the full URI in the address bar?

    I've seen this answer, but it doesn't fully fix the problem: https://support.mozilla.org/en-US/questions/951487
    When I look at the address bar, I want to see the actual URI of the page I'm on, not some mangled version of it. In other words, I want to see the address in the form that is valid in an <a/> tag in XHTML.
    Setting browser.urlbar.trimURLs to false fixes HALF of the problem, but not all of it. If I type in "http://example.com/filename%20with%20spaces.ext", I should see "http://example.com/filename%20with%20spaces.ext". However, I instead see "http://example.com/filename with spaces.ext". The "%20"s are converted into spaces, which are not valid in a real URI. How do I fix the address bar to show the real address of the page?
    EDIT: It seems to me that if someone sets the trim setting to false, the URI should not be trimmed in ANY way. This includes the shortening of %20 to a space character. Is this a bug?

    If it prevented the use of similar-looking characters, that would make sence, but it doesn't. Normally, the URI can only include ASCII characters. Any other character must be encoded. Due to this change, encoded characters are shown in their decoded form, CAUSEING URIs to be able to look like other URIs. Now that you mention it, this actually has the opposite effect as what you mentioned, and is actually a security problem. That's just one more reason why this issue should be fixed.

  • Can I insert the name poperty of the RequestedByUser related object of the parent Change Request workitem in a review activity email notification template?

    I am working on a SCSM change control workflow driven by email. 
    A lot of my work is based on the information found in this post:
    http://blogs.technet.com/b/servicemanager/archive/2012/04/03/using-data-properties-from-the-parent-work-items-in-activity-email-templates.aspx#pi158453=4
    This is an excellent post to which my Internet searches continually return. The workflow is about 90% complete. 
    My question is can I insert the properties of a related object of the parent workitem in a workflow email notification? 
    For example, I want to include the name property of the RequestedByUser related object of the parent workitem object in a review activity notification.

    Thank you for your reply.  I have confirmed my template is using a projection that includes the parent workitem and requested by user.  Where I am having trouble is the notification template syntax used to call the properties of the related
    object of the parent workitem.  The picker in the GUI won't show that related object, so I have no example to follow.  I hope this reply makes sense!

  • How to read XML file and update the data in MS CRM 2011?

    Hi Folks,
    Can anyone please help me finding some references to read XML files and push the data to MS CRM 2011 preferably by using a console application.
    Please let me know if any ways of handling it in simple ways.
    Thanks,
    Sri

    HI,
    How to read XML file:
    https://social.msdn.microsoft.com/Forums/en-US/5dd7261b-86c4-4ca8-ba87-95196ef3ba50/need-to-display-xml-file-in-textboxes-edit-the-data-and-save-the-new-xml-file?forum=csharpgeneral
    How to work with CRM:
    ClientCredentials credentials = new ClientCredentials();
    credentials.Windows.ClientCredential = new System.Net.NetworkCredential("USER", "Password", "Domain");
    Uri uri = new Uri("http://server/Organization/XRMServices/2011/Organization.svc");
    OrganizationServiceProxy proxy = new OrganizationServiceProxy(uri, null, credentials, null);
    proxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
    IOrganizationService service = (IOrganizationService)proxy;
    //using "service" you can create, update and retrieve entities.
    More information here about service functions:
    https://msdn.microsoft.com/en-us/library/gg328198.aspx

  • How to  fetch the relational  data from the xml file registered in xdb

    Hi,
    I have to register the xml file into the  xdb repository and i have to fetch the data of the xml file as relational structure  through the select statement .
    i used the below query to register the xml file in xdb.
    DECLARE
    v_return BOOLEAN;
    BEGIN
    v_return := DBMS_XDB.CREATERESOURCE(
    abspath => '/public/demo/xml/db_objects.xml',
    data => BFILENAME('XML_DIR', 'db_objects.xml')
    COMMIT;
    END;
    Now i have to fetch the values in the xml file as relational data .
    whether it is possible ?
    can any one help me.
    Regards,
    suresh.

    When you transform your XMLdata to a xmltype you can do something like this for example:
    select
    extractvalue(value(p),'/XMLRecord/Session_Id') session_id,
    extractvalue(value(p),'/XMLRecord/StatementId') StatementId,
    extractvalue(value(p),'/XMLRecord/EntryId') EntryId
    from
    table(xmlsequence(extract(xmltype('
    <XMLdemo>
    <FormatModifiers><FormatModifier>UTFEncoding</FormatModifier></FormatModifiers>
    <XMLRecord>
    <Session_Id>117715</Session_Id>
    <StatementId>6</StatementId>
    <EntryId>1</EntryId>
    </XMLRecord>
    </XMLdemo>
    '),'/XMLdemo/*'))) p
    where extractvalue(value(p),'/XMLRecord/Session_Id') is not null;
    For this sample I've put a readable XML in plain text and convert it to xmltype so you can run it on your own database.

  • Jnlp interpreted by the client or the webserver ?

    Hello there,
    I just want to clear this up - Is the .jnlp file sent to the client (where web start will inspect it) or by the webserver ?
    So, when the jnlp file is made to point to a particular applet etc., will the webserver look at the jnlp and forward the applet (based on the location tag), or will the client be passed the jnlp (where it will inspect the location) and load the applet.
    I would like web start to pick up a jar stored locally on the client, but no sure whether this is possible using a "localhost" location.
    Thanks,
    Michael Dodsworth.

    The jnlp is read by the client. You can load a jnlp off a filesystem, the server doesn't need to be involved unless you want it to automatically the hostname.

  • Custom tag or help in reading an image file into the HTTP stream

    Since under WL we do not deploy our app physically there is no physical
              directory to write our dynamic images to (via kavachart).
              I can call their bean with:
              response.setContentType("image/png");
              ServletOutputStream output = response.getOutputStream();
              but that only allows the image back not the housing page. I can use an
              iframe but there are other issues and was wondering if anyone has idea on a
              custom tag the can easily read a physical directory outside of WL's space
              and include an image file in the http stream. Our app server and webservers
              are in separate zones so I can not just write to some virtual directory on
              the webserver and then serve it up w/ a simple <img> tag.
              BTW Kavachart has some tags referred to in their thin doc but I did not have
              good luck w/ their suggestions.
              Thanks in advance.
              dmg
              [email protected]
              

    Hi joe.com,
    Thanks for the response. It's greatly appreciated. Actually, I'm trying to run this on an Nokia SDK (s80 emulator) and eventually a windows mobile emulator.
    I was wondering if the JSR is the problem. I'm currently using jsr 62 and I'm thinking of trying to 216 to get PP 1.1. I'm wondering if 62 maybe limiting file io?
    any help is appreciated.

  • How do I make document relative links for the site?

    How do I make document
    relative links for the site -
    <img src="../images/foo.gif"... (for example)?

    > How do I make document
    > relative links for the site -
    look in the bottom of the "browse to file" dialog box.
    Alan
    Adobe Community Expert, dreamweaver
    http://www.adobe.com/communities/experts/

Maybe you are looking for

  • Creating a photo gallery like the China Gallery in Adobe Labs. How?

    I have photos in several categories (I'll use 2, "frank" and "wolfie" as examples here). What I'd like to do is build a photo gallery like the China Photo Gallery shown in the Adobe Labs site, where the user can switch between categories without goin

  • Sudden Media Card error..?

    Hello everyone. For the past few weeks, my media card in my BB 8900, which has been working fine before this suddenly started, has now been displaying the following error message whenever I unplug it from my wall-charger or my USB connection cord tha

  • Associate music files to more than one album

    Come on Apple, make a music file format that you can add the track to more than one album. E.G. Track 1 - Album 1               Album 2               Album 3 You would make peoples lives a lot easier, who want ti sort their library & not have duplica

  • Iphone 5 won't start

    Hi, I purchased an iPhone5 in a NYC Apple store 6 months ago. This past weekend for no reason it suddenly turned all bluescreen at first, and later just won't start anymore. What should I do to fix it? Is it still returnable for refund to any Apple s

  • Increase LiveCache Size

    Hello, I would like to increase the size of our LiveCache and would like to know how to proceed. Is it as simple as changing the parameter CACHE_SIZE to the new value (i would like to increase the size from 6Gb to 12Gb) and be sure that I have enough