Get the name and path of the calling JSP

Hi all,
I have a code structure like this
class MyBaseServlet extends HttpServlet{
doPost(){processRequest();}
doGet(){processRequest();}
processRequest(req, resp){}
myPrivateMethod(req,resp){
//I want the name of the JSP which invoked the servlet that extends this(MyBaseServlet) here
class MySerlvet extends MyBaseServlet{
processRequest(req, resp){}
I have a JSP which submits in the <FORM> action calls MyServlet. Since MyServlet extends MyBaseServlet, and this has the doPost() and doGet() methods, the control goes here first, and then since MyServlet has overridden the processRequest() method , the control comes here.
My query isthat, while in MyBaseServlet (either in doPost() or doGet(), say I call myPrivateMethod(), is there any way here, inside myPrivateMethod() to get the name of the JSP which called MyServlet.
Note:
The constraint here is that we are not in a position to include any code into either the JSP or MyServlet. I'm running this in a J2EE environment on Websphere.
Thanks in advance.

You can use the methods of the HTTPServletRequest class to get the URI/URL info...for example request.getRequestURI() /URL()/ServletPathInfo()
http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpServletRequest.html

Similar Messages

  • Get file name and path from  adf inputFile

    Hi,
    I use adf's inputFile component. I need to get the file name and filePath. Does anyone knows how to do that?
    Thanks in advance

    You may bind the value to an UploadedFile object and get the name from this object.
    You may use a valueChangeListener backin bean method or a managed bean.
    Here the code i just write for something similar. Note that i'm not able to test it because of a bug in 10.1.3.1 with inputFile and web.xml parameters. I still waiting for the patch.
    public void uploadedFile(ValueChangeEvent valueChangeEvent) throws IOException,
    Exception {
    final int BUFFER = 2048;
    byte data[] = new byte[BUFFER];
    int currentByte;
    String fileName;
    UploadedFile uploadedFile =
    (UploadedFile)valueChangeEvent.getNewValue();
    if (uploadedFile != null) {
    String mimeType = uploadedFile.getContentType();
    if (mimeType == "application/x-zip-compressed") {
    // get the uploaded file as a zip file
    ZipFile zipFile = new ZipFile(uploadedFile.getFilename());
    // verify the zip archive contains only one entry
    if (zipFile.size() != 1) {
    FacesContext context =
    FacesContext.getCurrentInstance();
    ResourceBundle errorMessage =
    ResourceBundle.getBundle(context.getApplication().getMessageBundle());
    Exception ZipFileContentException =
    new Exception(errorMessage.getString("error.fileUpload.zipFileContent.moreThanOneEntry").replace("{0}",
    String.valueOf(zipFile.size())));
    throw ZipFileContentException;
    // get the entries in the zip file even it is only one
    Enumeration zipFileEntries = zipFile.entries();
    // Process each entry
    while (zipFileEntries.hasMoreElements()) {
    // grab a zip file entry
    ZipEntry entry =
    (ZipEntry)zipFileEntries.nextElement();
    // check the entry is not a directory
    if (entry.isDirectory()) {
    Exception ZipFileContentException =
    new Exception(JSFUtils.getStringFromBundle("error.fileUpload.zipFileContent.isDirectoryInsteadFile"));
    throw ZipFileContentException;
    File destFile = new File(entry.getName());
    Magic magic = new Magic();
    // getMagicMatch accepts Files or byte[],
    // which is nice if you want to test streams
    MagicMatch match = magic.getMagicMatch(destFile, true);
    if (match.getMimeType() != "application/xml") {
    Exception ZipFileContentException =
    new Exception(JSFUtils.getStringFromBundle("error.fileUpload.isNotXMLFile").replace("{0}",
    match.getMimeType()));
    throw ZipFileContentException;
    //TODO get the repository directory from classification-param.xml
    BufferedInputStream is =
    new BufferedInputStream(zipFile.getInputStream(entry));
    FileOutputStream fos = new FileOutputStream(destFile);
    BufferedOutputStream dest =
    new BufferedOutputStream(fos, BUFFER);
    // read and write until last byte is encountered
    while ((currentByte = is.read(data, 0, BUFFER)) !=
    -1) {
    dest.write(data, 0, currentByte);
    dest.flush();
    dest.close();
    is.close();
    zipFile.close();
    } else if (mimeType == "application/xml") {
    String currentEntry = uploadedFile.getFilename();
    File destFile = new File(currentEntry);
    BufferedInputStream is =
    new BufferedInputStream(uploadedFile.getInputStream());
    FileOutputStream fos = new FileOutputStream(destFile);
    BufferedOutputStream dest =
    new BufferedOutputStream(fos, BUFFER);
    // read and write until last byte is encountered
    while ((currentByte = is.read(data, 0, BUFFER)) != -1) {
    dest.write(data, 0, currentByte);
    dest.flush();
    dest.close();
    is.close();
    } else {
    Exception ZipFileContentException =
    new Exception(JSFUtils.getStringFromBundle("error.fileUpload.isNotXMLFile").replace("{0}",
    mimeType));
    throw ZipFileContentException;
    }

  • How do I get VI name and path where mouse is programati​cally from another VI

    Hi, this is my first question here.
    I am trying to create a permanent running, ObtainInfo.vi, in LV 7.1 that automatically gets ínfo from other running VI:s. I would like to obtain info from the other VI:s when the mouse is being clicked over there. Information could be the other VI:s name and/or reference. I have tried different methods without any results.
    Solved!
    Go to Solution.

    I gave it a try myself. The screenshot is attached. The problems unsolved are some errors I get when I used all VIs, the execution state property is the workaround for this. You certainly also want to have it for VIs that are Running (not top-level).
    Felix 
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml
    Attachments:
    MouseDown.PNG ‏43 KB

  • How to change the default password file's name and path when the database created?

    how to change the default password file's name and path when the database created?
    null

    Usage: orapwd file=<fname> password=<password> entries=<users>
    where
    file - name of password file (mand),
    password - password for SYS and INTERNAL (mand),
    entries - maximum number of distinct DBA and OPERs (opt),
    There are no spaces around the equal-to (=) character.

  • How to print the report file name and path and the last mod date

    Good morning,
    I am trying to print on the footer of the report the report file name and path as well as the report last modification date.
    Anyone would know how I can do that? I have checked the doc but found nothing.
    Thks. Philippe.

    Did you ever determine how to print report name and report last mod date?
    Thanks

  • In LSMW while executing the specify file step logical file name and path.

    Hi ,
    In LSMW , while executing the specify file step, logical file name and path is mandatory field to entry, but in some of other LSMW objects, these fields are not mandatory one, i want to know is it possible for me to do hide the logical file name and path field in specify file step.
    thanks
    Md nisar

    Hi,
    For some Transactions while executing the Specify file step Logical File and Logical Path are mandatory.
    In this case Converted file will be stored in the application server. According to the specified Logical File and Logical path.
    Hope this will help you....
    Regards,
    Tirumala Reddy

  • Adding the file name and path to a document

    Is there a way to automatically generate the file name and path (i.e. 'P:\ARF530\BACKGROUND\diagram.ai') to a document without having to copy and paste from the explorer window?

    Hi,
    So to select the directory, in the WHNE-BUTTON-PRESSED trigger write,
         :<block_name>.<path_item_name> := GET_FILE_NAME(' ', NULL, NULL, 'Choose any directory.', OPEN_FILE, FALSE);
         IF SUBSTR(:<block_name>.<path_item_name>, LENGTH(:<block_name>.<path_item_name>)) != '/' AND SUBSTR(:<block_name>.<path_item_name>, LENGTH(:<block_name>.<path_item_name>)) != '\' THEN
              :<block_name>.<path_item_name> := :<block_name>.<path_item_name> || '\';
         END IF;and to open the file, write,
    DECLARE
      FT_File  TEXT_IO.FILE_TYPE;
    BEGIN
      IF SUBSTR(:<block_name>.<path_item_name>, LENGTH(:<block_name>.<path_item_name>)) = '/' OR SUBSTR(:<block_name>.<path_item_name>, LENGTH(:<block_name>.<path_item_name>)) = '\' OR :<block_name>.<path_item_name> IS NULL THEN
           MESSAGE('Please Enter file name before continue');
           MESSAGE('Please Enter file name before continue');
           RAISE FORM_TRIGGER_FAILURE;
      END IF;
      FT_File := TEXT_IO.FOPEN(:<block_name>.<path_item_name>, 'w');
    END;Regards,
    Manu.
    If my response or the response of another was helpful or Correct, please mark it accordingly

  • How do I put the file name and path into either the header or the footer?

    I need to keep track of pdf documents as their names or locations sometimes change.  I need to show both file name and path, preferably in the header.  I would also like it to refresh automatically when I change, say, the file name, but that's not as essential as the basic function of showing the file name and path.

    You will need to do this with a text field and a Javascript that executes on open.

  • Stupid question: my top 'dock' is not displayed on the screen. How do I get it back and what is it called?

    Stupid question: my top 'dock' is not displayed on the screen. How do I get it back and what is it called? It's just annoying that I have to reach high for it!

    Menu bar. Are you in Full Screen Mode?
    OS X Mavericks: Take apps full screen
    In all apps?

  • Changing the name and path of Targets, Exec, Products, etc

    I want to change the name and path of the Products, Targets, and Executables, but the text box in the 'info' window won't let me edit, and the choose buttom is grayed out.
    Any ideas?

    I just did this yesterday... and it's fairly confusing trying to figure out what all to change.
    You can change the name of your target and executable by selecting them in the "Groups & Files" list and then selecting "File -> Rename" from the menubar.
    It appears as if you can also select your Product and rename it in this way too... but (in my case) doing that didn't seem to actually rename the final app that's produced.
    In order to rename the actual final application I believe you must select your target click the "Info" button... in the Info window select the "Build" tab. Scroll down until you find the "Product" entry. Double-click that and change it's name. Note that you may need to change the product name for each of your build configurations (ie Debug & Release).
    Steve

  • Running iTunes 11.0.3 64bit Windows 7. The "join Tracks" line has disappeared from the box that opens when you click "options" after inserting a CD. Only 2 lines show up: "Get track names" and "Submit CD Track names". Where did "Join Tracks" go?

    Running iTunes 11.0.3 64bit Windows 7. The "join Tracks" line has disappeared from the box that opens when you click "options" after inserting a CD. Only 2 lines show up: "Get track names" and "Submit CD Track names". Where did "Join Tracks" go?

    i have the same problem no radio stations at all bit shabby hate technolgy now adays

  • Get the Caller Name using JTAPI

    For the incoming call, I am able to read the Caller ID using connection[0].getAddress(), but it gives me the phone number of the incoming call. Is there a way to get the Caller Name of the incoming call as well?

    You get the caller name as shown on the phone's display by calling CiscoCall.getCurrentCallingPartyDisplayName

  • Getting the caller address inside kernel

    How to get the caller address inside a kernel ? I mean address of a kernel
    function x, calling other kernel function y.
    Currently I am doing the following to get the caller address inside a
    kernel function(Sol7, 64-bit sparc). This is not wrong, but may be a
    problem if we turn on compiler optimizations.
    <PRE>
    kernel_func_y(someargs_t *args)
    int x;
    /* get the caller address into args->cl_addr */
    asm("stx %i7, [%i0 + 8]");
    /* use the caller address, here for some reason */
    some_operation(args->calleraddr);
    </PRE>
    Is there any DDI/DDK function/macro available to do this ? If not won't it
    be nice to have such a DDI/DDK macro/function ?
    Thanks

    Hi Sini
    Good question! I dont think there is any library which provides
    this functionality. And yes it might be helpful under some special
    circumstances. Although I think you might be able to get it from
    the stack.
    My 2 cents.
    -Manish

  • Get the calling system in the remote FM

    Hello,
    how can i get the calling System in a FM, which was called over remote RFC from another System?
    Best regards,
    TomSd

    Hi thomas,
    1. we can refer to the calling system
      using 'BACK'
    2. ie. if we call using
      call function 'abc' destination 'BACK',
      then it will call rfc in the calling system.
    regards,
    amit m.

  • HT1338 I am trying to use FaceTime with my partner in Mexico but is not connecting. We do get the call, but it just does not connect. What should I do?

    I am trying to use FaceTime with my partner in Mexico but is not connecting. We do get the call, but it just does not connect. What should I do?

    Try turning off the Firewall in System Preferences > Security & Privacy
    Apple - Support - FaceTime

  • Unable to get the AppsLocalLogin.jsp page

    Hi,
    We are on oracle Db 11.2.0.2 and EBS : 11.5.10.2 on Solaris Sparc 64 Bit 5.10.
    We have recently added a web node to an existing setup.
    Although Apache services are up , but we are unable to get the AppsLocalLogin.jsp page.
    Replacing the domain name and Ip in line 4  with HOSTNAME.DOMAIN_NAME/IPADDRESS
    We have found the below error in the Jserv log :
    [12/04/2012 20:09:38:868 IST] <info> ApacheJServ/1.1.2 is starting...
    [12/04/2012 20:09:38:868 IST] <debug> using confFile /pch3/oracle/external/prdora/iAS/Apache/Jserv/etc/jserv.properties
    [12/04/2012 20:09:39:016 IST] <info> Connection authentication enabled
    [12/04/2012 20:09:39:045 IST] <info> Connection allowed from HOSTNAME.DOMAIN_NAME/IPADDRESS
    [12/04/2012 20:09:39:045 IST] <info> Connection allowed from /127.0.0.1
    [12/04/2012 20:09:39:046 IST] <debug> port 16000 is specified in properties file
    [12/04/2012 20:09:39:046 IST] <debug> port 16001 is specified in properties file
    [12/04/2012 20:09:39:046 IST] <debug> port 16002 is specified in properties file
    [12/04/2012 20:09:39:046 IST] <debug> port 16003 is specified in properties file
    [12/04/2012 20:09:39:046 IST] <debug> port 16004 is specified in properties file
    [12/04/2012 20:09:39:046 IST] <debug> port 16005 is specified in properties file
    [12/04/2012 20:09:39:046 IST] <debug> port 16006 is specified in properties file
    [12/04/2012 20:09:39:046 IST] <debug> port 16007 is specified in properties file
    [12/04/2012 20:09:39:046 IST] <debug> port 16008 is specified in properties file
    [12/04/2012 20:09:39:046 IST] <debug> port 16009 is specified in properties file
    [12/04/2012 20:09:39:046 IST] <debug> try to start on port 16000
    [12/04/2012 20:09:39:050 IST] <debug> try to start on port 16001
    [12/04/2012 20:09:39:050 IST] <debug> cannot create socket on 16000
    [12/04/2012 20:09:39:051 IST] <debug> cannot create socket on 16001
    [12/04/2012 20:09:39:051 IST] <debug> try to start on port 16002
    [12/04/2012 20:09:39:051 IST] <debug> cannot create socket on 16002
    [12/04/2012 20:09:39:051 IST] <debug> try to start on port 16003
    [12/04/2012 20:09:39:051 IST] <debug> cannot create socket on 16003
    [12/04/2012 20:09:39:051 IST] <debug> try to start on port 16004
    [12/04/2012 20:09:39:051 IST] <debug> cannot create socket on 16004
    [12/04/2012 20:09:39:051 IST] <debug> try to start on port 16005
    [12/04/2012 20:09:39:052 IST] <debug> cannot create socket on 16005
    [12/04/2012 20:09:39:052 IST] <debug> try to start on port 16006
    [12/04/2012 20:09:39:052 IST] <debug> cannot create socket on 16006
    [12/04/2012 20:09:39:052 IST] <debug> try to start on port 16007
    [12/04/2012 20:09:39:052 IST] <debug> cannot create socket on 16007
    [12/04/2012 20:09:39:052 IST] <debug> try to start on port 16008
    [12/04/2012 20:09:39:052 IST] <debug> cannot create socket on 16008
    [12/04/2012 20:09:39:052 IST] <debug> try to start on port 16009
    [12/04/2012 20:09:39:052 IST] <debug> cannot create socket on 16009
    ApacheJServ/1.1.2: Failed to bind to port(s) specified in /pch3/oracle/external/prdora/iAS/Apache/Jserv/etc/jserv.properties.  Please check /pch3/oracle/external/prdora/iAS/Apache/Jserv/etc/jserv.properties and jserv.conf file, and make sure number of JServ process specified in jserv.conf is less than number of ports specified in /pch3/oracle/external/prdora/iAS/Apache/Jserv/etc/jserv.properties. and the ports are not used by other processes.
    [12/04/2012 20:09:39:053 IST] <critical> ApacheJServ/1.1.2: Failed to bind to port(s) specified in /pch3/oracle/external/prdora/iAS/Apache/Jserv/etc/jserv.properties.  Please check /pch3/oracle/external/prdora/iAS/Apache/Jserv/etc/jserv.properties and jserv.conf file, and make sure number of JServ process specified in jserv.conf is less than number of ports specified in /pch3/oracle/external/prdora/iAS/Apache/Jserv/etc/jserv.properties. and the ports are not used by other processes.The IP of this web node is different from the IP mentioned in the log, at line 4.
    Regards
    KK

    Hi;
    ApacheJServ/1.1.2: Failed to bind to port(s) specified in /pch3/oracle/external/prdora/iAS/Apache/Jserv/etc/jserv.properties. Please check /pch3/oracle/external/prdora/iAS/Apache/Jserv/etc/jserv.properties and jserv.conf file, and make sure number of JServ process specified in jserv.conf is less than number of ports specified in /pch3/oracle/external/prdora/iAS/Apache/Jserv/etc/jserv.properties. and the ports are not used by other processes.Please check your port is avaliable or not also check related path
    Regard
    Helios

Maybe you are looking for