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.

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.

  • How can i forward a request one jsp to another jsp?

    as per my knowledge
    using jsp action tags that forward and include
    and first loaded the ServletContext objects and retriving that context objects...
    so i want one more any otherway can u help me?

    sreeman wrote:
    as per my knowledge
    using jsp action tags that forward and includeThe <jsp:forward> indeed forwards the request. The <jsp:include> doesn't.
    and first loaded the ServletContext objects and retriving that context objects...I don't get you?
    so i want one more any otherway can u help me?Why do you want that?
    There is a dedicated subforum for JSP and Servlets. For future JSP or Servlet related questions please make use of it.
    JSP and JSTL: http://forum.java.sun.com/forum.jspa?forumID=45
    Servlets: http://forum.java.sun.com/forum.jspa?forumID=33

  • How to port forward in windows server 2012 ? for IIS

    Hi,
    I have windows server 2012 in AWS cloud (Public IP)
    Installed IIS 8 and running website in the port 8980 and its working fine (Public IP)
    My question is
    I have CNAME record in Godaddy in the name of example.com which is pointed to my PUBLIC IP ... its working fine. 
    But I want to know how to port the 80 request to 8980 in windows server 2012 thanks.
    Wes

    Hi,
    According to your description, my understanding is that you want that example.com(in Godaddy) to transfer corresponding queries(port and website name) to the website on WS 2012(in AWS cloud).
    Since your domain example.com is supported by Godaddy, I recommend you to contact the supporter of Godaddyand confirm that if their product supports port forwarding.
    In general, if you useWindows ServerInstruction, we may enable NAT(Routing and Remote Service) on network interface to redirect services/ports.
    Best Regards,
    Eve Wang
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Need to change the local change request to development class for Process Ch

    Hello ,
    I have created a Tranport request for Process chain but its saved as local change request .
    Please suggest how to change that .
    Thanks ,
    Rahul

    Hi
    1.First delete the request which you collected the process chain as local object becuase you will not able to collect the process chian again.
    2. Goto Tranport connector to collect the process chain again.
    3. Select grouping option as necessary objects.
    4. Drag and drop the process chain to the right hand side
    5. After collecting the process chain, click on the package icon and give the package created for development class.
    6. The system will ask for Transport request and save the PC in the Transport Request.
    Hope it helps.
    Regards
    Sadeesh

  • How to redirect all Tomcat request to a servlet

    How can I set up Tomcat to redirect all request to a certain sevlets which sends the user to the right web-application.
    What ever the user type in the URL, i.e.:
    http://customer01.myDomain.dk
    or
    http://customer02.myDomain.dk
    or
    http://customer01.myDomain.dk/myApp/login.jsp
    - I want tomcat to redirect to a servlet class. Is that possible?
    Thanks

    Yes but pretend each customer has more than one web-application. Then it is not possible for the customer to use only this URL:
    http://customer01.myDomain.dk
    Each customer need a seperate url for each application, something like this:
    http://customer01.myDomain.dk/myApp01/login.jsp
    http://customer01.myDomain.dk/myApp02/login.jsp
    ( easy URL�s they can remember )
    And I don�t think it is possible to make an alias to the exact URL to the web application. That�s why I need Tomcat to redirect all request to i.e. Index.jsp which then redirect to the correct application.
    Here is an example:
    Customer01 type in:
    http://customer01.myDomain.dk/myApp01/login.jsp
    Tomcat calls Index.jsp which redirect to this URL:
    http://www.myDomain.dk/myApp01_ID0921/login.jsp
    Can you help me with this problem?

  • How to create own functions in the decision maker for process chains?

    I need a further function which is not already implemented and available in the decision maker of the process chains. But I do not know how to implement a new function.
    Please give me some help!!!!!

    What does the new function need to do?
    You may have to create a new process type.  There are a few white papers and blogs about different ways of doing this.  Needs ABAP knowledge however.
    matt

  • RE: How to break up the selection into smaller portion for processing

    User enter a range of articles with options.
    How can I extract the info from a master table (very massive in MARD)
    a. to output to a internal table with 5000 records AND then process it AND THEN
    b. refresh the internal table, fillup with another 5000, continue from the last stop point
    c. Process the data, refresha and load the next batch as long as it is within the article selection range.
    Can someone help me by providing some sample coding on it?
    Thanks
    bye

    Try this logic..
    use 2 internal tables gt_table ( which has values ) gt_table1.
              IF sy-subrc = 0.
                DESCRIBE TABLE gt_table LINES gv_lines.
                IF gv_lines LT 5000.
                  gv_times = 1.
                ELSE.
                  gv_times = gv_lines / gc_5000.
                  gv_times = gv_times + 1.
                ENDIF.
                gv_begin = 1.
                gv_end = gv_begin + gc_5000.
                DO gv_times TIMES.
                  REFRESH gt_table1.
                  APPEND LINES OF gt_table
                           FROM gv_begin TO gv_end TO gt_table1.
                  IF sy-subrc <> 0.
                    CONTINUE.
                  ENDIF.

  • How do i extract supporting documents out of PLM for Process?

    We need a process to extract the supporting documents out of PLM for process in order for us to save them out on the sharepoint for the users who do not have access to the application.
    Thanks!

    I can retrieve documents from iCloud.com on my iMc at work that is running OS X 10.4.11. I do it all the time.
    Log into iCloud.com and the iWorks icon. In the next window you can click on Pages, Keynote or Numbers at the top. When you click on Pages - all of your Pages files will appear in the browser window. Tap on any of the documents and you can download them to the Mac.
    You can do the same thing in the Keynote and Numbers sections of your iCloud account - you do not need to be running Lion or Mountain Lion in order to do this using a browser on the Mac. You may get a "unsupported browser" warning depending on what browser you use (Safari is the best choice for this) but it will work anyway, just ignore the message.
    BTW ... The documents should be on your iPad in the Pages, Keynotes and Number apps anyway. If they are, you can use file sharing to get them into iTunes and from there yoy can save them to your desktop on the Mac.
    When I copy and paste this from a Google search, this does not show up as a valid link in blue type, but you can tap or click on the "iOS: About File Sharing" heading and it should open the kb article anyway.
    iOS: About File Sharing
    support.apple.com/kb/HT4094
    Jul 6, 2011 – Using iTunes 9.1 or later, you can copy files between your computer and apps on your iOS device that support File Sharing (for example, Pages ...

  • Forward a request with post data to another webApp

    Hello,
    I have a servlet that recieves data by post. I need to forward that request with the same info it recieves to another webApp in a different EAR
    I know it is possible to forward that request to another servlet in the same webapp, how to do that but to a different webApp in post method (No get method, do no sendRedirect)?
    Thanks.
    Jean-Philippe

    ServletContext otherContext =
    context.getContext("/otherWebApp");
    RequestDispatcher dispatcher =
    otherContext.getRequestDispatcher("/otherServlet");
    dispatcher.forward(request, response);Interesting. If I read this correctly you CAN actually use RequestDispatcher.forward() to redirect a user after they've contacted the web-server? i.e. Using the otherContext will cause the response that the web-server generates to come from /otherWebApp? That's cool...
    Brian

  • Forwarding the request to a blob

    Hi..so I have a html in the database stored as a blob. I retrieve that from the database inorder to forward the request to that html. But how can I acutally forward the request to a blob? There is no physical file present. And I am not even allowed to write that blob into a file and forward the request. Is there any other way to solve this problem? Also if I have a css file in a blob, how can I actually embed that css data onto my html blob data?
    TIA

    You forward the request to a servlet that reads the blob and copies it, byte for byte, to its response's output stream.
    And if you want to serve your CSS from a blob, do the same thing. Don't try something ridiculously drastic like trying to apply the CSS to the HTML on the server side.

  • 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.

  • How to use a subreport field as selection criteria for the main report

    Dear All,
       I created a report with one subreport and im comparing information from both reports but i need to apply selection criteria in the main report using one of the fields in the subreport, the problem is that the subreport field doesnt appear in the select expert screen. By any chance, someone knows how make a subreport field be used by the select expert.
    Thanks,
    Martha Medrano

    Dear Dom,
       I created the subreport table called IIM (748 items) in sql in the main report as you suggested with the below code:
    SELECT "IIM"."IPROD", "IIM"."IDESC", "IIM"."IID"
    FROM   "S102F360"."BPCS405CDF"."IIM" "IIM"
    WHERE   NOT ("IIM"."IDESC" LIKE 'GEN%' OR "IIM"."IDESC" LIKE 'OBS%') AND "IIM"."IID"<>'IZ' AND "IIM"."IPROD" LIKE '3%'
    and i have another table called ITEM_MASTER (3221 items):
    SELECT "ITEM_MASTER"."ITEM_ID", "ITEM_MASTER"."DESCRIPTION"
    FROM   "WHSPRO"."dbo"."ITEM_MASTER" "ITEM_MASTER"
    ORDER BY "ITEM_MASTER"."ITEM_ID"
    and im trying to display all items in the ITEM_MASTER table that are not in the IIM file but i haven't been able to accomplish this, i am using as primary the ITEM_MASTER table with 'Inner Join' as Join Type,  and '!=" as Link Type. Do you have any ideas on how can i display the requested items.
    Thanks for your help

  • Request workspace not asking for user ID

    I don't want the email address to be the workspace administrators user ID..
    How can I get the Request Workspace to prompt for a User ID..
    also, can the schema name be defaulted to the value they entered for the workspace name..

    Merlin,
    >> How can I get the Request Workspace to prompt for a User ID..
    Unless you author your own provisioning system on top of the APEX PL/SQL APIs, you cannot.
    >> can the schema name be defaulted to the value they entered for the workspace name..
    Same answer as above.
    Joel

  • How to get JSP to forward a request over SSL?

    I'm new to JSP and servlets, although I've been working with Java for a long time. I'm trying to write a simple user registration and login system to teach myself JSP. I would like to set things up so that the user is able to login securely over https. I'm not sure how to do that, though. There seems to be no place in the relative URLs to indicate that you should be forwarding a request over SSL. I've got sample login page below - would anyone know how to modify it so that it happens securely?
    Also, do I need to install a certificate on my web server?
    index.jsp
    <html>
        <body>
            <h1>Index</h1>
            <a href="login.jsp">Login</a>
        </body>
    </html>login.jsp
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <body>
            <h1>Login</h1>
            <jsp:useBean id="userLogin"
                         class="com.kitfox.webrpg.UserLogin"/>
            <jsp:setProperty name="userLogin"
                             property="*"/>
            <%if (userLogin.isValid()) {%>
            <jsp:useBean id="userId"
                         class="com.kitfox.webrpg.UserIdent"
                         scope="session"/>
            <jsp:setProperty name="userId" property="*"/>
            <jsp:forward page="index.jsp"/>
            <%} else {%>
            <form action="login.jsp" method="post">
                <fieldset>
                    <legend>Enter login information</legend>
                    <label for="login">Login</label>
                    <input type="text" name="login" value="${userLogin.login}"/> <br/>
                    <label for="password">Password</label>
                    <input type="password" name="password"/> <br/>
                    <input type="submit" value="submit">
                </fieldset>
            </form>
            <%}%>
        </body>
    </html>

    <security-constraint>
    <web-resource-collection>
    <web-resource-name>Secure Login</web-resource-name>
    <url-pattern>/login.jsp</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
    </security-constraint>
    This code is used basically for different authentication type . Forward to any jsp under any layer works with <jsp:forward> or else try with request.getRequestDispatcher(" url (can be absolute or accurate path)").forward(request,response);
    Edited by: user8483670 on Mar 13, 2011 9:46 PM

Maybe you are looking for

  • How do i setup a itunes store account without a credit card?

    how do i setup a itunes store account without a credit card? i need to setup a account for the album artwork please help.....

  • Validation at the network level

    Hi Experts,          I am doing the validation for the network at the header level for the resposible cost center field. I am giving Prerequiest as Req.cost center = 'X' Check as i am not entering anything in the check condition Message I am entering

  • Persist XML Data to Database Table - Generic XML Schema

    Hi, I would like to represent data in XML format and persist to any database tables. The ideal xml is like: <TABLE NAME="TABLE1"> <TABLEDEF><COLUMN NAME="COLUMN1"/><COLUMN NAME="COLUMN2"/></TABLEDEF> <ROW><COLUMN VALUE="value1"/><COLUMN VALUE="value2

  • Photoshop download failed 2x. indesign worked fine? download error. update failed.

    first download, patch failed...this time update failed? removed file before second try. please dont reply just to get points. I need this to work. my business depends on it. please help. I don't know how to get "log info" either.

  • Code/Content Assist and Maven Multimodule

    Hi All, I've found a VERY weird anomaly while developing with Flex Mojos (Maven Plugin) and Flex in Eclipse. What I've noticed is if I embed the Flex 4 project inside of a Maven Multimodule project, the Code/Content Assist in Eclipse/Flex Builder see