A code replacing Nametrans redirect?

Hi,
I use following line in obj.conf file
NameTrans fn="redirect" from="/testfolder" url="/test.jsp"
This enables all visitors trying to enter "/testfolder" and all subfolders to redirecting to "/test.jsp" file.
I need is not "redirecting" but "forwarding" of the request entering "/testfolder".
ie. The browser shall be displaying "http://aaa.bbb.ccc/testfolder/test2/" instead of redirected "http://aaa.bbb.ccc/test.jsp"
Is it possible? If possible can I be still reading the original request URL from test.jsp? Or somehow include that info in the process?

Here's some code I wrote years ago (back in the NES 3.6 or 4.1 days, though it still works fine in SJWS 6.1) to allow seamlessly remapping a URI (1:1 mapping of requested URI to handling URI) without issuing a redirect. Usage in obj.conf looks like
NameTrans fn="PW-internal-redirect" apparentPath="/" cgiPath="/apps/home.pl"
Don't worry about "cgi" in the "cgiPath" argument name -- it should work for remapping to any sort of URI. You'll need to replace strcmp() with something like shexp_cmp() in order to have a N:1 "/testfolder/*" to "/test.jsp" mapping as you discuss.
Note that by default the web server log records the first request line (method + URI + protocol/version) in the access log, and this NSAPI does not change that value. So if you remapped /testfolder/ to /test.jsp and fielded a request for /testfolder/, your access log would show something like "GET /testfolder/ HTTP/1.1" even though /test.jsp serviced the request.
To pass the original URI to /test.jsp, you'd need to add something like this to the SAF C code
param_free(pblock_remove("X-INITIAL-URI", rq->headers));
pblock_nvinsert("X-INITIAL-URI", pblock_findval("uri", rq->reqpb), rq->headers);
before resetting ppath and then you could use something like request.getHeader("x-initial-uri") in the JSP to retrieve the original URI.
See the NSAPI programmer's guide for more info if you haven't built a custom SAF before.
/* Netscape NSAPI header files */
#include "nsapi.h"
NSAPI_PUBLIC int PW_internal_redirect(pblock pb, Session sn, Request *rq) {
char *cgiPath;
char *apparentPath;
/* check parameters and ppath value (you could obviously change
from strcmp() to a regexp compile/comparison if needed) */
if ( ((cgiPath=pblock_findval("cgiPath",pb)) == NULL)
|| ((apparentPath=pblock_findval("apparentPath",pb)) == NULL)
|| (strcmp(apparentPath, pblock_findval("ppath", rq->vars)) != 0) )
return REQ_NOACTION;
/* looks like a match, clear the current ppath */
if ( param_free(pblock_remove("ppath", rq->vars)) ) {
/* make the httpd act as if they requested something else */
pblock_nvinsert("ppath", cgiPath, rq->vars);
/* and we return from the function */
return REQ_NOACTION;
The Makefile (Solaris, Sun Workshop compiler) looks like this:
# Defines for example NSAPI programs running under SOLARIS
CC_CMD=cc -DNET_SSL -DSOLARIS -D_REENTRANT -xchip=ultra2
LD_SHAREDCMD=ld -G -s
all:
prepare:
INCLUDEDIR=/path/to/sjwsdir/plugins/include
OBJS = PW_internal_redirect.o
INCLUDE_FLAGS=-I$(INCLUDEDIR) -I$(INCLUDEDIR)/base -I$(INCLUDEDIR)/frame
COMMON_DEFS=-DMCC_HTTPD -DXP_UNIX -DSPAPI20
all: PW_internal_redirect.so
PW_internal_redirect.so: $(OBJS)
$(LD_SHAREDCMD) $(OBJS) -o PW_internal_redirect.so $(EXTRA_LDDEFINES)
.c.o:
$(CC_CMD) $(COMMON_DEFS) $(INCLUDE_FLAGS) -c $<
clean:
rm $(OBJS) PW_internal_redirect.so $(EXTRA_CLEAN)

Similar Messages

  • Hot Code Replace Problem...

    Hi Everyone,
    I am using WebLogic 10 with Eclipse. Whenever i start the server in debug mode and make two three changes in the code... WHAM.... I get the Hot Code Replace error. Is there any way so that the server can keep up with the code changes. Publishing the app again takes approx 40 mins!

    Almost always this is a limitation of the JRE/JDK you are using and really
    nothing to do with Eclipse.
    Try a different VM and see if you have better luck
    HTH
    Darins
    "bobz" <[email protected]> wrote in message
    news:75257188f239cb376da31e19b214d2d9$[email protected]..
    > hi buddies,
    >
    > i am getting "hot code replace" problem whenever i change my
    > java code and build the project and access the website without re-starting
    > the server. so, finally i endup with re-starting the server whenever i
    > change the code. this consumes a lot of time. is there any possibility to
    > work without re-starting the server even after the code change.
    >
    > regards,
    > satish.

  • Hot code replacement

    How do I do hot code replacement in Eclipse? I tried to write another line while debugging the code, but I got the warning message about the obsolete methods in stack.

    I didn't write a new method to replace a method.
    Suppose that I have set a breakpoint at
    System.out..println("hi"), debug it, and then change
    the number 2 to 3 and save it, then I want this code
    to work well. It did show a pop up dialog explaining
    about obsolete methods.
    What does it mean?
         public void testSomething() {
              System.out.println("hi");If you set a breakpoint here. This method was on stack and when you
    did hot code replacement and this method "testSomething" becomes
    obsolete method. And it will not execute the new modified statement.
    To make the new replaced code to execute you should pop this
    frame and continue. Or set a breakpoint at line before entering
    this method and then do hot code replacement.
              System.out.println("2");
    Thanks.

  • Hot code replacement for local application?

    i got hot code replacement working during debugging a removet web application (servlet). however, it doesn't work if i debug a simple (local) application. is there something i forgot to setup? (i'm using Eclipse)

    This is an eclipse specific question. It is up to Eclipse to do the code replacement.
    Have you tried 3.0-M8 ?

  • Websphere setting for Hot code replace

    hi ,
    these days i need to build my code everytime i make changes ...
    previously it was working well ......
    i went thru some changes in env .....as there were new addition of MDBs etc in my projects .....
    i m using WSAD 5.1.2 .......
    i have checked the option we get on server for hot code replace feature ...
    is there any other thing i can try ???

    -Xj9

  • REG : HOT CODE REPLACE FAILED

    Hi,
    I am able to build and deploy and it says deployment is successfull from IDE. But when i tried to write some new code into my application or  debug it,I am getting the error message  saying:
    "Java HotSpot(TM) Server VM{PSC-PC11741:500021](may be out of synch) was unable to replace the running code with the code in the work space.
    Reason:
    Hot code replace failed - VM may be inconsistent
    Anybody has faced this problem?
    Please let me know if you have faced this problem.
    Regards,
    Anu

    Synched and Rebuild it .Created a new activity after reverting back the tasks done before.

  • Hot code replace failed - Delete method not implemented

    I debug my Java application with Eclipse (3.1). When I change my code during debugging, I get the following error message:
    ...MyApp at localhost:4540 (may be out of synch) was unable to replace the running code with the code in the workspace.
    Reason:
    Hot code replace failed - Delete method not implemented
    What does that mean and how can I fix this?

    This means you changed a class while it was debugging an application and it could not update the class for the application while it was running.
    The error suggests you may be running an older JVM, i.e. pre-1.4.2 but this error can occur with any JVM if the change is incompatible with the previous version of the class.
    The hot replace often does not work for non trivial changes to code.

  • Hot Code replace failed- VM inconsistent

    When i am trying to deploy the application on WAS through NWDS, it is throwing Hot Code replace failed- VM inconsistent.
    Please give your input.
    thanks,

    Hi,
    > It ask me for SDM password, than it throws the error out.
    I do not really understand why the SDM password should be checked for debugging...
    (Double-)Check the WD-Debugging infos here: http://help.sap.com/saphelp_nw04/helpdata/en/cc/9cb34d9d11f74c98644df2b96b90f1/frameset.htm
    And check for standard HotCodeReplacement issues this for example: NetWeaver Portal Debugging - 2, HotSwap your classes
    Maybe putting this question within the WD forum could bring out more...
    Hope it helps
    Detlev

  • Hot code replace failed-VM may be inconsistent

    Java HotSpot(TM)Server VM(micserver:50021)(may be out of synch)
    was unable to replace the running code with the code in the
    workspace
    Reason:
    Hot code replace failed-VM may be inconsistent
    i face the following message and the code keep on retain to the old code.
    this cause me have the debugging problem

    Hi Yzme,
    This happens since you save the changes to your code which is being debugged and your debugger session is still ON.
    To avoid this close your debugger before making any changes to your code.
    Regards,
    Shubham

  • Error in my CODE- replace data in html tags in APPLET

    MY REQUIREMENT:
    I'm trying to send html format of output to an excel file....As you can see my data in the td tag had data as: 
    BRANCHOFFICE<125 & BRANCHOFFICE>176 where < is interpreted as an html tag....So I want to replace
    < -> <
    < -> >
    & -> &
    <HTML>
    <table border="1">
    <tr>
    <td>BRANCHOFFICE<125 & BRANCHOFFICE>176</td>
    </tr>
    </table>
    </HTML>
    MY ERROR IN CODE:
    So I'm testing my replace method in a small snippet.........
    So the steps my code works is:
    1)BRANCHOFFICE<125 & BRANCHOFFICE>176 gets converted to
    BRANCHOFFICE<125 & BRANCHOFFICE>176
    2)BRANCHOFFICE<125 & BRANCHOFFICE>176 gets converted to
    BRANCHOFFICE<125 & BRANCHOFFICE>176
    3)when it comes to the third & conversion it goes to a infinte loop....
    CAN U PLS HELP ME TO SOLVE THIS BUG........
    import java.applet.Applet;
    import java.io.*;
    public class escape
    public static void main(String arg[])
    String s1 = "BRANCHOFFICE<125 & BRANCHOFFICE>176";
    System.out.println("s1 = " + escape(s1));
    private static String escape(String s)
    while( true )
    int index = s.indexOf('<');
    if ( index != -1 )
    String before = s.substring( 0, index );
    String after = s.substring( index+1, s.length() );
    s = before + "<" + after;
    continue;
    index = s.indexOf('>');
    if ( index != -1 )
    String before = s.substring( 0, index );
    String after = s.substring( index+1, s.length() );
    s = before + ">" + after;
    continue;
    index = s.indexOf('&');
    if ( index != -1 )
    String before = s.substring( 0, index );
    String after = s.substring( index+1, s.length() );
    s = before + "&" + after;
    continue;
    break;
    return s;
    }

    Jdk 1.4:import java.applet.Applet;
    import java.io.*;
    public class escape
         public static void main(String arg[])
              String s1 = "BRANCHOFFICE<125 & BRANCHOFFICE>176";
              System.out.println("s1 = " + escape(s1));
         private static String escape(String s)
              s = s.replaceAll ("&", "&");
              s = s.replaceAll ("<", "<");
              s = s.replaceAll (">", ">");
              return s;
    }<= Jdk 1.3:import java.applet.Applet;
    import java.io.*;
    public class escape
         public static void main(String arg[])
              String s1 = "BRANCHOFFICE<125 & BRANCHOFFICE>176";
              System.out.println("s1 = " + escape(s1));
         private static String escape(String s)
              s = replace (s, "&", "&");
              s = replace (s, "<", "<");
              s = replace (s, ">", ">");
              return s;
         private static String replace(String original, String find, String replacement) {
              int i=0;
              if ((i=original.indexOf(find)) > -1) return original.substring(0, i) + replacement
                   + replace(original.substring(i+find.length()), find, replacement);
              else return original;
    }

  • Procedural ABAP refactoring or mass source code replacement

    I am trying to change hard coded values from multiple source codes with respective constant names. Is there a tool to find and replace them according to a rules table. I wouldn't mind even if this tool was not in SAP (eg. Eclipse).
    Thank you in advance,
    Michalis.

    Dear Thomas,
    thank you for your prompt response.
    My idea was (and is) that since the ABAP compiler is embedded in Netweaver, it would be smart to get the compiler functionality together with regular expressions declaration in order to do what unix like systems do for years, replace strings with other strings. The program you suggest is well known for finding literals (substrings) in source, but when it does you never know what is the role of the literal on the source code line (in the particular code statement).
    Of course I agree with you regarding the term refactoring, that a human eye is needed, if I was to do real source code pattern recognition and replacement, but my driving need is more simple and way far from that (at least for now).
    Please keep me posted in case you have any news on the subject.

  • Abap code :replace the bank values of Dataefield to 20990101

    Please correct my abap code I am just trying to replace the bank values of Dataefield to 20990101 but i am getting the error invalid dataformat '00000000 '. Please correct my IF statement so that I can get this resolved
    IF SOURCE_FIELDS-DATETO = '00000000 '
    RESULT = '20990101'.
    ENDIF.
    Thanks'
    Soniya

    Hi ,
    take the Result should be date data type.
    Data : Dateto type sy-datum,
              Result type sy-datum.
    IF SOURCE_FIELDS-DATETO = '00000000 '
    RESULT = '20990101'.
    EndIF.
    I hope it resolved.
    If helpful , plz rewards it.
    Regards,
    Vishvesh.

  • What is the most important part of PC to speed up global code replacement on thousands of pages?

    Hi,
    I hope you can help and give me an advise.
    I have a task to replace part of HTML code on a lot of websites with thousands of pages. On my PC Core Duo the process off relpacing bit of codes is quite slow. I am looking for a new PC and taking this task into account. What part of the PC would speed up this process the most and what configuration would you reccommend. Is the fastest processor most important, more fast memory or Ultra fast HDD. I believe all are important but I have to cut the corners and get the best cost/speed solution for that task. Many thanks for your help in advance.

    Coming from a single core 32 bit Windows 7 to a quad core 64 bit with Windows 8, I noticed a marked improvement in pereformance on "batch changes". While the RAM usage is realtively the same (nearly 50% of 2Gb on the old, and only slightly more than 1Gb of 4 on the new) I'd say the processor has a lot to do with it. The old was 2.1gHz, and the new is 2.4, but having three more cores and a 64 bit architecture makes it run much faster.

  • CS4 - How to woraround bug of character code replacing?

    Hi,
    It seems that Adobe and earlier Macromedia are nursing
    serious bug well
    known from version MX. It lies in keyboard characer
    conversion to strange
    codes when right ALT is pressed and <PARAM> "wmode" is
    used (most likely it
    happens in mode transparent and opaque only). In consequence
    it is not
    possible to enter Polish character to input fields. It works
    fine in
    standalone Flash player.
    There is no place to count Adobe on fixing it and I have to
    do something by
    myself. Is it possible to build eg. component or class which
    will convert in
    the fly key codes of pressed button for TextField. and
    components such as
    TextArea and TextInput? How to get down to do that? Any
    suggestions?
    Pozdrawiam,
    Marek

    Hi,
    It seems that Adobe and earlier Macromedia are nursing
    serious bug well
    known from version MX. It lies in keyboard characer
    conversion to strange
    codes when right ALT is pressed and <PARAM> "wmode" is
    used (most likely it
    happens in mode transparent and opaque only). In consequence
    it is not
    possible to enter Polish character to input fields. It works
    fine in
    standalone Flash player.
    There is no place to count Adobe on fixing it and I have to
    do something by
    myself. Is it possible to build eg. component or class which
    will convert in
    the fly key codes of pressed button for TextField. and
    components such as
    TextArea and TextInput? How to get down to do that? Any
    suggestions?
    Pozdrawiam,
    Marek

  • Unexpected keyboard codes replacements

    Hi,
    It seems that Adobe and earlier Macromedia are nursing
    serious bug well
    known from version MX. It lies in keyboard characters
    conversion to strange
    codes when right ALT is pressed and <PARAM> "wmode" is
    used (most likely it
    happens in mode transparent and opaque only). In consequence
    it is not
    possible to enter Polish (and maybe other non-ASCII)
    characters to input
    fields. It works fine in
    standalone Flash player.
    There is no place to count Adobe on fixing it and I have to
    do something by
    myself. Is it possible to build eg. component or class which
    will convert on
    the fly key codes of pressed buttons for TextField. and
    components such as
    TextArea and TextInput? How to get down to do that? Any
    suggestions?
    Regards,
    Marek

    Hi DmR,
    You can see all the characters for any font installed on your system by using the Character Palette. To enable it, go to System Preferences and choose International. Then, select Input Menu in the bar at the top and look at the bottom of the window. There will be a little option box that says "show input menu in menu bar." Check it.
    You will see a flag show up in the menu bar. Click on this flag and choose Character Palette. From there you can see all the "hidden" characters available.

Maybe you are looking for

  • Mysterious usage of my external HDD space after last backup on TM?

    Recently, after some problems with TM giving me a pop up error, I turned off TM and used my WD MyBook as a normal external and have just been copying files onto it. Last night, I figured it has been a bit too long since I last backed-up my mac's HD (

  • Stripping all HTML tags from a CLOB

    Hi all, Running Oracle 9.2.0.8 on AIX... We have a table which stores HTML document fragments in a clob. I have a requirement to convert these to plain/text (strip all HTML tags) for sending in a plain/text email body. I have read the following solut

  • -10003 error at SXCI_Scan_Config

    I'm trying to do a low-level SCXI multichannel acquisition using the following hardware: PXI 1010 chassis (combined PXI & SCXI) PXI 6030E in slot 8 (communicating with the SCXI) 1 1021 SCXI module in the first slot When I call SCXI_SCAN_Config to pre

  • Invalid Sim on unlocked iPhone 5

    Hi I bought a factory unlocked 16GB iPhone 5 from USA. When I insert Airtel (india) nano sim, it says Sim not valid. I checked with an apple store, they say it's locked to AT&T. But it was supposed to be an unlocked phone (649$ + taxes). Though befor

  • MacBook Pro i5/i7

    Hi, I've been using Macbook from 2007. I'm very much addicted to apple from then. Now I would like to upgrade my Mac book to Mac book PRo. I'm confused about i5 or i7. 13". Kinda applications I use are: FCP(started to edit my videos), I like to recor