Forward a request from a filter

Hi,
I want to be able to access a page
www.whatever.com/page.jsp?username=me&content=something
with the url
www.whatever.com/user/something
I am thinking doing it with a filter that parses out 'user' and 'something' in the second url and forward the request to the first url. What's a way to forward a url in a filter, yet the other filters in the web app still executes?
I have tried using the RequestDispatcher, however after the dispatcher I can not run the other filters or I will get illegleState exception. Any sugguestions? Thanks.

From SRV.11.2 in the servlet spec:
SRV.11.2 Specification of Mappings
In theWeb application deployment descriptor, the following syntax is used to define mappings:
" A string beginning with a / character and ending with a /* suffix is used for path mapping.
" A string beginning with a *. prefix is used as an extension mapping.
" A string containing only the / character indicates the "default" servlet of the application. In this case the servlet path is the request URI minus the context path and the path info is null.
" All other strings are used for exact matches only.
Filter mappings work the same way.
The wildcards do not work the same way that they do in regular expressions.
What you might want to do is use a mapping of *.do and then use a regular expression within your filter to decide which URL to act on and which to let pass untouched.

Similar Messages

  • How can I forward a request from to another servlet?

    If I would like to forward a request from a servlet to another one, but they are not located in the same machine.
    Could I use the following code to do it?
    getServletConfig().getServletContext().getRequestDispatcher("XXXXX").forward(request, response);

    You can not do a forward to a servlet on a different server. You can do a redirect and put any parameters you want to pass in the url. If you are using JSP you may bve able to use the JSTL include tag, again passing the parameters in the URL. You could use the URLConnection or HttpURLConnection class to open a connection to the servlet, make a request, get the response and the return the response to the client.

  • Forwarding proxy requests from ports other than 80

    Hi,
    Is there a way to forward requests from ports other than 80 to the proxy address? For example, trying to define a rule to forward the requests from port 8080 to proxy_ip...
    Best regards,
    Emre

    Hi Emre,
    Have you looked into using ipfilter port redirecting ?
    It may depend on your configuration.
    /etc/ipf/ipf.conf
    pass in quick from any to any port = 8080 keep state
    pass out quick from any port = 8080 to any keep state
    /etc/ipf/ipnat.conf
    rdr <Interface> <hostname or IP> port 8080 -> <hostname or IP> port 8080 tcp
    Edited by: Hodware on Mar 4, 2013 7:24 AM

  • How to forward the request

    hi all,
    can somebody tell me how to forward the request from one context to another.
    thanks in adv.
    ritu

    Ritu, when you are talking about a different context are you talking about application, session and page contexts?? If yes, then I don't think you can forward a request to another context!
    If you are after a context (bean) from within your servlet, have you tried:
    mycontext = (MyContextClass)getServletContext().getAttribute("thenameofmycontext");HTH.

  • Logging of Forwarded HTTP Requests using RequestDispatcher in Weblogic

    Can anyone help me on this?
    Logging of Forwarded HTTP Requests using RequestDispatcher in Weblogic
    Access Log File:
    1. I have a servlet(S1) which decides which JSP to be published based on
    some logic. If I try to forward the request from a servlet to a JSP or to
    another servlet from within S1 using RequestDispatcher, it doesn't get
    logged in the access log, only the initial request to S1 gets logged, when I
    switch on HTTP logging by setting weblogic.httpd.enableLogFile to true. Is
    there any way of logging this forwarding of request in the access log?
    2. If there is no solution for (1), I woiuld like to make entries into the
    access log file of weblogic in the common log format, when I forward a
    request to a JSP or a servlet throught the RequestDispatcher, so that I can
    use standard tools to analyze the logfile.The two issues with this are (i)
    is there any weblogic service that gives a handle to the access log file
    like the LogServicesDef which gives a handle to the weblogic log file. (ii)
    Is there any utility class available that can format a URL pointing to a JSP
    to a string confirming to the common log format.

    The log4j:ERROR messages are not coming from Log4j 2 and are most likely from Log4j 1.x. Somehow Log4j 1.x must be getting the log4j2 configuration.

  • IllegalStateException when forwarding a request

    I am getting the following exception
              java.lang.IllegalStateException: Cannot forward a response that is
              already commi
              tted
              when I try to forward a request from one JSP page to another. The code
              at which which the error occurs is
              context.getRequestDispatcher("/resource/resourceView.jsp").forward(request,response);
              --Vishal
              

    Try this
              config.getServletContext().getRequestDispatcher("("/resource/resourceView.js
              p").forward(request, response);
              La
              Saravanakumar wrote in message <8is81g$fud$[email protected]>...
              >If the JSP page output is buffered (by using a page directive with the
              >default value or an explicit size set for buffer), the buffer is cleared
              >before the request is forwarded. If the page output is not buffered (by
              >using a page directive with buffer=none), and if anything has been written
              >to the buffer, an attempt to forward the request results in an
              >IllegalStateException.
              >
              >
              >Vishal Vishnoi <[email protected]> wrote in message
              >news:[email protected]..
              >> I am getting the following exception
              >>
              >> -------------------------------------------------------------------------
              >-----------
              >>
              >> java.lang.IllegalStateException: Cannot forward a response that is
              >> already commi
              >> tted
              >> -------------------------------------------------------------------------
              >-----------
              >>
              >> when I try to forward a request from one JSP page to another. The code
              >> at which which the error occurs is
              >>
              >>
              >context.getRequestDispatcher("/resource/resourceView.jsp").forward(request,
              r
              >esponse);
              >>
              >> --Vishal
              >>
              >
              >
              

  • Trouble forwarding request from a servlet to a JSP in OAS 4.0.8.1 on NT

    The OJSP release notes state that:
    "Servlets and JSP cannot coexist as the same application" and "Requests cannot be passed between two separate applications."
    Does this mean that my attempts to use the
    the servlet RequestDispatcher to forward a request to a JSP are futile? If so, is this a problem that will be fixed in the future? I would like to use this feature!
    This is the code (based on a sample from Sun's JSWDK 1.0.1) that doesn't work:
    servletToJsp.java
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class servletToJsp extends HttpServlet {
    public void doGet (HttpServletRequest request,
    HttpServletResponse response) {
    try {
    getServletConfig().getServletContext().getRequestDispatcher("/jsp/jsptoserv/hello.jsp").forward(request, response);
    } catch (Exception ex) {
    ex.printStackTrace ();
    I am able to use the <jsp:forward page="/servlets/servletToJsp" /> directive to go from a JSP page to a servlet (across two OAS Applications) and I also can forward a request via the dispatcher from one servlet to another in the same OAS application.
    Any help in this area would be appreciated. Thanks.

    I'm using OAS 4.0.8.1
    You mean servlet to JSP does not work and JSP to servlet works for you????Yes - but I've only tried very simply examples.
    That's different from my understanding. If you are using OAS 4081, both cases should not work.
    The problem you mentioned will be fixed in future release of OAS.That's good to know - thanks!
    null

  • Webdispatcher to forward requests from internet to intranet?

    We need to direct requests from internet to our content server which is in the intranet (so that the content server images can be seen from the internet).
    We have a WAS WebDispatcher in the DMZ. Can we use this WD to provide the connectivity?
    For example:
    Our content server intranet URL is:
    http://contenterv.com:1090/path/image.jpg
    Our WebDispatcher URL is:
    http://webdisp.com/app_name
    http://webdisp.com/app_name  should resolve to http://contenterv.com:1090/path/image.jpg
    We tried WD http forwarding but it just forwards the request, does not resolve the name transparently. So the forwarding works but since http://contenterv.com:1090/path/image.jpg is not known in the internet, it fails.
    Thanks

    >
    Ghochi Elin Kuswoyo wrote:
    > hi guys,
    >
    > you need to add parameter in your sapwebdisp.pfl (sap webdispatcher profile) :
    >
    > icm/HTTP/redirect_0 = PREFIX=/,TO=/path_image
    >
    > thanks
    No, this wont work, becuase you need reverse-proxy function rather than URL redirection, because internet user wont be access the intranet server even you give them the URL.
    I cannot get you the detailed confguration, but you can refer to web dispatcher cascade configuration.  play with the following parameters:
    wdisp/server_info_location
    wdisp/group_info_location
    wdisp/url_map_location
    >
    Cons wrote:
    > So in short, get your networking guys to do this, SAP cannot help in any way.
    it's not ture, web dispatcher can be used reverse proxy, of course you also can use other solution like Apache. However it's not recommened to use NAT, which might breach your network security.
    Cheers,
    Denny
    Edited by: Denny Liao on Jan 28, 2010 11:26 PM

  • Forwarding request from JSP/Servlet to EJB

    Is it possible to forward the HttpRequest,HttpResponse objects from a Servlet/JSP to an Entity/Session bean ?
    ie To forward the call using RequestDispatcher/forward to a Session bean which in turn calls the entiy bean for updating DB
    Ramesh

    I don't think that's possible and even if it is there's an easier way. Normally you just create an instance of the session bean in a servlet and pass it the information. The session bean then calls the entity bean which updates the database. You don't have to forward the request - just pass the data to the bean.

  • Unable to forward requests from webserver

    I am trying to set-up iWS 6.0sp4 to forward requests to the application server but I always get not found as the webserver is just looking at its own document root. I have deployed the fortune ear (from 6.5) and can access that via the application servers own http server perfectly well. I have added the plugin package to the webserver and added the following into the magnus.conf
    Init fn="load-modules" shlib="<install_dir>/lib/webserver-plugin/solaris/iws/libpassthrough.so" funcs="init-passthrough,auth-passthrough,check-passthrough,service-passthrough" NativeThread="no"
    Init fn="init-passthrough"
    and to the obj.conf
    NameTrans fn="assign-name" from="(fortune/fortune/*)" name="passthrough"
    NameTrans fn="assign-name" from="(fortune/*)" name="passthrough"
    ObjectType fn="force-type" type="magnus-internal/passthrough"
    Service type="magnus-internal/passthrough" fn="service-passthrough" servers="http://<application server http listener>"
    Error reason="Bad Gateway" fn="send-error" uri="$docroot/badgateway.html"
    </Object>
    The webserver starts up without any errors but never forwards any requests what might I be doing wrong?

    I followed the instructions found in the App Server 7 documentation and everything worked fine.
    The instructions I followed are in the document found at this link:
    http://docs.sun.com/source/816-7156-10/agplugin.html#17655
    Just FYI...
    I also checked with Sun about why this process is now necessary and I asked about what happened to the web connector from 6.x. Sun had this reply:
    The Web Server Plug-in is the new web connector. It just hasn't been wrapped with an installation yet ... which is why it is tedious. The old Plug-in for 6.5 would ultimately have the same type of obj.conf entries. I'm not sure if there will be an installation wrapper for it once the Enterprise Edition is released.
    The Web Server Plug-in is different right now in that it doesn't 'know' about multiple instances yet. These are capabilities that will be introduced in the Enterprise Edition in March. Of course, that doesn't stop you from having multiple instances of the web server talking to multiple instances of the app server. It just means that the web server instances have to be directed to the app server instances rather than discovering them.

  • How to configure bea apache plugin to forward request from apache to bea se

    Hi,
    I have an apache server and a bea weblogic application server. For security reasons, I wold like to configure a bea plugin on the apache server to redirect the client http/https requests from the apache2 server to bea application server.
    I have gone through the bea documentation and configure my apache2 httpd.conf as follows
    LoadModule weblogic_module modules/mod_wl_20.so
    <IfModule mod_weblogic.c>
    WebLogicHost myweblogic.server.com
    WebLogicPort 7001
    MatchExpression *.jsp
    </IfModule>
    <Location /weblogic>
    WebLogicHost myweblogic.server.com
    WebLogicPort 7001
    SetHandler weblogic-handler
    PathTrim /weblogic
    </Location>
    Then Restarted the apache2 and tryied to acces bea application through http://myweblogic.server.com/weblogic/
    and http://myweblogic.server.com/something.jsp
    It did not work
    httpd is started propery.
    Any help would be highly apreciated
    Many Thanks
    Ushas Symon

    I have no experience with nginx and varnish and asking configuration problems regarding these products is perhaps beyond the scope of this forum.
    While configuring varnish, we are getting issues and unable to connect server from my browser if I change port 80.
    You did not describe the issues, but it is possible and very common that your IP Firewall is blocking access to ports other than 80 and 22. For testing, you can simply turn it off. If you do not know how, please post your OS distribution version first, as it all depends.

  • ISE 1.3 not receiving Radius requests from WLC 5508 ver 8.0.110.0

    Hello all. I just implemented ISE 1.3 at a customer site. added a WLC running 8.0.110.0 using its mgmt address with a RADIUS preshared key. On the WLC, I created to SSIDs, corp and guest.
    For corp I configured WPA2 and AES and forwarded Radius requests to my 2 ISE node PSN interfaces
    For the guest I configured MAC filter with advanced features AAA overide and Radius NAC - per Cisco's documents
    The corp forwards Radius requests to ISE, the guest does not. I get nothing from the guest.
    I configured the WLC step by step from the Cisco document. I have completed over 10 ISE implementations in the last year using ISE 1.2 and WLC 7.x and have never run into this issue before.
    Any help will be much appreciated.

    This issue has been resolved. The issue was that for the guest SSID MAC filtering was enabled as required, but they had the test PCs on a mac filter bypass list for that SSID in the WLC. This was automatically authenticating the PC, and therefore not forwarding the RADIUS to ISE.
    Once we removed the PC from the MAC filter list in the WLC, the authentications were forwarded to ISE as desired.

  • How to conditionally forward a request to a Servlet for processing?

    Hi,
    I am writing a middleware application, where the application receives HTTPRequest from front end, and based on the URL string it will forward the request to one of the servlets which will handle the processing.
    I need ideas about what is the best way to write the forwarding logic. Should it be a Servlet Filter, or an initial Servlet that only does forwarding? Any code samples will be greatly appreciated.
    Thanks.

    This is almost textbook definition of a Controller Servlet. I would use a Servlet that switches on what option needs to be performed and forwards to the proper URL.

  • Forward to new URI with filter

    Hello-
    I would like to use a servlet filter to forward my users from:
    http://www.mydomain.com/files/1234
    to
    http://www.mydomain.com/files
    I have attempted to use RequestDispatcher.forward, however, this seems to send two requests to my target servlet (one with the new URI and with the old one). Both requests will reach the same servlet, but the idea is to use "1234" elsewhere in the code. I cannot use a standard query string parameter as this is for a WebDAV interface and the WebDAV clients I have tried do not seem to handle query string parameters well.
    Thanks!

    I can't see a way of doing this in the struts config file (in Struts 1, at least).
    A possible workaround would be to use the HTML "target" attribute when the user clicks a link from the previous page to trigger your action. Use Javascript so that the link on the previous page submits your form.
    Just be aware that this solution is not robust if the client browser has Javascript disabled.

  • Including Objects in Request from Other System

    I've got an interesting question. This will be hard to explain but here goes: You know how you can u201CInclude Objects in Requestu201D? E.g. create a new request from an old one and copy the keys from the old one to the new one. That way when you release the new request it gets the current version of all the objects.
    Well I want to do that except in different systems. For example I have request SBXK900123 in system SBX with some objects in it. I want to create a request in DEV with the same object list. So then I can release the request from DEV to QAS & PRD. I don't want to transport from SBX and I want the versions of the objects in DEV, not SBX.
    I tried adding SBXK900123 to DEVu2019s import buffer without actually importing it. It gets added to the buffer but in SE09 Transport Organizer in DEV the system doesnu2019t see SBXK900123. So I canu2019t include the objects in SBXK900123 in a new request in DEV. If I actually import SBXK900123 into DEV then the Transport Organizer sees it but of course I donu2019t want to import from SBX to DEV.
    Any thoughts?

    Thanks Gentlemen, I appreciate your help.
    Hereu2019s some clarification. This is just a one-time thing, however copy and paste will be difficult because there might be hundreds of tables with thousands of entries. Since they are primarily config entries I would have to drill into each view/table to display all the keys. The ABAP approach might have promise but since I am not an ABAPu2019er, and getting ABAP help is difficult at my company, Iu2019m still looking.
    Roman, yes that is exactly what I am doing however the request isnu2019t available from the display button in SE09. Are you sure you didnu2019t also import the request? Thatu2019s the only way I can make it available; Iu2019ve tried Add to buffer and forwarding to system client. It is in the import queue but in SE09 I still get the message:
    Request/task SBXK900035 does not exist
    Message no. TR806
    Diagnosis
    Request/task SBXK900035 cannot be edited because it does not exist in this SAP  system.
    System Response
    The function is terminated.
    Procedure
    Repeat the function with an existing request or task.
    If you didnu2019t import the request, how did you add it to the buffer to make it available in SE09? Well, thank you all.
    David

Maybe you are looking for

  • HT204053 I recently changed my apple id to a new email.  I cannot get my devices back online with my new apple id in the icloud

    I recently changed my apple id to a new email at the same time getting a new Iphone 5.  I cannot get all my devices back online with icloud since.  It is still showing my old email even though I changed it and logged in under the new one.  My icloud

  • Access Sequence JEXC missing after upgrade to EHP7

    Dear Experts, we are facing an error while saving excise invoice through transaction J1IIN in development system after upgrade to EHP 7, Access sequence JEXC missing  ( ) Message no. VE306, could you please suggest to find out solution. Regards, Amit

  • Problem using WEBUTIL_FILE_TRANSFER.URL_To_Client_With_Progre

    Dear Friend, Whenever I am trying to transfer the report using WEBUTIL_FILE_TRANSFER.URL_To_Client_With_Progress the report is getting transfered from application server to client successfully. But when i am opening the report at clientside adobe rea

  • Downloaded songs lost

    i purchased an album on iTunes and was having problems with my internet connection and downloading. before it could finish my computer froze and i was forced to restart. when i reopened iTunes, it didn't have the album. does anyone know how i can eit

  • Flash image not showing up?

    Kay, so I uploaded my website & the flash image/logo I created for the website just doesn't show up. Instead, in it's place, is a "dot dot dot". Literally a few ..... that flash in as if it's loading & the dots just keep looping. It shows up on my co