How to get a virtual host name from application in Tomcat?
Hi,
Is it possible to obtain the context path and virtual host name at the application (.war file) initialization stage?
I need to set up these info into my application config table.
Thanks
I think it is impossible. It seems the application has no access to the host configuration which it is running in.
Similar Messages
-
How to get list of file names from a directory?
How to get list of file names from a directory?
Please helpIn addition, this:
String filename = files;Should be this:
String filename = files;
That's just because he didn't use the "code" tags, so [ i ] made everything following it become italicized. -
How to get customer number and name from the SD document
Hi All,
Can you please let me know how to get Customer Number and Name from the SD Document?
Thanks a lot....
AnilHi,
It will be displayed in the SD (BIlling document) itself, you clikc on the VF03. The customer name and number will also appear in the SO document also Tcode VA03
regards,
radhika
Edited by: kolipara radhika on Jul 10, 2009 5:32 AM -
How to get the Portal Page name from PLSQL?
Can anyone tell me how to get the portal page name from my dynamic page using plsql?
Apparently you can get the page id and work it out from there, but my calls to get the page id are not returning any values anyway.
My code for attempting to get the page id is below.
<oracle>
declare
v_pageid varchar2(30);
begin
v_pageid := wwpro_api_parameters.get_value('_pageid', '/pls/portal30');
htp.print('Page is '|| v_pageid);
end;
</oracle>
Ideally I'd actually just like to get the page name. Is there a straightforward way to do this?
Thanks in advance!
SarahFew clarifications -
1. wwpro_api_parameters cannot be used to get default portal
page parameters such as '_pageid', '_dad', '_schema' etc.,
2. Page information can be obtained through any components which
are available in that particular page. For example, in case of
dynamic page, we need to publish it as a portlet and add it to the
page. This process creates necessary packages in the DB, but we
will not have access to the portlet methods.
So, I would prefer creating a simple DB provider & portlet and access
page title from its show method as follows -
//Declare local variable l_page_id, l_page_title as varchar2
select page_id into l_page_id from wwpob_portlet_instance$ where
portlet_id = p_portlet_record.portlet_id and
provider_id = p_portlet_record.provider_id;
select name into l_page_title from wwpob_page$ where id=l_page_id;
More information on DB provider can be found at
http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/PDK/articles/understanding.database.providers.html
Secondly, usage of wwpro_api_parameters.get_value method is
incorrect. This method expects two arguments -
<ul>
<li><b>p_name : </b> The name of the parameter to be returned.</li>
<li><b>p_reference_path : </b> An unique identifier for a portlet instance on the current page.</li>
</ul>
p_reference_path would be something like 99_SNOOP_PORTLET_76535103 and not some type of path as its name suggests.
The following code fragment fetches all parameters available
for a portlet.
Note : Copy this code into 'show' method of your portlet.
//Declare l_names, l_values as owa.vc_arr
* Retreive all of the names of parameters for this portlet
l_names := wwpro_api_parameters.get_names(
p_reference_path=>p_portlet_record.reference_path);
* Retreive all of the values of parameters for this portlet
l_values := wwpro_api_parameters.get_values(p_names=>l_names,
p_reference_path=>p_portlet_record.reference_path);
//Loop through these arrays to get parameter information
htp.p('<center><table BORDER COLS=2 WIDTH="90%" >');
htp.p('<tr ALIGN=LEFT VALIGN=TOP>');
htp.tableData(wwui_api_portlet.portlet_heading('Name',1));
htp.tableData(wwui_api_portlet.portlet_heading('Value',1));
htp.tableRowClose;
if l_names.count = 0 then
htp.p('<tr ALIGN=LEFT VALIGN=TOP>');
htp.p('<td COLSPAN="2">'
||wwui_api_portlet.portlet_text(
'No portlet parameters were passed on the URL.',1)
||'</td>');
htp.tableRowClose;
else
for i in 1..l_names.count loop
htp.p('<tr ALIGN=LEFT VALIGN=TOP>');
htp.tableData(l_names(i));
htp.tableData(l_values(i));
htp.tableRowClose;
end loop;
end if;
htp.p('</table></center>');
Hope it helps...
-aMJAD. -
How to get the actual font name from a font file?
Hi
I have only the font Path I have to get the font name from that path. Any idea how to get the actual font name?
Thanks,I would ask you these questions:
Why do you need to do this? What are you ultimately trying to accomplish?
Are you really asking about the InDesign SDK?
Do you really need to get the "name" of a font from an arbitrary file? Or do you want information about a font installed on the system? If so, what OS?
Do you need to be able to handle any font format?
Which font "name" do you mean?
What language do you want the name in?
(1) It's not clear what you're trying to accomplish. A bit more information about your ultimate goal would be helpful.
(2) This question is not at all specific to the InDesign SDK. Are you really trying to do something in the context of an InDesign plug-in? If so, you probably want to look at IID_IFONTFAMILY and the IFontFamily::GetFamilyName function.
(3) If you are asking more generally, Windows and Mac both have system API calls to get this information, although those tend to deal with installed system fonts, not with arbitrary font files per se.
Also, you can parse the name table from a True Type or Open Type font without using any system APIs; as True Type and Open Type are well-documented standards. I would start by reading these:
The Naming Table
Font Names Table
(4) Although there are other standards, such as Type 1 (PostScript) fonts, and True Type Collection files and other formats, especially on Mac.
(5) Also, when you start down this road, you will quickly realize that your seemingly simple question is actually ambiguous, and that the answer is kind of complicated, because a font can have many names (a family name, a full font name, a style name, a PostScript name, etc.).
(6) And not only does a font have multiple names, it can have each of those names in multiple languages and encodings.
Any clarification would make this a better question. -
How to get the failover partner name from C++ client
Hi All,
I have configured the mirroring session for my application.
I want to modify the connection string with failover partner name.
Could any one please let me to know how to get the failover partner instance from C++ client dynamically.
Thanks,
Prasad.Are you looking for this?
http://www.connectionstrings.com/sql-server-2012/
http://stackoverflow.com/questions/25534972/auto-failover-multiple-connections-to-mirror-database-when-principal-goes-down -
How to get Driver and url names from a connection pool
Hi,
How to get the DriverName and URL from an existing pool, If I know the name of
connection pool ? Is it possible to know the name of related pool , if I know
the name of datasource?
Thx
Manishhi
there are 2 ways:
url must be: jdbc:weblogic:pool[:connectionPoolID]
or
jdbc:weblogic:jts[:connectionPoolID] (if you want to use jts with your JDBC connection.)
see http://e-docs.bea.com/wls/docs60//javadocs/weblogic/jdbc/pool/Driver.html
However, I think it is safer to configure and use DataSource to get connection.
Nicolas
"kumar" <[email protected]> wrote:
>
Hi,
How to get the DriverName and URL from an existing pool, If I know the name
of
connection pool ? Is it possible to know the name of related pool , if I
know
the name of datasource?
Thx
Manish -
How to get Service instance host name(s)
I have a a list of Cloud Service host names that are connected to our azure DB
host_name
RD00133D57C3B2
RD00133D80CF2E
RD00133D52C765
RD00133D52CE41
RD00133D52C926
But i have no idea how to tell which cloud services those are.
Get-AzureService, Get-AzureRole & Get-AzureDeployment are not returning this data.On one hand, as according to
http://msdn.microsoft.com/en-us/library/ms176013.aspx, you shouldn't rely on that hostname due to some security mechanisms that are in place.
Content not found
We could not find the page you requested.
On the other hand though, you can also configure your own hostname for your VMs in the .csfg file, as according to
http://msdn.microsoft.com/en-us/library/windowsazure/jj156072.aspx. However, I'm not 100% positive whether .NET Framework will use the configured hostname as the exposed hostname
to SQL. You might give it a try though ;)
Server Error in '/' Application.
So there is no way to reverse out that Hostname from the instance with powershell? -
Getting OS X Host Name from Cambia
We would like to configure our OS X workstations to return their hostnames when scanned with Cambia (network monitoring software). Cambia uses netbios, tcp probes, dns lookup and nmap to discover the identity of nodes on the network. Can anyone tell me how to configure OS X to return its host name when Cambia does a scan??
I know netbios is a no-go, but I manually set the host name in the /etc/hostconfig file in the hope that would do it. It doesn't.
Is there a setting or software that would return the hostname via an nmap probe????
Bob ReedWe would like to configure our OS X workstations to
return their hostnames when scanned with Cambia
(network monitoring software). Cambia uses netbios,
tcp probes, dns lookup and nmap to discover the
identity of nodes on the network. Can anyone tell me
how to configure OS X to return its host name when
Cambia does a scan??
If you run your own DNS servers, macs that use DHCP will set thier names in the DHCP request, so you should get it from there.
Are your Macs using DHCP ? Do you run your own internal name server ?
Is there a setting or software that would return the
hostname via an nmap probe????
Bob Reed -
How to get the pull path name from a file upload window
Hello everyone!
I have encountered the following problem with the following JSP code:
<form method="post" action="filename.jsp">
Upload JAVA program:
<input type=file size=20 name="fname" accept="java">
<input type=submit value="go">
</form>
<%
String s = "";
if (request.getParameter("fname") != null)
s = request.getParameter("fname")
%>
The value of s is alway the filename. However I want to get the full path in addition to the filename, so that I can read the file. Does anyone know how to get the pull name of the file?
thanks a lot in advance,Dear Sir,
thanks a lot for your reply. Please let me explain what I intended to do: I want to upload a file from the local machine and then read the content of the file. Therefore I need to the fullpath of the filename like /var/local/file.java instead of file.java. The latter is what I got.
The problem I have with your code is that the function like "request.getServerScheme()" is not recognized. Maybe is it because I didn't install servelet package? I only installed javax package btw. Also my application runns on Tomcat server if this could give you some information. The error message I had is as follows:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 36 in the jsp file: /addExercise.jsp
Generated servlet error:
[javac] Compiling 1 source file
/usr/local/jakarta-tomcat-5.0.12/work/Catalina/localhost/tutor/org/apache/jsp/addExercise_jsp.java:133: cannot resolve symbol
symbol : method getServerScheme ()
location: interface javax.servlet.http.HttpServletRequest
url = request.getServerScheme()
^
An error occurred at line: 36 in the jsp file: /addExercise.jsp
Generated servlet error:
/usr/local/jakarta-tomcat-5.0.12/work/Catalina/localhost/tutor/org/apache/jsp/addExercise_jsp.java:136: cannot resolve symbol
symbol : method getServerScheme ()
location: interface javax.servlet.http.HttpServletRequest
+ ((("http".equals(request.getServerScheme()) && request.getServerPort() != 80)
^
An error occurred at line: 36 in the jsp file: /addExercise.jsp
Generated servlet error:
/usr/local/jakarta-tomcat-5.0.12/work/Catalina/localhost/tutor/org/apache/jsp/addExercise_jsp.java:137: cannot resolve symbol
symbol : method getServerScheme ()
location: interface javax.servlet.http.HttpServletRequest
||("https".equals(request.getServerScheme()) && request.getServerPort() != 443))
^
An error occurred at line: 36 in the jsp file: /addExercise.jsp
Generated servlet error:
/usr/local/jakarta-tomcat-5.0.12/work/Catalina/localhost/tutor/org/apache/jsp/addExercise_jsp.java:139: cannot resolve symbol
symbol : method getServletConfig ()
location: interface javax.servlet.http.HttpServletRequest
+ "/" + request.getServletConfig().getServletName()
^
An error occurred at line: 36 in the jsp file: /addExercise.jsp
Generated servlet error:
/usr/local/jakarta-tomcat-5.0.12/work/Catalina/localhost/tutor/org/apache/jsp/addExercise_jsp.java:140: cannot resolve symbol
symbol : variable path
location: class org.apache.jsp.addExercise_jsp
+ "/" + path
^
5 errors
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:128)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:413)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:437)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:555)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856) -
How to get the long file name from an 8.3 name in Windows.
Because of a legacy string limitation, I have a list of files in 8.3 format. The actual files are saved with long names. How can I get the long name from the short name?
In JavaScript, I would get a file system object and get the file object from there with the short name. Then it's no problem to get the full name. But I don't see anything in Java that matches that. ???
Ideas?
Frank Perry, MSEEHere is what I did.
String displayName = "somefi~1.txt";
File fO = new File("c:\\"); // I have a more involved path but that's not important here.
String stPath = fO.getPath() + displayName;
File fD = new File(stPath); // get the file using the short name.
File fDc = new File(fD.getCanonicalPath()); // get another file using the cononical name
String FulldisplayName = fDc.getName(); // get the long name from there.
It's roundabout but it works. Since getName() on the file read with the short name only returns the name used to get the file, I open it twice. The alternative is to parse the cononical name for the file name but that's clumbsy too.
Frank -
How to get the target file name from an URL?
Hi there,
I am trying to download data from an URL and save the content in a file that have the same name as the file on the server. In some way, what I want to do is pretty similar to what you can do when you do a right click on a link in Internet Explorer (or any other web browser) and choose "save target as".
If the URL is a direct link to the file (for example: http://java.sun.com/images/e8_java_logo_red.jpg ), I do not have any problem:
URL url = new URL("http://java.sun.com/images/e8_java_logo_red.jpg");
System.out.println("Opening connection to " + url + "...");
// Copy resource to local file
InputStream is = url.openStream();
FileOutputStream fos=null;
String fileName = null;
StringTokenizer st=new StringTokenizer(url.getFile(), "/");
while (st.hasMoreTokens())
fileName=st.nextToken();
System.out.println("The file name will be: " + fileName);
File localFile= new File(System.getProperty("user.dir"), fileName);
fos = new FileOutputStream(localFile);
try {
byte[] buf = new byte[1024];
int i = 0;
while ((i = is.read(buf)) != -1) {
fos.write(buf, 0, i);
} catch (Throwable e) {
e.printStackTrace();
} finally {
if (is != null)
is.close();
if (fos != null)
fos.close();
}Everything is fine, the file name I get is "e8_java_logo_red.jpg", which is what I expect to get.
However, if the URL is an indirect link to the file (for example: http://javadl.sun.com/webapps/download/AutoDL?BundleId=37719 , which link to a file named JavaSetup6u18-rv.exe ), the similar code return AutoDL?BundleId=37719 as file name, when I would like to have JavaSetup6u18-rv.exe .
URL url = new URL("http://javadl.sun.com/webapps/download/AutoDL?BundleId=37719");
System.out.println("Opening connection to " + url + "...");
// Copy resource to local file
InputStream is = url.openStream();
FileOutputStream fos=null;
String fileName = null;
StringTokenizer st=new StringTokenizer(url.getFile(), "/");
while (st.hasMoreTokens())
fileName=st.nextToken();
System.out.println("The file name will be: " + fileName);
File localFile= new File(System.getProperty("user.dir"), fileName);
fos = new FileOutputStream(localFile);
try {
byte[] buf = new byte[1024];
int i = 0;
while ((i = is.read(buf)) != -1) {
fos.write(buf, 0, i);
} catch (Throwable e) {
e.printStackTrace();
} finally {
if (is != null)
is.close();
if (fos != null)
fos.close();
}Do you know how I can do that.
Thanks for your help
// JB
Edited by: jb-from-sydney on Feb 9, 2010 10:37 PMThanks for your answer.
By following your idea, I found out that one of the header ( content-disposition ) can contain the name to be used if the file is downloaded. Here is the full code that allow you to download locally a file on the Internet:
* Download locally a file from a given URL.
* @param url - the url.
* @param destinationFolder - The destination folder.
* @return the file
* @throws IOException Signals that an I/O exception has occurred.
public static final File downloadFile(URL url, File destinationFolder) throws IOException {
URLConnection urlC = url.openConnection();
InputStream is = urlC.getInputStream();
FileOutputStream fos = null;
String fileName = getFileName(urlC);
destinationFolder.mkdirs();
File localFile = new File(destinationFolder, fileName);
fos = new FileOutputStream(localFile);
try {
byte[] buf = new byte[1024];
int i = 0;
while ((i = is.read(buf)) != -1) {
fos.write(buf, 0, i);
} finally {
if (is != null)
is.close();
if (fos != null)
fos.close();
return localFile;
* Returns the file name associated to an url connection.<br />
* The result is not a path but just a file name.
* @param urlC - the url connection
* @return the file name
* @throws IOException Signals that an I/O exception has occurred.
private static final String getFileName(URLConnection urlC) throws IOException {
String fileName = null;
String contentDisposition = urlC.getHeaderField("content-disposition");
if (contentDisposition != null) {
fileName = extractFileNameFromContentDisposition(contentDisposition);
// if the file name cannot be extracted from the content-disposition
// header, using the url.getFilename() method
if (fileName == null) {
StringTokenizer st = new StringTokenizer(urlC.getURL().getFile(), "/");
while (st.hasMoreTokens())
fileName = st.nextToken();
return fileName;
* Extract the file name from the content disposition header.
* <p>
* See <a
* href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html">http:
* //www.w3.org/Protocols/rfc2616/rfc2616-sec19.html</a> for detailled
* information regarding the headers in HTML.
* @param contentDisposition - the content-disposition header. Cannot be
* <code>null>/code>.
* @return the file name, or <code>null</code> if the content-disposition
* header does not contain the filename attribute.
private static final String extractFileNameFromContentDisposition(
String contentDisposition) {
String[] attributes = contentDisposition.split(";");
for (String a : attributes) {
if (a.toLowerCase().contains("filename")) {
// The attribute is the file name. The filename is between
// quotes.
return a.substring(a.indexOf('\"') + 1, a.lastIndexOf('\"'));
// not found
return null;
} -
How to get logged in user name from windows service c#
i use the below code to get logged in user name.
private string GetLoggedInUser()
string userName = "";
if (System.Security.Principal.WindowsIdentity.GetCurrent() != null)
userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
return userName;
just do not understand why it is not giving a logged in user name rather it is return data in this format
NT AUTHORITY\SYSTEM but i want to get user name.
i try to run my service as Local Service and local system account but in every case i am getting this string
NT AUTHORITY\SYSTEM instead of logged in user name.
so please guide me what to change in code. thanksSystem is the account the service is running under.
There can be none or many interactive users be logged in. What if none or multiple are logged in? Which one are you referring to then?
Armin -
How to find the physical Host Name from a short host name?
Hi,
I meet a problem that in RFC destination setting I see some people maintain the
short name in 'HOST NAME' field. But I need the long phiscial name.
For example, the short one 'bsw6107', the phisical name is 'bsw6107.wdf.sap.corp'. It there a table or FM to look for it?
Thank you.
Regards,
YanHi,
Changing a host name on a central instance is a BIG thing, I personally would rather reinstall instead of changing a hostname...
What comes immediately to my mind is:
- SAP profiles
- .sapenv* .dbenv* scripts
- OPS$ users
- /etc/hostname*
- /etc/hosts
- TMS (/usr/sap/trans)
- Backup clients (and backup server changes if you use a central backup system)
- RFC destination of external systems
- SAP printers
- other external systems connecting to the server (Fax, Archiving etc.)
Regards,
Sankar -
How to get value in backing bean from application module
Hi all.. I'm new in jdeveloper and adf..
I need to use value from backing bean and use that value in application module.
But I don't know how to get it.
Do you a have any solution?suppose you have myMethod(String argumentName1,String argumentName2) in your Application Module
then to access a method binding from a managed bean, use the following code,
BindingContext bctx = BindingContext.getCurrent();
BindingContainer bindings = bctx.getCurrentBindingsEntry();
OperationBinding operationBinding =
bindings.getOperationBinding("name_of_method_binding");
//Here you can pass the parameters value to the AM method
operationBinding.getParamsMap().put("argumentName1",value1);
operationBinding.getParamsMap().put("argumentName2",value2);
//invoke method
operationBinding.execute();
if (!operationBinding.getErrors().isEmpty()) {
//check errors
List errors = operationBinding.getErrors();
//optional
Object methodReturnValue = operationBinding.getResult();
Maybe you are looking for
-
Installation problem on Windows 7 64
I have downloaded the archived folders win64_11gR2_database_1of2 and win64_11gR2_database_2of2, combined the contents, and ran the setup.exe program. The Installer program loads and is brought up successfully, and I can select "create and configure a
-
We are currently using 5 apple products - but all our contacts etc are shared - please advise. We do want to share our music but thats all...
-
Next and Previous button on detail page
I am new to Apex development and have a need to develop an application that has 2 pages. The first page displays a list of employees for instance and allows the user to sort the list on difference columns e.g., first name, last name, salary etc. The
-
Anyone get this before "Unable to Assemble Book" -
anybody get this when trying to buy a iphoto book- "Unable to Assemble Book" - It goes through the process of assembling the book- line is all blue, but then it does not upload it
-
Can i download songs from my computers on itunes & go to a differnet computer with different songs & download the songs from my ipod to the itunes & reupload all the songs from the 2nd computer & the songs from my computer?