EEM inbuilt enviroment vars
Hi Guys,
Having trouble getting the in built enviromental variables to execute on a basic EEM script, any idea why the below doesn't work. I need to append something unique to the filename otherwise the script will overwrite it's self.
event manager applet ERRORS
event none
action 1.0 cli command "enable"
action 1.1 cli command "sh proc cpu | redirect flash:cpu_info$_resource_time_sent"
action 1.2 cli command "show interface | redirect flash:interface_info$_resource_time_sent"
action 1.6 syslog msg "ERRORS DETECTED"
Debugs show the following :
Feb 20 11:16:18.598: %HA_EM-6-LOG: ERRORS : DEBUG(cli_lib) : : CTL : cli_open called.
Feb 20 11:16:18.598: %HA_EM-6-LOG: ERRORS : DEBUG(cli_lib) : : OUT : R2>
Feb 20 11:16:18.598: %HA_EM-6-LOG: ERRORS : DEBUG(cli_lib) : : IN : R2>enable
Feb 20 11:16:18.610: %HA_EM-6-LOG: ERRORS : DEBUG(cli_lib) : : OUT : R2#
Feb 20 11:16:18.610: %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: _resource_time_sent
Feb 20 11:16:18.610: %HA_EM-3-FMPD_ERROR: Error executing applet ERRORS statement 1.1
R2#sh event manager version
Embedded Event Manager Version 3.00
Component Versions:
eem: (v300_throttle)2.2.2
eem-gold: (v300_throttle)1.0.10
eem-call-home: (v300_throttle)2.0.2
Running IOS 12.4 24 T2
Thanks
Luckily you're using event manager detector, in which case it sounds like you could use $_event_pub_time, $_event_pub_sec, or even $_event_pub_msec.
http://www.cisco.com/en/US/docs/ios/netmgmt/command/reference/nm_13.html
Applet Built-in Environment Variables: $_event_id$_event_type$_event_type_string$_event_pub_time$_event_pub_sec$_event_pub_msec$_event_severity$_counter_name $_counter_value
The following doc has a sample output, which is in unix epoch time that can be converted to become human-readable:
# perl -e 'print scalar(localtime(1190283990)), "\n"'
Thu Sep 20 03:26:30 2007
http://www.cisco.com/en/US/docs/ios_xr_sw/iosxr_r3.8/system_monitoring/command/reference/or38eem.html
RP/0/RP0/CPU0:router# event manager run policy-manual.tcl parameter1 parameter2 parameter3
RP/0/RP0/CPU0:Sep 20 10:26:31.169 : user-plocy.tcl[65724]: The reqinfo of arg2 is
parameter2.
RP/0/RP0/CPU0:Sep 20 10:26:31.170 : user-plocy.tcl[65724]: The reqinfo of argc is 3.
RP/0/RP0/CPU0:Sep 20 10:26:31.171 : user-plocy.tcl[65724]: The reqinfo of arg3 is
parameter3.
RP/0/RP0/CPU0:Sep 20 10:26:31.172 : user-plocy.tcl[65724]: The reqinfo of
event_type_string is none.
RP/0/RP0/CPU0:Sep 20 10:26:31.172 : user-plocy.tcl[65724]: The reqinfo of event_pub_sec is
1190283990.
RP/0/RP0/CPU0:Sep 20 10:26:31.173 : user-plocy.tcl[65724]: The reqinfo of event_pub_time
is 1190283990.
RP/0/RP0/CPU0:Sep 20 10:26:31.173 : user-plocy.tcl[65724]: The reqinfo of event_id is 3.
RP/0/RP0/CPU0:Sep 20 10:26:31.174 : user-plocy.tcl[65724]: The reqinfo of arg1 is
parameter1.
RP/0/RP0/CPU0:Sep 20 10:26:31.175 : user-plocy.tcl[65724]: The reqinfo of event_type is
16.
RP/0/RP0/CPU0:Sep 20 10:26:31.175 : user-plocy.tcl[65724]: The reqinfo of event_pub_msec
is 830
Similar Messages
-
when an user authenticate in the directory express, he can see information the others users.
It is best to leave the settings of a LCD monitor to its native resolution.
You can use an extension to set a default font size and page zoom on web pages.
*Default FullZoom Level: https://addons.mozilla.org/firefox/addon/default-fullzoom-level/
*NoSquint: https://addons.mozilla.org/firefox/addon/nosquint/ -
Unable to connect to local database ( without using tnsname )
hi guys
i have 2 database running on local machine.
db1 SID - orcl (install 1st)
db2 SID - unicode (install later)
Today i shutdown unicode database and stop its respective services.
on dos
i done a sqlplus scott/tiger, i got an error
ORA-12560: TNS:protocol adapter error
therefore
i done a
set ORACLE_SID=orcl
and i still get the same error.
Therefore i done the another way round. I shutdown orcl database, stop its services and STARTED unicode database and its services.
I have remove the ORACLE_SID enviroment variable.
Now, i issue in command prompt
sqlplus scott/tiger
i am connected to the unicode database!
Now i shutdown unicode database and startup ORCL database..
and i issue a
sqlplus scott/tiger@ORCL..
I HAVE No problem connecting to it..
May i know why do i have to provide the TNSname for ORCL database and i do not have to for the UNICODE database..
Both are local on my database.
what is wrong ?
by the way, i am on XP.
thanks!hi paul,
sorry for the late reply.
I was out of town this weekend.
thank you so much for replying..
Here is my test results.
inside command prompt
(started both services - OracleServiceOrcl and OracleServiceUnicode)
set ORACLE_SID=orcl
sqlplus / as sysdba;
sys@orcl> exit
set ORACLE_SID=unicode
sqlplus / as sysdba;
sys@unicode> exit
Well, if i explicity set the ORACLE_SID, it works..
So out of curiousity, i done this testing..
1) connect to both database and shut them down
2) stop their services
3) start only ORCL service
4) close and reopen command prompt to remove the ORACLE_SID enviroment var
sqlplus / as sysdba;
Error: ORA-12560: TNS: protocol adapter error
ok..
5)now i stop the ORCL service
6) and i start the UNICODE service
then i issue
sqlplus / as sysdba;
sys@unicode>
I have got no local or two_Task variable set, i have got no oracle_sid, nor oracle_home environment variable set.
Any idea paul ?
Hope to hear your advice.
Best Regards,
Noob -
I am making a simple media player in java, using Borlands latest JBuilder. I have downloaded JMF, but have been unable to get it to work in any way whatsoever, I have tried setting the classpath and everything, but i beleive i am going about it the wrong way complety (change the enviroment var., right? just add what the documentation says to the end of what is already there, correct?) but beyond that, i cant get anything besides a .wav to play. I am wondering if anyone knows of a way to convert an mp3 on the fly during runtime, and etc. I have been on javazoom, but the download they give you is just an abstract class, doenst give you definitions on what each method does. thanks for any help
If you can get wav files to play, it's working, I would think...
I think I read somewhere that MP3 support was dropped from JMF due to some licensing issue with whoever made the MP3 codec they were using.
Look here...
http://www.javazoom.net/javalayer/javalayer.html -
Calling PL/SQL Procedures from Java
Hello,
I want to know, if it is possible to call PL/SQL Procedures from
SQLJ(which uses htp.print from the Package web toolkit ).
Though, it is possible to call normal procedures but if I want
to call PL/SQL procedures with htp.print then I get I error.
For example:
#sql{Call html_test()};
Can you give me a advice?
Your help is much appreciated!
M|llerOracle's htp packages are develop to be work with
mod_plsql/OAS/OWS webserver.
If you are trying to use htp packages first need to instanciate
some enviroment vars for htp packages, for example first you has
to call to owa.initialize procedure, populate owa.cgi array and
so on.
If you need more information about how this toolkit works you
could get the source of DB Prism at
http://www.plenix.com/dbprism/ this open source framework
includes backward compatibility with mod_plsql application and
then includes settings of this values from Java code.
Best regards, Marcelo. -
Can I complie a servlet with javac?
Im a new user, when i try to compile a servlet from javac myservlet.java
The compiler send several errors, it doesn't recognise the class of servlets.
My Enviroments' vars are:
PATH = C:\JDK1.4\BIN
CLASSPATH = .;C:\JBuilder8\thirdparty\jakarta-tomcat-4.1.12-LE-jdk14\common\lib\
I don't know if i'm doing wrong
I hope your answersYou need to add sevlet.jar to your classpath, which is located in TOMCAT_HOME/common/lib
-
Good evening everyone,
This might be the wrong place to post this but I am a greenhorn, any help would be greatly appreciated.
My issue:
I am having trouble finding my .txt file that has already been run in sqlplus.
Can someone point me in the right direction?
Thank you very much in advance!
Daveok you go to at C:\ device at then you find the file oracle into then you the version until a see the sql file either then you go to path of OS enviroment vari and copy the direction and paste in your explorer.
-
This is not properly Java question is something about the PC System.
I have an eviroment variable in AUTOEXEC.BAT named BLASTER
are we talking about BLaster Worm?? dont think its a enviroment var.Much more likely to be information about a Sound Blaster sound card. (And probably way obsolete).
-
I have created a VM environment with Windows 2K3 and Oracle 10G. My goal is to make this VM box portable for testing purposes. It works great until I move it from one VM box to another, where the IP address changes. I have even followed the steps to install Oracle in a DHCP environment and using a loopback adapter. I can install a DB and it works fine until I reboot the machine. I get the error when I start the Enterprise Manager that the SID cannot be found. I have edited the listener.ora file to look at the particular SID, however it still doesn't work. I have the loopback adapter pointing to 192.168.1.1 address and my hosts file is edited to reflect it as well. These were the instructions on the setup guide for the loopback adapter. Any help would be greatly appreciated.
The loopback adapter doesn't change, just the IP for the bridged VMWare Ethernet controller. Do the env. variables need to be set in the Windows Enviro Vars?
Here is the output of the lsnrctl status report:
C:\Documents and Settings\RNT>lsnrctl status
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 30-JAN-2008 11:35
:36
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Produ
ction
Start Date 30-JAN-2008 11:22:03
Uptime 0 days 0 hr. 13 min. 35 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\oracle\product\10.2.0\db_1\network\admin\listener.o
ra
Listener Log File C:\oracle\product\10.2.0\db_1\network\log\listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ORACLE-2K3)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl_XPT" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
After Reboot-
C:\Documents and Settings\RNT>lsnrctl status
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 30-JAN-2008 12:12
:53
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Produ
ction
Start Date 30-JAN-2008 11:59:37
Uptime 0 days 0 hr. 13 min. 16 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\oracle\product\10.2.0\db_1\network\admin\listener.o
ra
Listener Log File C:\oracle\product\10.2.0\db_1\network\log\listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ORACLE-2K3)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully -
Eventlistening: Pass OSX username to image's author prop?
Cheers,
When the open document event is triggered I need to write
the OS active username to the file's author property. OS is Apples
OSX, and Bash command "whoami" will return current user.
But making the username string availble to Photoshop has become
quite a challenge..
Using BridgeTalk my idea was to execute the command via the
Bridge's method app.system():
// via Bridgeapp.system("\"whoami\""); // returns "0"
Unfortunately app.system() appears to be one-way communication only..
The second idea is to execute a few Applescript lines via InDesigns
doscript method (via BridgeTalk from Photoshop):
set username to do shell script "whoami"
.. and return the resulting object to Bridge, and back to Photoshop
where it's written to the author property.
Last idea is to execute a shell script via Bridge's app.system()
that will write the username to a file in some location. When the
open document event is triggered the js script will look for this
file and perform the nescessary writing.
All ideas and hints are welcome! :-)
Thanks,
RasmusThat does the job as well :-) Are these enviroment vars listed somewhere?
I've can't seem to find anything in the scripting guides.
Rasmus -
EEM event_register_interface detector issue
hi,
Im working on a EEM policy for some of my routers using TCL, this policy checks for the txload value of an interface and reports the value with a syslog message, this policy is already in the eem scriptiong community so as least im sure that im in the right direction.
This is my policy right now for testing, as you can see its pretty simple:
::cisco::eem::event_register_interface name serial1/0 parameter txload poll_interval 5 entry_op ge entry_val 192 entry_val_is_increment FALSE entry_type value
action_syslog msg "event triggered"
However it doesn't works, i have tried this code on 2811 and 7200 routerswith 12.4 ios image and i cant get it working, i have been using other kind of detectors (counters, timers, cli, etc) and they are working fine.
thanks all for your replies.Thanks joseph for your reply,
I applied the policy as you said, however it didn't work, I tested the policy on a 2801 router in a lab enviroment. I have included some output from the router. I have implemented another policy with a timer detector as a workaround, meanwhile I get some other IOS image for testing and production enviroment.
R1#sh event manager policy registered
No. Class Type Event Type Trap Time Registered Name
1 script user interface Off Sun Apr 17 11:54:26 2011 ifreporter.tcl
name {serial0/2/0} parameter {txload} entry_op ge entry_val 192 entry_val_is_increment FALSE poll_interval 70.000
nice 0 queue-priority normal maxrun 20.000
R1#sh ver
Cisco IOS Software, 2801 Software (C2801-ADVIPSERVICESK9-M), Version 12.4(19), RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2008 by Cisco Systems, Inc.
Compiled Fri 29-Feb-08 20:54 by prod_rel_team
ROM: System Bootstrap, Version 12.3(8r)T9, RELEASE SOFTWARE (fc1)
R1 uptime is 48 minutes
System returned to ROM by reload at 11:48:07 cst Sun Apr 17 2011
System image file is "flash:c2801-advipservicesk9-mz.124-19.bin" -
Apache+tomcat+env vars ..?
I know this should proabably be posted in a tomcat-related forum, but it's worth a shot.
I'm using apache 2.0.43, and tomcat 4.1.12, linked togeather with mod_jk on a linux-machine (redhat 8.0), and everything works just fine .. except for one thing. I can't get apache to send tomcat the enviroment variables, such as remote host (client's hostaddress).
I did however see a note in the jk documentation about the 'JkEnvVar' directive, wich should be added to httpd.conf to forward apache server env vars to tomcat engine. But that's all the information I get, and I've tried most combinations of the JkEnvVar directive and the apache REMOTE_HOST - variable, but still the request.getRemoteHost() always return "null" if I go through apache (it gives me correct info if I connect directly to tomcat though).
I assume that noone has enough knowledge to help me out with this, so make my day, and suprise me =]I've been doing som digging, and found out that the remote host should be sent to tomcat by default. But still when I use request.getRemoteHost() I get null when I use apache, but it works fine when I directly use tomcat.
Any great ideas anyone ..? -
InBuilt Apache Web Server v2.0.58 on Solaris 10
Hi,
We are working on a custom application which works with the inbuilt Apache Web Server on the Sun Solaris platform. Here are the details of the versions of the various components involved:
Apache Web Server: Version 2.0.58
Platform: SunOS 5.10 Generic_127111-03
Our application is in the form of a shared library(.so binary) which is loaded into the Apache Web Server by mentioning the following directive in the Apache Web Server's configuration file (httpd.conf):
LoadModule at_module "/var/apache2/logs/sample/sample.so"
Where, sample.so is our application's binary
And at_module is the name of the module.
Problem details:
For each request to the Apache Web server, the server maintains a table of type "apr_table_t" which contains the header environment from the request. There is a structure "request_rec" maintained in the httpd.h file:
/** A structure that represents the current request */
struct request_rec {
/** The pool associated with the request */
apr_pool_t *pool;
/** Request method (e.g. GET, HEAD, POST, etc.) */
const char *method;
/** MIME header environment from the request */
apr_table_t *headers_in;
In our case, when we try to retrieve the address of "headers_in", we get a NULL Value. Please refer to the code for "sample-apache.cpp" program. Here it goes:
** Sample Program acting as a loadable Apache module.
** Overview:
** This sample program contains the necessary methods to make the program act as a module which can be loaded into the Apache ** Web Server. This program contains skeleton code which is necessary for any module which needs to be loaded into the Apache ** Web Server.
** Usage:
** 1) Compile and link this program to create a shared library.
** Compilation step:
** /opt/SUNWspro/bin/CC -c -o sample.o -I<Path to your include directory for Apache API's> sample-apache.cpp
** Link step:
** /opt/SUNWspro/bin/CC -G -compat=5 -mt -M map.SunOS -o sample.so sample.o -lsocket -lnsl -lpthread -ldl -lposix4 -lCstd ** -lCrun -lm -lw -lthread -lcx -lc
** 2) The sample program creates a module named "at_module" which can then be loaded in the Apache Web Server's configuration ** file, httpd.conf in the form of a configuration directive as shown below:
** LoadModule at_module "<Location of the shared library created from this sample program>"
#include "httpd.h"
#include "http_config.h"
#include "http_request.h"
#include "http_log.h"
static const char s_szInputFilterName[] = "INPUTFILTER";
extern "C" module at_module;
typedef struct
int Enabled;
char *szConfigFile;
apr_array_header_t *input_filters;
} server_config_struct;
extern "C" apr_status_t ChildExit(void *p);
extern "C" apr_status_t ParentExit(void *p);
extern "C" int Init(apr_pool_t p, apr_pool_t pLogPool, apr_pool_t pTempPool, server_rec s)
void *data;
const char *user_data_key = "init_module";
apr_pool_userdata_get(&data, user_data_key, s->process->pool);
if(!data)
apr_pool_userdata_set((const void *) 1, user_data_key, apr_pool_cleanup_null, s->process->pool);
else
server_config_struct pConfig = (server_config_struct ) ap_get_module_config(s->module_config, &at_module);
apr_pool_cleanup_register(p, s, ParentExit, apr_pool_cleanup_null);
ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, "Exit callback registered.");
fflush(NULL);
return OK;
extern "C" void ChildInit(apr_pool_t p, server_rec s)
apr_pool_cleanup_register(p, s, ChildExit, apr_pool_cleanup_null);
return;
extern "C" apr_status_t ChildExit(void *s)
return APR_SUCCESS;
extern "C" apr_status_t ParentExit(void *s)
return APR_SUCCESS;
extern "C" int access_checker(request_rec *r)
FILE * fp;
fp = fopen("/var/apache2/logs/sample.txt", "a");
fprintf(fp, "\n r->headers_in = %u, r->method = %s", r->headers_in, r->method);
fclose(fp);
return OK;
extern "C" apr_status_t input_filter_init(ap_filter_t *f)
return APR_SUCCESS;
extern "C" apr_status_t input_filter(ap_filter_t f, apr_bucket_brigade pbbOut,
ap_input_mode_t mode, apr_read_type_e block,
apr_off_t readbytes)
return APR_SUCCESS;
static void register_hooks(apr_pool_t *p)
ap_hook_post_config(Init, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_child_init(ChildInit,NULL,NULL,APR_HOOK_MIDDLE);
ap_hook_access_checker(access_checker, NULL, NULL, APR_HOOK_REALLY_LAST);
ap_register_input_filter(s_szInputFilterName, input_filter, input_filter_init, AP_FTYPE_RESOURCE);
extern "C" module AP_MODULE_DECLARE_DATA at_module =
STANDARD20_MODULE_STUFF,
NULL,
NULL,
NULL,
NULL,
NULL,
register_hooks
//End of sample
In this program, inside the access_checker() method, we try to retrieve the address of "headers_in" and get that as NULL:
extern "C" int access_checker(request_rec *r)
FILE * fp;
fp = fopen("/var/apache2/logs/sample.txt", "a");
fprintf(fp, "\n r->headers_in = %u, r->method = %s", r->headers_in, r->method);
fclose(fp);
return OK;
Here is the output of the sample program after accessing the main page of the Web server:
r->headers_in = 0, r->method = GET
r->headers_in = 0, r->method = GET
r->headers_in = 0, r->method = GET
Though we are able to retrieve one member of the structure request_rec (method), we are not able to retrieve the address of the other member (headers_in).
Observation:
We made an interesting observation that when we used the same sample program with the inbuilt Apache 2.0.52 Web Server on Solaris, we were able to successfully retrieve the address of headers_in. Here are the details of the set-up which is working fine:
Apache Web Server: Version 2.0.52
Platform : SunOS 5.10 Generic_118822-30
Thus, there is something different which has happened between the Sun's Solaris Apache Web Server's versions 2.0.52 and 2.0.58 which is making it unable to retrieve the address of the request headers (headers_in) in version 2.0.58.
Can sombody please help me find out the reson for this difference and let me know if we need to change the way of retrieving the request headers for Solaris Apache 2.0.58.
ThanksOk, found the problem:
Do not use this "SSL_RENEGOTIATE_NEVER" as a value for the environment variable:
NSS_SSL_ENABLE_RENEGOTIATION=SSL_RENEGOTIATE_NEVER;export NSS_SSL_ENABLE_RENEGOTIATION
instead, use "0":
NSS_SSL_ENABLE_RENEGOTIATION=0;export NSS_SSL_ENABLE_RENEGOTIATION
Add that line to your startserv script and it should disable ssl renegotiation permanently.
Regards, -
Problem with inbuilt Solaris Apache Web Server v 2.0.58
Hi,
Set-up:
We are working on a custom application which works with the inbuilt Apache Web Server on the Sun Solaris platform. Here are the details of the versions of the various components involved:
Apache Web Server: Version 2.0.58
Platform: SunOS 5.10 Generic_127111-03
Our application is in the form of a shared library(.so binary) which is loaded into the Apache Web Server by mentioning the following directive in the Apache Web Server's configuration file (httpd.conf).
LoadModule at_module "/var/apache2/logs/sample/sample.so"
where, sample.so is our application's binary
and at_module is the name of the module.
httpd.conf file has been attached for your reference.
Attachments:
httpd.conf - Apache Web Server's configuration file.
sample-apache.cpp - Sample program which is showing the problem.
httpd.h - Apache Software Foundation's file which contains the structure "request_rec" that represents the current request.
Problem summary:
For each request to the Apache Web server, the server maintains a table of type "apr_table_t" which contains the header environment from the request. There is a structure "request_rec" maintained in the httpd.h file:
/** A structure that represents the current request */
struct request_rec {
/** The pool associated with the request */
apr_pool_t *pool;
/** Request method (eg. GET, HEAD, POST, etc.) */
const char *method;
/** MIME header environment from the request */
apr_table_t *headers_in;
In our case, when we try to retrieve the address of "headers_in", we get a NULL Value. Please refer to the attached "sample-apache.cpp" program. In this program, inside the access_checker() method, we try to retrieve the address of "headers_in" and get that as NULL:
extern "C" int access_checker(request_rec *r)
FILE * fp;
fp = fopen("/var/apache2/logs/sample.txt", "a");
fprintf(fp, "\n r->headers_in = %u, r->method = %s", r->headers_in, r->method);
fclose(fp);
return OK;
Here is the output of the sample program after accessing the main page of the Web server:
r->headers_in = 0, r->method = GET
r->headers_in = 0, r->method = GET
r->headers_in = 0, r->method = GET
Though we are able to retrieve one member of the structure request_rec (method), we are not able to retrieve the address of the other member (headers_in).
Observation:
We made an interesting observation that when we used the same sample program with the inbuilt Apache 2.0.52 Web Server on Solaris, we were able to successfully retrieve the address of headers_in. Here are the details of the set-up which is working fine:
Apache Web Server: Version 2.0.52
Platform : SunOS 5.10 Generic_118822-30
Thus, there is something different which has happened between the Sun's Solaris Apache Web Server's versions 2.0.52 and 2.0.58 which is making it unable to retrieve the address of the request headers (headers_in).
I am requesting someone to kindly shed light on this difference and let us know if we need to change the way of retrieving the request headers for Solaris Apache 2.0.58.
Thanks,
Atul.The only way you can achieve it is by running the web server to listen on port 80
Please change the port in your httpd.conf file for the webserver and restart it.
If any other processes are running/using on port 80 on that machine, then please stop them, otherwise you will not be able to achieve your requirement.
Arun -
How to access application vars into JavaBeans or Java File?
I have the application directory strcuture like this. I am using Apache Tomcat/6.0.14 and Eclipse IDE.
-/MyFirstServlet
-/MyFirstServlet/WebContent
-/MyFirstServlet/WebContent/WEB-INF/web.xml
-/MyFirstServlet/WebContent/web.jsp
-/MyFirstServlet/Src
- com.model.DAO/userDAO.java (java class within package)
I have put following code into "web.xml".
==================================
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>
MyFirstServlet
</display-name>
<context-param>
<param-name>DBDriver</param-name>
<param-value>com.microsoft.sqlserver.jdbc.SQLServerDriver</param-value>
</context-param>
<context-param>
<param-name>connectionUrl</param-name>
<param-value>jdbc:sqlserver://localhost:1433;databaseName=MyFirstServletDB;user=hitesh;password=hit
esh;</param-value>
</context-param>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
I am easily able to access from "web.jsp"
===================================
String DBDriver = application.getInitParameter("DBDriver");
out.println("<br>DBDriver:==="+DBDriver);
String connectionUrl = application.getInitParameter("connectionUrl");
out.println("<br>connectionUrl:==="+connectionUrl);
BUT when I try to access withing userDAO.java it gives "application is not resolved"
========================================================================
String DBDriver = (String)application.getInitParameter("DBDriver");
NOTE: I understand I need to import some inbuilt java package which will allow to use applcation vars
within java class.
What is that package? and how to do that?
Is there any other easy method to use global/application vars which can be used in all
JSP/JavaBeans/Java files?
Thanks in advance.It might be easier to put that code somewhere else. JSP's are for presentation, not for accessing databases, business logic, etc.
Maybe you are looking for
-
How do I transfer voice memos from my macbook to my iphone?
I had to back up all of my information from my phone to my macbook as I needed to restore my iphone to factory settings and would lose all my information. Now I want my voice memos back on my iphone and I am unable to sync them onto my phone. Not eve
-
My iphone 4 wont turn on after hours of charging, normally i would press the lock button and home button together but my lock button stopped working afue weeks ago. Help!
-
Hello gurus! Is there a way to change to display names of Business Partner names like this: first must be "Surname", second - "Name", without initials. Example. Now is displayed like this: Konstantin K. V. Melnik We want like this: Melnik Konstantin.
-
I too am having an issue on my iPod page here. I have created a css file in Dreamweaver and it appears in DW but when I upload it the page does not display correctly. I hope this is something easy.
-
Develop with 11.2 ODP 64-bit, deploy in 11.2 ODP 32-bit
Will an application that is developed on a x64 machine against a x64 version of ODP, and built to target Any Platform, function normally when deployed to a x86 machine with the x86 ODP? Both x86 and x64 ODP version's would be 11.2. Thanks, --=Chuck