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

Similar Messages

  • How to get an answer for Support Request Number 12...

    How to get an answer for Support Request Number 1277702580 ?

    Has your speed problem been resolved, or do you need assistance?
    There are some useful help pages here, for BT Broadband customers only, on my personal website.
    BT Broadband customers - help with broadband, WiFi, networking, e-mail and phones.

  • My boss is on Entourage/MAC 2003 and I am on Windows 2007, I cannot seem to work out how to get copies of his meeting requests. The manual says tick 'send copies to delegate' but there is no box in that version to tick. Anyone?

    My boss is on Entourage/MAC 2003 and I am on Windows 2007, I cannot seem to work out how to get copies of his meeting requests as his only delegate.
    The manual says tick 'send copies to delegate' but there is no box in that version to tick. Anyone?
    Thanks!
    Beth

    My boss is on Entourage/MAC 2003 and I am on Windows 2007, I cannot seem to work out how to get copies of his meeting requests as his only delegate.
    The manual says tick 'send copies to delegate' but there is no box in that version to tick. Anyone?
    Thanks!
    Beth

  • How to get a parameter from each request in a session scope BackingBean

    While calling my JSF page, I pass an id as parameter in the URL, and in the Backing bean I retrieve it from the request.
    On each request I need to get the id and populate the page accordingly.
    But I am forced to create my Backing Bean in session scope b'cos otherwise ValueChangeListener method does not work properly.
    So where and how do I get the id on each request?
    Pls. help

    What you can do is create it in the request scope like this:
    <managed-bean>
          <managed-bean-name>personBean</managed-bean-name>
          <managed-bean-class>
            com.PersonBean
          </managed-bean-class>
          <managed-bean-scope>request</managed-bean-scope>
           <managed-property>
                 <property-name>id</property-name>
                 <property-class>java.lang.Long</property-class>
              <value>#{param.id}</value>
          </managed-property>
    </managed-bean>And then in the page use a hidden field to set the id in case of a postback (validation error):
    <h:inputHidden id="id" value="#{personBean.id}"/>Does that help you?
    Thomas

  • How to get multiple phones in a request with SelectCmDevices

    Hi all:
    I had met this problem, i can get only one phone with this request:
    "<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
    "xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:soap=\"http://schemas.cisco.com/ast/soap/\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"> " +
    "<soapenv:Header>" +
    "<AstHeader xsi:type=\"soap:AstHeader\">" +
    "<SessionId xsi:type=\"xsd:string\">1234567</SessionId>" +
    "</AstHeader>" + "</soapenv:Header>" + "<soapenv:Body>" +
    "<soap:SelectCmDevice soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">" +
    "<CmSelectionCriteria xsi:type=\"soap:CmSelectionCriteria\">" +
    "<SelectBy xsi:type=\"xsd:string\">Name</SelectBy>" +
    "<Status xsi:type=\"xsd:string\">Registered</Status>" +
    "<Class xsi:type=\"ns1:DeviceClass\">Phone</Class>" +
    "<Model xsi:type=\"xsd:unsignedInt\">255</Model>" +
    "<SelectItems>" + "<Item>" + macadd +
    "</Item>" + "</SelectItems>" + "</CmSelectionCriteria>" +
    "</soap:SelectCmDevice>" + "</soapenv:Body>" +
    "</soapenv:Envelope>";
    But how can i to get multiple phones in a request? i had tried many methods, but all of them are not work. Thanks for any helps!

    Hi msabir:
    Thanks for your help. Yea,i don't want to get the first 200 phones, i just want to get the phones which are listed in the items.For example:
    "SEP0013192F15DU"+
    "SEP000E839C1479"+
    "SEP00131A4D3B34"+
    "SEP001D450BF4CF"
    ,then i just want to get the four phones, but when i do like this,i always just got one phone,why is that? Then i changed to use Array like this:
    "http://schemas.xmlsoap.org/soap/encoding/\">" +
    "" +
    "" +
    ""+
    ""+
    "10"+
    "Phone" +
    "255" +
    "Any" +
    "Name" +
    "" +
    ""+
    ""+
    ""+
    ""+
    ""+
    "SEP001D450BF4CE"+
    ""+
    ""+
    "SEP00131A4D3B34"+
    ""+
    But it alway throws this error:
    soapenv:Server.generalExceptionERROR: SelectBy is null
    why? Thank you very much!

  • How to get data from OTF spool request number

    Hi all,
            How to get OTF Data from the spool request number (OTF)?
            How to create spool request from the OTF Data?
    Regards,
    Sunil Kumar

    Hi,
    Check this links:
    http://www.sapdev.co.uk/reporting/rep_spooltopdf.htm
    Sending Mail from SAP
    https://wiki.sdn.sap.com/wiki/display/sandbox/SendMailwithPDFAttachment?showChildren=false#children

  • How to get the list of imported Requests in client

    Hi All,
    We have two clients in Qas server , 300 and 400, i want to get the list of change requested in only in client 300 but not in 400.
    Please assist.
    Regards,
    SM

    Hi Shine
    Simply use transaction se01 then click display button, it will show all transport request in hierarchcally with differebt clients in the server.
    You can use one more t code scc3 to view all transport request
    Regards
    Vinay Paul

  • How to get rid of duplicate addresses all over the place?

    Duplicate addresses appears all over the places: on my mac (in the mail program) and in my ios devices.
    I suspect that it occurs during some synchronisation activities but how to get rid of this once and for all?
    Thanks for your help. It helps also if some tell me that I am not alone in that kind of trouble

    iCloud- Resolving duplicate Contacts after setting up iCloud Contacts

  • BizTalk Tracking Profile Editor not tracking the data and how to implement the Orchestration as wcf service over SSL

    Hi Ashwinprabhu,
    thank you very much for your answer.
    i have one more query, I have orchestration published as wcf service in IIS and internally orchestration calling one more service , it means orchestration sending a request and getting response back from the service.
    actually we are implementing the copy of that called service through biztalk orchestration for system automatic and tracking failed messages and n/w failures.
    But tracking profiler not tracking the Data.
    And we need to develop the http service as https(Over SSL), we implemented in iis using self 
    signed certificate, it is working just browser for wsdl(in browser), we are not able to test the service in wcf test client, it is giving wsdl error, in wsdl schema reference showing with HTTP only,
    please help me how to resolve the issue.
    Teegala

    First things first, I think it's best to publish only schemas as WCF service for dependency management reasons. That said - WSDL availability is covered in the WCF adapter under the behaviors. If you're using HTTPBasic this may be hard to modify, but using
    WCFCustom allows you to add the WSDL behavior and specify that it should be available via HTTPS.
    As to the BAM, are you using TPE within the orchestration or at the port level?  I'd imagine your TPE tracks the start and end events of your orchestration using the Orchestration Schedule.  If you're fairly confident that the TPE is correct and
    yet don't see BAM data 1) make sure your SQL Agent is running healthy and all jobs look OK and 2) check the TDDS tables in both the message box and the BAMPrimaryImport databases.  These will show you if there has been some sort of sync issue. There's
    even a TDDS errors tables - so check that out.
    Kind Regards,
    -Dan
    If this answers your question, please Mark as Answer

  • How to get jsp page form action this page use ajax

    i want to get form action result editThree div. however, ajaxpage open new window.how to decide it?
    ajaxCallPages.js
    var loadedobjects=""
    var loadingcontainer="loading"
    var loadstatustext="<img src='images/loading.gif' />" //loading
    var rootdomain="http://"+window.location.hostname
    function ajaxpage(url, containerid ){
    var page_request = false
    if (window.XMLHttpRequest) // if Mozilla, Safari etc
    page_request = new XMLHttpRequest()
    else if (window.ActiveXObject){ // if IE
    try {
    page_request = new ActiveXObject("Msxml2.XMLHTTP")
    catch (e){
    try{
    page_request = new ActiveXObject("Microsoft.XMLHTTP")
    catch (e){}
    else
    return false
    document.getElementById(containerid).innerHTML=loadstatustext // loading
    page_request.onreadystatechange=function(){
    loadpage(page_request, containerid)
    page_request.open('GET', url, true)
    page_request.send(null)
    function loadpage(page_request, containerid){
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
    document.getElementById(containerid).innerHTML=page_request.responseText
    userEditIformation.jsp
    <script language="JavaScript" src="function/ajaxCallPages.js"></script>...
    <div id="editTwo">
    <table width=100% cellpadding=0 cellspacing=0 border=0>
    <tr>
    <td>
    <form name="myform" action="pages/editUser.jsp" method="post">
    <table width=100% cellpadding=0 cellspacing=0 border=0>
    <tr>
    <td>
    <table width=100% cellpadding=3 cellspacing=1 border=0 bgcolor="#cccccc">
    <tr valign=top>
    <td bgcolor="#666666" width=150 style="color:#FFFFFF;" align="right">User group:</td>
    <td bgcolor="#f5f5f5"> <select name="UserGroup" id="lgroup">
    <option>Administrator</option>
    <option>Editor</option></select>
    </td>
    </tr>
    <tr valign=top>
    <td bgcolor="#666666" width=150 style="color:#FFFFFF;" align="right">User name:</td>
    <td bgcolor="#f5f5f5"><input type="text" id="lname" name="uname" maxlength="20" value=""> </td>
    </tr>
    <tr valign=top>
    <td bgcolor="#666666" width=150 style="color:#FFFFFF;" align="right">E-Mail:</td>
    <td bgcolor="#f5f5f5"><input type="text" id="lmail" name="uemail" value="" onkeypress="return checkEnter(event);" onKeyPress="Comment = false; Email = true; PostalCode = false; Go();" onChange="this.value = ignoreSpaces(this.value);"></td>
    </tr>
    <tr valign=top>
    <td bgcolor="#666666" width=150 style="color:#FFFFFF;" align="right">New password:</td>
    <td bgcolor="#f5f5f5"><input type="password" id="lpass1" name="upass1" maxlength="20" value="" onkeypress="return checkEnter(event);" onKeyPress="Comment = true; Email = false; PostalCode = false; Go();" onChange="this.value = ignoreSpaces(this.value);"></td>
    </tr>
    <tr valign=top>
    <td bgcolor="#666666" width=150 style="color:#FFFFFF;" align="right">Verify password:</td>
    <td bgcolor="#f5f5f5"><input type="password" id="lpass2" name="upass2" maxlength="20" value="" onkeypress="return checkEnter(event);" onKeyPress="Comment = true; Email = false; PostalCode = false; Go();" onChange="this.value = ignoreSpaces(this.value);"></td>
    </tr>
    <tr valign=top>
    <td bgcolor="#666666" width=150 style="color:#FFFFFF;" align="right">Phone:</td>
    <td bgcolor="#f5f5f5"><input type="text" id="lphone" name="uphone" value="" onkeypress="return checkIt(event);" onChange="this.value = ignoreSpaces(this.value);"></td>
    </tr>
    <tr valign=top>
    <td bgcolor="#666666" width=150 style="color:#FFFFFF;" align="right">Block:</td>
    <td bgcolor="#f5f5f5">
    <table cellpadding=0 cellspacing=0 border=0>
    <tr>
    <td><input type="radio" name="ustatus" id="lradio1" value="1"></td><td>Yes </td>
    <td><input type="radio" name="ustatus" id="lradio2" value="0" ></td><td>No </td>
    </tr>
    </table>
    </td>
    </tr>
    <tr valign=top>
    <td bgcolor="#666666" width=150 style="color:#FFFFFF;" align="right">Register date:</td>
    <td bgcolor="#f5f5f5"><%getDateTimeValue valueOne= new getDateTimeValue(); out.println(valueOne.getDateTime());</td>
    </tr>
    <tr valign=top>
    <td bgcolor="#666666" width=150 style="color:#FFFFFF;" align="right">Last visit date:</td>
    <td bgcolor="#f5f5f5"><%getDateTimeValue valueTwo= new getDateTimeValue(); out.println(valueTwo.getDateTime());</td>
    </tr>
    </table>
    </td>
    </tr>
    <tr><td> </td></tr>
    <tr><td><input type="button" onclick="ajaxpage('pages/editUser.jsp', 'editThree')" value="Send"/> </td></tr>
    <tr><td height=18 id="eoncmssend"></td></tr>
    </table>
    </form>
    </td>
    </tr>
    </table></div>
    <div id="editThree">
    </div>
    editUser.jsp
    <html>
    <head>
    <link rel="stylesheet" href="css/editUser.css" type="text/css"></link>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
    <%
    String ugroup=null;
    String phone=null;
    String name=null;
    if(request.getParameter("uname")!=null){
    name=request.getParameter("uname");
    if(request.getParameter("uphone")!=null)
    phone=request.getParameter("uphone");
    out.println(name);
    out.println(phone);
    %>
    </body>
    </html>
    ../

    From the HTTP spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html):
    14.36 Referer
    The Referer[sic] request-header field allows the client to specify, for the server's benefit, the address (URI) of the resource from which the Request-URI was obtained (the "referrer", although the header field is misspelled.) The Referer request-header allows a server to generate lists of back-links to resources for interest, logging, optimized caching, etc. It also allows obsolete or mistyped links to be traced for maintenance. The Referer field MUST NOT be sent if the Request-URI was obtained from a source that does not have its own URI, such as input from the user keyboard.
    Referer = "Referer" ":" ( absoluteURI | relativeURI )
    Example:
    Referer: http://www.w3.org/hypertext/DataSources/Overview.html

  • How to get details of Pending Approval request in OIM 11g R2?

    Hi,
    We need to find out following details from Pending Approval Request in OIM 11g R2 -
    Request ID,Assignees,Requested Resource Name, Title of Request, Beneficiary, Status of Request.
    Out of above attributes we could find out Assignees, Title of Request, Status of Request, Beneficiary, etc. But we are not getting Request ID and Requested Resource Name.
    We have used API - 'IworkflowServiceClient'
    If we use API - 'RequestService' then we are not getting Assignees and Resource name from Pending approval request.
    Can any one suggeste how can we get these details? Do we need to use other API or other alternative to get all of attributes from Pending Approval Request.
    Thanks.

    Thanks Kevin for your suggestion.
    In OIM 11g R2 I tried task.getIdentificationKey() to get Request ID and task.getSystemMessageAttributes().getTextAttribute6() to get requested resource name but I am getting null values out of it. Is there something I am missing?
    Which common thing I can use to retrieve data from both OIM and SOAINFRA? As I am not getting Request ID from 'IworkflowServiceClient' API so I could not use it to earch request in OIM using 'RequestService'. Even if I have to use query what will be common thing I can use to fetch data from both tablespaces?
    Thanks.

  • How to get file name for failed request in JSOM

    hello friends,
    i am uploading files to sharepoint 2013 document library. due to some problem when a file is not uploaded request is failed and failed callback handler is executed. at this time how i can know for which file has not been uploaded.
    as i am uploading multiple files so it is necessary to know for which file error occurs.
    please help 
    Thanks in advance.
    Mukesh

    Hi Z..
    it will be hard for any one to understand the code. how ever I have provided bellow.
    theme is I need to upload multiple files selecting one by one asynchronously when a file will begin to upload It will show status of file name with processing image. similarly for other files.
    ones file successfully uploaded processing image will get hidden. and delete will appear.
    when error occurs for a file then processing div need to be removed for which I need file name when request failed. in failed handler
    function uploadData()
    var input = $("#fldFile")[0];
    if (input) {
    $("#uploadedfile").append("<div class='file'><label>" + input.files[0].name + "</label><div class='image'><img src='/_layouts/15/KPMG.VendorPortal.DMS/processing.gif' alt='processing..'/><img src='/_layouts/15/KPMG.VendorPortal.DMS/error.png' alt='delete' style='display:none;' /></div>");
    file = input.files[0];
    filename = input.files[0].name;
    fr = new FileReader();
    fr.onload = uploaddocument;
    fr.readAsDataURL(file);
    function uploaddocument()
    web = clientContext.get_web();
    clientContext.load(web);
    list = web.get_lists().getByTitle("TempLibrary");
    rootFolderUrl = list.get_rootFolder();
    file = this.result;
    clientContext.load(rootFolderUrl);
    clientContext.executeQueryAsync(onuploaddocumentsuccess, failed);
    function onuploaddocumentsuccess()
    fileCreateInfo = new SP.FileCreationInformation();
    fileCreateInfo.set_url(rootFolderUrl.get_serverRelativeUrl() + "/" + foldername + "/" + filename);
    fileCreateInfo.set_overwrite(true);
    fileCreateInfo.set_content(new SP.Base64EncodedByteArray());
    // Read the binary contents of the base 64 data URL into a Uint8Array
    // Append the contents of this array to the SP.FileCreationInformation
    var arr = convertDataURIToBinary(file);
    for (var i = 0; i < arr.length; ++i) {
    fileCreateInfo.get_content().append(arr[i]);
    // Upload the file to the root folder of the document library
    uploadedfile= list.get_rootFolder().get_files().add(fileCreateInfo);
    clientContext.load(uploadedfile);
    clientContext.executeQueryAsync(documentuploaded, documentfailed);
    function documentuploaded()
    var fname = uploadedfile.get_name();
    $("#uploadedfile").children("div").each(function () {
    var flabelname = $(this).children("label").text();
    if (flabelname.trim() == fname.trim())
    $(this).children("div").children("img").get(0).style.display="none";
    $(this).children("div").children("img").get(1).style.display="block";
    alert("uploaded");
    function documentfailed(sender,args)
    Mukesh

  • How to get JSP file name within a servlet?

    I wonder is there any method that we could use to print out the JSP's file name which called a servlet within the servlet itself? For instance, A.jsp called B.class which is a servlet, and when the servlet is being invoked print out "A.jsp" or "A" in a dos screen.
    Thanks for any reply.

    The Referer is an optional HTTP header, and it only exists when a page is called from an hyperlink (i.e. from another web page). The general meaning of Referer is the "caller page". There at least two situations in which there will be no Referer header:
    1. When the usuer types in the destination page address directly, or get it from a bookmark/favorite or similar. Since there is no caller page, there would be no Referer.
    2. Althought browsers usually send the referal page when you choose a link, some privacy control programs (such as Norton Internet Security etc.) can intercept the request and strip out the Referer header, even when there is a caller page.

  • How to get jsp PageContext in custom component renderer

    Hi,
    How to find PageContext(javax.servlet.jsp.PageContext) form within the custom component renderer class?
    Please help?
    Thanx & Regards
    Milind

    Strictly you're looking which URL has invoked the new request? With other words, you want the referrer?
    If so, doString referrer = request.getHeader("referer"); // Yes, with the legendaric misspelling.Be careful with this, the client has full control over what he/she sends with the headers, so also the referrer. It might be null or changed while you didn't expect that. If you want to be safe, you may consider to send the current URL as a hidden parameter along with the request.

  • How to get the URL of the request.

    I am trying to get the URL from where the request is coming to the servlet. If http://www.xx.com/ calls my servlet i want to know that the request is coming from http://www.xx.com/ URL. If i use request.getRequestURL() which is displaying my servlet URL. Please help me which is very urgent.

    You actually want the referrer? You can obtain it from the request headers as follows:String referrer = request.getHeader("referer"); // Yes, with the legendaric misspelling in there.Having said that, be aware that the client has full control over what he sends with the request headers. So the client can change/spoof/remove the referrer entry to his taste anytime. Your code should not rely that much on it, it should rather be used for statistics only.

Maybe you are looking for