Getting the HTTP server name, port and context name inside the init()

I have a servlet which is initialized when the Web server comes up. Is there any way I can print the complete URL from this servlet?
I am aware that this can be done by using request object. But note that in this case, there is no request object. All we have is the ServletConfig and ServletContext.
Pasting a part of my code here.
public class MyInit extends HttpServlet
private ServletContext m_servletContext = null;
public void init(ServletConfig config) throws ServletException
super.init(config);
m_servletContext = config.getServletContext();
//System.out.println("Print the URL here...")
}

Only a request has a URL. It's possible for servlets to be mapped to respond to more than one URL, and the server can be configured to respond to more than one host and at more than one port. So none of those things you are asking for have any meaning without an actual request.

Similar Messages

  • Difference between HTTP Server port and HTTP Server listen port

    Hi,
    What's the difference between the following?
    Oracle HTTP Server port = 7780
    Oracle HTTP Server listen port = 7781
    They are the ports used in my 9ias 9.0.3 instance.
    Please advise.
    Thank you.

    Hi,
    The server port, 7780, is port where HTTP server response and listen ports are other ports tha HTTP Server can listen. In IAS, the default configuration, the server port is response for Web Cache and Web Cache connect with HTTP Server in listen port.
    Marcio Mesti

  • No Http server on port 8080 with 10g Express Edition ( TNS-12631 error)

    I downloaded the Oracle 10g Express Edition for Microsoft Windows and tried to install the software on 3 pcs.
    2 pc works but mine is not working.
    All works well during installation but when I want to connect to the home web page, it displays error (http://127.0.0.1:8080/apex)
    It isnormal because I have no process running under 8080 port.
    But I don't know why there is not an http server on port 8080.
    netstat -a :
    Connexions actives
    Proto Adresse locale Adresse distante Etat
    TCP LABOLLC:epmap LABOLLC.castel.fr:0 LISTENING
    TCP LABOLLC:microsoft-ds LABOLLC.castel.fr:0 LISTENING
    TCP LABOLLC:1521 LABOLLC.castel.fr:0 LISTENING
    TCP LABOLLC:42510 LABOLLC.castel.fr:0 LISTENING
    TCP LABOLLC:1051 LABOLLC.castel.fr:0 LISTENING
    TCP LABOLLC:1255 LABOLLC.castel.fr:0 LISTENING
    TCP LABOLLC:1291 localhost:1292 ESTABLISHED
    TCP LABOLLC:1292 localhost:1291 ESTABLISHED
    TCP LABOLLC:netbios-ssn LABOLLC.castel.fr:0 LISTENING
    TCP LABOLLC:1338 messagerie.castel.fr:1026 ESTABLISHED
    TCP LABOLLC:1342 messagerie.castel.fr:1390 ESTABLISHED
    TCP LABOLLC:1355 messagerie.castel.fr:1026 ESTABLISHED
    TCP LABOLLC:1359 messagerie.castel.fr:1390 ESTABLISHED
    TCP LABOLLC:1472 messagerie.castel.fr:epmap TIME_WAIT
    TCP LABOLLC:1473 messagerie.castel.fr:1026 TIME_WAIT
    UDP LABOLLC:microsoft-ds *:*
    UDP LABOLLC:isakmp *:*
    UDP LABOLLC:1027 *:*
    UDP LABOLLC:1339 *:*
    UDP LABOLLC:1340 *:*
    UDP LABOLLC:1356 *:*
    UDP LABOLLC:1357 *:*
    UDP LABOLLC:1427 *:*
    UDP LABOLLC:4500 *:*
    UDP LABOLLC:ntp *:*
    UDP LABOLLC:1028 *:*
    UDP LABOLLC:1062 *:*
    UDP LABOLLC:1900 *:*
    UDP LABOLLC:ntp *:*
    UDP LABOLLC:netbios-ns *:*
    UDP LABOLLC:netbios-dgm *:*
    UDP LABOLLC:1900 *:*
    UDP LABOLLC:42508 *:*
    The file sqlnet.log contains the following comments :
    Fatal NI connect error 12631, connecting to:
    (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
    VERSION INFORMATION:
         TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
         Oracle Bequeath NT Protocol Adapter for 32-bit Windows: Version 10.2.0.1.0 - Production
    Time: 08-MARS -2007 16:28:39
    Tracing not turned on.
    Tns error struct:
    ns main err code: 12631
    TNS-12631: Echec de recherche de nom
    ns secondary err code: 0
    nt main err code: 0
    nt secondary err code: 0
    nt OS err code: 0
    I don't know what to do !!
    Help

    Yes i Check all that.
    For example, I have Tomcat installed on my PC and I can launch it easily.
    So that means that port 8080 is completly free.
    No I haven't http service as you can see with netstat results.
    Lokk at the log sqlnet.log, I have following :
    Fatal NI connect error 12631, connecting to:
    (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
    VERSION INFORMATION:
         TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
         Oracle Bequeath NT Protocol Adapter for 32-bit Windows: Version 10.2.0.1.0 - Production
    Time: 09-MARS -2007 14:46:35
    Tracing not turned on.
    Tns error struct:
    ns main err code: 12631
    TNS-12631: Echec de recherche de nom
    ns secondary err code: 0
    nt main err code: 0
    nt secondary err code: 0
    nt OS err code: 0
    Thanks

  • As9i R2 Oracle HTTP Server at Port 80

    I installed the Application Server 9i R2 , but would like to make the Port 80 to be the Standard Port of the Application Server
    already it is Port 7777 or 7778 as Standard !
    what can i do ??
    thanx :)

    You can do it with Oracle Enterprise Manager Web. Point your web browser to
    http://<application server>:1810
    Login with username "ias_admin" and password that was set during installation.
    Then you should select your Oracle Application Server instance under "Standalone Instances".
    You will get "System Components" list, just click on "HTTP Server".
    On next page, select Server Properties under "Administration".
    If you are using web cache, you should change only listening port to 80, and if you don't change also default port.

  • How to get orchestration instance server name

    I have two server where orchestration can run...I need to know the server name where my orchestration instance has run.
    How to get this information...

    When you have more than one BizTalk-processing server and if your orchestration is bound to host instance which exist in more than one server (generally for better resilience, the best practice
    is to have multiple instances of host in different servers), the idea of get the server name where Orchestration instance has run is INVALID.
    With the BizTalk features like scalability, resilience and persistence points an Orchestration instance could run in more than one server.
    For example due to persistence points, if that BizTalk server were to suffer a power outage, another BizTalk server could continue the orchestration from the checkpoint rather than having
    to start the orchestration from the beginning. Or during or during long-running process while waiting for a response, then message being consumed by an orchestration instance would be persisting the in-memory representation of an orchestration (to its last
    good state) and any associated messages in BizTalk MessageBox. So when the response comes back the rest of the part of orchestration could execute from other server instance. So an orchestration would not always run from one server.
    But if you have specific “Expression shape” which you may have been using for logging/tracing then you can get the server name which executed that particular “Expression shape” from an Orchestration
    instance (not the whole Orchestration instance). This is done using the standard .NET code to get the server name -
    System.Environment.MachineName
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Problem trying to get Indesign CC Server Trial up and running on my server.

    ive read up a bit on this and its suggest doing a command line script in windows but i get the error " Adobe InDesign Server is not properly licensed and will now quit" - does anyone have a solution ??
    any help appreciated - ive been through the threads but to no avail. the adobe_prtk.exe  give me an response of "1" after i run it.
    please help
    thanks
    CG

    Hi csgraham74,
    What operating system you are working and What version of IDS you have.
    Please confirm the commnad you using(without serial number) to license InDesign Server using Adobe Provisioning TooolKit for Enteerprise Edition(APTEE).
    Make sure you are not having any typo.
    Please find the online documentation on “Release notes InDesign Sever CS6”.
    http://helpx.adobe.com/indesign/release-note/indesign-server-cs6-release-notes.html#id_277 82
    This documentation involves the instruction on how to activate license of InDesign Server CS6 using additional method
    When you are facing licensing issue. 
    You need to follow the instructions provided in “Activate Trial using APTEE”.
    Hope this helps.
    Please let me know in case of any problem.
    Regards,
    Sumit Singh

  • HTTP Server - change port 7777 to 80

    Hi all!
    I have installed, in Linux_x86 (Enterprise Linux), a database 10.2.0.1, the HTTP Server from companion CD and the Apex 2.2.1.
    I want to change the default port of HTTP Server 7777 to the port 80.
    For that I change the httpd.conf:
    port:80
    listen:80
    then I follow the manual of administration of HTTP Server and I done:
    as root - chown root .apachectl
    chmod 7560 .apachectl
    I change again to user oracle and I tried to restart the HTTP Server but i can't.
    error:
    RCV: Permission denied
    Communication error with the OPMN server local port.
    Check the OPMN log files
    Now, I only can start the HTTP Server with the user root.
    Is that normal? I missed something?
    And now I can access the page of the http server but i can´t reach the Apex - when I write http://hostname/pls/apex - the browser change it to http://hostname/pls/apex/apex and gives the following error:
    Service Temporarily Unavailable
    The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
    Oracle-Application-Server-10g/10.1.2.0.0 Oracle-HTTP-Server Server at oracle.com.pt Port 80
    Thank you in advance,
    CD
    Message was edited by:
    user524118

    Hi,
    I have a similar problem.
    Could you please write down how you solve your problem.
    regards,
    Mzz

  • Need Oracle HTTP Server for mod_plsql and link to download software

    Hi all,
    I want to use mod_plsql to publish HTML from the database.
    Therefore, I need an Oracle HTTP Server with mod_plsql.
    I have installed the "Oracle HTTP Server with Apache 2.0 10.1.3.1", but there is no mod_plsql included! The welcome page refers to a "Oracle HTTP Server Standalone Administrator's Guide Based On Apache 2.0" which is not installed and can' t be found on OTN.
    Can someone give me a link to Oracle HTTP Server installation software which includes mod_plsql?
    Any hints are welcome!
    Thanks, Markus

    Based on the version of the database, you could use the listener from that - the same XML DB uses. That would not require an application server install at all.
    Alternative: the mod_plsql replacement cartridge off Tom Kyte's site: asktom.oracle.com. Source only - compile against your preferred Apache

  • New HTTP server = ugly look and feel.   Why?

    My DBA switched the HTTP server to a different host (although the HTMLDB database did not change locations). Now all my HTMLDB application screens look ugly. The font and colors have changed and the borders around the report headers are missing. The application did not change, so I assume there is come configuration file on the HTTP server that is different. Can anybody tell me what configuration file we should be looking at?

    Marvel conf points to "images" directory that don't exists. js files should also not work!!
    Copy that dir and reconfig mentioned file.
    P.S.
    Hope the Oracle HTTP is the same??? If not then read configuration that should be made for Apache.

  • Installing Oracle HTTP Server after installation and configuration.

    Hello,
    I am using EPM 11.1.2.2 and I have installed Essbase, FR, EAS and EIS but not Oracle HTTP server component.
    Is it possible to install it after completion of deployment of whole Hyperion components?
    If I install only HTTP component of foundation service and reconfigure Web server will that work without an issue?
    Or do I need to reinstall all components?
    And, as in EPM 11.1.2.2 for installing Essbase only, Oracle HTTP server is not mandatory, can I skip that component?
    Will that make any impact in future?
    Thanks,

    You can install OHS after you have completed the configuration, install, then configure web server and select OHS.
    It is up to you whether you install and use OHS as the web server, it is not mandatory. If you are using workspace then you will need to configure one of the available web servers.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • 10g Express Edition install doesn't start HTTP server on port 8080

    I've just done (several) installs of 10g XE on a Windows XP (SP2) box which appears to install correctly, but there's nothing listening on port 8080 (which is available)
    The services OracleServiceXE and OracleXETNSListener are both started (and can be stopped/restarted too).
    Looking in C:\oraclexe\app\oracle\product\10.2.0\server\config\log\postDBCreation.log (and other log files in that directory), I see some worrying lines like this:
    SQL> connect "SYS"/"&&sysPassword" as SYSDBA
    ERROR:
    ORA-12638: Credential retrieval failed
    Also running SQLPLUS from a CMD window fails:
    C:\oraclexe\app\oracle\product\10.2.0\server\BIN>sqlplus sys
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 19 15:31:59 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Enter password:
    ERROR:
    ORA-12638: Credential retrieval failed
    I already have some Oracle client software installed, PL/SQL developer 7.0.1.1066.
    ORACLE_HOME is not set.
    Is there an installation log file I can examine that might indicate what's gone wrong?
    Tony.

    Interesting error. See http://oracle-unix.blogspot.com/2007/08/ora-12638-credential-retrieval-failed.html for a blog entry (and workaround).
    As for the 8080 web connection failing, I assume that this is related - the listener unable to hand off the web browser request to the Dispatcher.
    Also note that by default it only listens on localhost port 8080. So using the hostname or IP of your machine won't work until that default config is changed.

  • How to get default SMTP server name

    Hi,
    I want to know the name default SMTP server configured in machine. How i can get this through my java code.
    Help me on this

    You can find STMP server configured in hostname, in ask to dns of domain who is mailserver, you need to find MX records :
    - look a DNS config : NS (name server) , CNAME (Alias) , MX (mailexchange) etc...
    import java.util.ArrayList;
    import java.util.Hashtable;
    import javax.naming.*;
    import javax.naming.directory.*;
    public class MXLookup
         public static void main(String args[]) throws NamingException
              System.out.println(getMX("altern.org") + " mail servers");
         private static ArrayList getMX(String hostName) throws NamingException
              // Perform a DNS lookup for MX records in the domain
              Hashtable env = new Hashtable();
              env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");
              DirContext ictx = new InitialDirContext(env);
              Attributes attrs = ictx.getAttributes(hostName, new String[] { "MX" });
              Attribute attr = attrs.get("MX");
              // if we don't have an MX record, try the machine itself
              if ((attr == null) || (attr.size() == 0))
                   attrs = ictx.getAttributes(hostName, new String[] { "A" });
                   attr = attrs.get("A");
                   if (attr == null) throw new NamingException("No match for name '" + hostName + "'");
              ArrayList res = new ArrayList();
              NamingEnumeration en = attr.getAll();
              while (en.hasMore())
                   String x = (String) en.next();
                   String f[] = x.split(" ");
                   if (f[1].endsWith(".")) f[1] = f[1].substring(0, (f[1].length() - 1));
                   res.add(f[1]);
              return res;
    }

  • Problems with server license ports and firewall in 2005 B

    I found problem in 2005 B related license server.
    The customer wants to use the windows firewall for security issues and opened TCP/IP and UDP port for 30000.
    Also The customer is using NAT(Network Address Translation) for mapping internal IP and outdoor IP.
    But customer got a error message can't access license server.
    I heard about 2005 A SP01 had similar problem.
    If you have relevant experience please let me know your opinion.

    Hi,
    Theory says that license service´s new approach using CORBA is better becouse it only uses port 30000 for licencing issues... but in our case this wasn´t true becouse it does use some virtual ports. Due to this, we had to disable windows firewall on the server in order to make SBO work. As the other virtual port are asigned in runtime, you cant use the firewalls exceptions (not even the application ones).
    What we firstly do was use a net tool to identify which virtual ports was using, and add them to the exceptions. But as you can guess, this only works untill the license server is restarted.
    SAP told us that the firewall couldn´t be on the license server machine. The customer wasn´t very pleased, but that´s what we finally do. We didn´t find any other option.
    Regards,
    Ibai

  • Generic server name, port, context for deployment

    I need to move my application onto the server for deployment.
    Up til now, I have been running a server using localhost for my
    app. But I need to get the context root and run from there. I tried
    using @ContectRoot but it did not give me the server. Here is a
    snippet from the code? How do I do this?
    // on the deployment I need to replace localhost with server
    name, port, and context root
    public var dbURL:String = "
    http://localhost:8888/proj/loader";
    <mx:HTTPService id="sysOps" useProxy="false" method="GET"
    fault="handleFault(event);" url="{dbURL}"/>

    Only a request has a URL. It's possible for servlets to be mapped to respond to more than one URL, and the server can be configured to respond to more than one host and at more than one port. So none of those things you are asking for have any meaning without an actual request.

  • Customizing server.name and server.port in services-config.xml

    Hi
    How can i find out what does BlazeDs use for server.name and server.port in
    url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"
    can i customize those values?
    thank you

    Mete
    Thank you for your reply
    So context.root is resolved at compile time and server & port at runtime
    Do you have an example or a link that shows / explain how to create custom tokens replaced by JVM options?
    I have an issue where if i install my app on http://www.mydomain.com/mycontext/, it loads but will display the following message when making server call using Safari
    FAULT: faultCode:Client.Error.MessageSend faultString:Send failed faultDetail:Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: http://www.mydomain.com/context/messagebroker/amf
    Notte that it works on IE7 when accessing http://www.mydomain.com/mycontext/
    and that it works great with all browsers on http://localhost:8080/mycontextroot
    Would you know what is the best way to debug this issue?
    Thank you
    matt

Maybe you are looking for

  • How to display the column names of a table in the output

    Hi, I want to display the name of the columns of the table without using literals in a abap report. EX: Consider the table KNA1 KUNNR NAME  ADDRESS I want to display the column names in the above fashion without using hardcoded write statements. Than

  • How to generate a pdf file using javascript?

    I would like to generate a pdf file having images in it using javascript. I tried jsPDF but getting some exceptions like Uncaught ReferenceError: pageWidth is not defined, fail to load pdf document Could anyone show me some pointers? Thank You Rahul

  • Calculation in Time field

    Need to calculate values of A & B Formula -> A = Round down [A_TIME - A_STD] B = Round up [A_TIME) - 10 minute + A_STD] where A_TIME     VARCHAR2(8)     N     Time           (Format" HH:MM AM/PM")      eg "3:50 PM" A_STD     VARCHAR2(5)     N     Sta

  • My CD drive isn't working?

    I was going to insert a regular CD to burn music onto my computer and the drive took the disc in, made a funny sound, and ejected it. I retried and this time is was sort of resistant to take the disc in. I've tried all the trouble-shooting and restar

  • What is the correct channel for submitting bug reports on nightly builds?

    I am using the nightly build channel of Firefox. I would love to help with development by sharing my experiences. Unfortunately, I can't figure out where I'm supposed to report bugs. The "Firefox made me sad" form is completely worthless because of t