Pravin Panicker

Ranch Hand
+ Follow
since Oct 05, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Pravin Panicker

Hi All... not sure if this is the correct section for my query.
I am trying to implement a UI based interface to add/edit business rules defined in XML (a set of input and output parameters).

I am thinking of making this a web application, typical MVC with xerces for the XML transformation and a JSP front end.

My requirement is to have a dynamic set of INput/Output parameters at the client side itself. I need to give the end user flexibility to input as many rows in the front end as possible without going to the server. This would be cumbersome javascript coding.

Is there a better way to implement this?
[ December 17, 2007: Message edited by: Bear Bibeault ]
17 years ago
This is the output while running the test page -


Keystore Instance:java.security.KeyStore@d79dfe Loading keystore
Aliases:notescert
Aliases sx-xuat-deluxe

after setting properties Connecting to https://dsx-xuat.deluxe.com/secure/dci.do?app=dci

after url.openConnection(). Now setting values


conn: 403
Connected to https://dsx-xuat.deluxe.com/secure/dci.do?app=dci

cert.len: 3 // Only Server Certs are printed. No Local Certs.
Hi All,

I am trying to establish a secure connection to another server. I have the required certificates imported to keystore and listing the keystore shows me the proper aliases. However, when i connect to the remote server, I am getting a 403 response and the folks at the server side say that my request does not have any certificates.

Please help!

Following is the snippet of code from my test jsp page -

HttpsURLConnection conn = null;

try{
out.println("<b>Connecting...</b><br><br>");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

System.setProperty("java.protocol.handler.pkgs", "javax.net.ssl");
System.setProperty("https.proxyHost", "webproxy.ssmb.com");
System.setProperty("https.proxyPort", "8080");

// Key store information - - - - - - -

out.println("<b>Loading keystore");
KeyStore ks = KeyStore.getInstance("JKS");
ks.load(new FileInputStream(new File("/apps/broadvision/jre/lib/security/cacerts")), "changeit".toCharArray());

Enumeration enum = ks.aliases();
while(enum.hasMoreElements()){
out.println("<br> Aliases:"+enum.nextElement()); // This lists the required cert
}

URL url = new URL("https://dsx-xuat.deluxe.com/secure/dci.do?app=dci");

out.println("<br>after setting properties");

out.println("<b>Connecting to "+url+"</b><br><br>");
conn = (HttpsURLConnection) url.openConnection();
out.println("<b>after url.openConnection(). Now setting values </b><br><br>");
conn.setInstanceFollowRedirects(false); //Disable the redirect URL which is automatically followed
conn.setUseCaches(false); //Don't look at cached data
conn.setAllowUserInteraction(false); //Don't allow user interaction

conn.connect();
out.println("<br>conn: " +conn.getResponseCode()+"<br>");
out.println("<b>Connected to "+url+"</b><br><br>");

Certificate[] certsLocal = conn.getLocalCertificates(); //conn.getLocalCertificates();
if (certsLocal != null){
out.println("certsLocal.len: "+certsLocal.length);
for (int i=0; i<certsLocal.length; i++)
out.println(" <br><br>Local Certificate "+i+": "+certsLocal[i].toString());
}

Certificate[] certs = conn.getServerCertificates(); //conn.getLocalCertificates();
if (certs != null){
out.println("cert.len: "+certs.length);
for (int i=0; i<certs.length; i++)
out.println(" <br><br>Server Certificate "+i+": "+certs[i].toString());
}


if(null == conn){
out.println("<br>conn null");
}
else if(HttpURLConnection.HTTP_OK != conn.getResponseCode()){
out.println("<br>conn not ok: "+conn.getResponseCode()); // Its going here with 403 response code
out.println(" - "+conn.getResponseMessage());
}
else {
out.println("<br>conn OK: " +conn.getResponseCode()+"<br>");
//String locationHeader = "https://cim-xuat.deluxe.com/secure/Detokeization.do?dsxToken=xxxxxxxxxxxxxxxxxxxxx";
//conn.connect();
try out iflex solutions and Mphasis. They r solely into financial domain. As regards your expected salary i think it is (years of exp)* lac p.a in Mumbai while in bangalore its (years of exp + 1)* lac. So you can expect around 6 lac p.a in Mumbai and 7+ in bangalore.
20 years ago
Thats great.. i am supposed to join dsl software, bangalore on 17th. Would like to have some information from people within the organization.
21 years ago
Passed SCWCD yesterday with 88%.
Must say that the exam was easier than SJCP in which i scored 91%.
I was overconfident and didnt bother to recheck my answers after completeing the exam in little over an hour. Tags of web.xml and tld needs to be by hearted.
Read Hanumant Deshmukh, purchased their Mock Tests (very useful), read JSP and Servlet specs.
21 years ago
In the first case you still view the URL in your browser as A because the browser does not send a redirect request to the second url (B) as in case of response.sendRedirect.
okk Thanks.. I guess the behaviour of Action Servlet's service would be

void service(){
1. Load the action class from config
2. Pass the parameters and call its action method
}

So it all happens in the same thread There is a containment relationship between the Action Servlet and the Actionclass
guess i was plain confused.. Thanks a lot
21 years ago
Hello Neil,
Sun's servlet specifications states that it is best avoided to pass the request, response
to another thread of execution.. as they are not gauranteed to be thread safe.
to quote..
"
2.3.3.3
A Developer should note that implementations of the request and response objects are not
guaranteed to be thread safe. This means that they should only be used in the scope of the
request handling thread. References to the request and response objects should not be given
to objects executing in other threads as the behavior may be nondeterministic.
"
Is the Action Servlets behaviour to pass the request, response to the Action class any cause of concern.
Please shed more light on this in the context of the specification
21 years ago


request.setAttribute("error", "Login Failure");
request.getRequestDispatcher(address).include(request,response);
This is how is get the value in the JSP file.
<% String error = (String)request.getAttribute("error") %>
I also tried it this way:
<% String error = (String)request.getParameter("error") %>


try this rather..
<jsp:include page="address" >
<jsp aram name="error" value="Login Failure"/>
</jsp:include>
use get parameter from the jsp....
21 years ago
JSP
I think you want to include the jsp in this servlet.. in which case the procedure you are following is correct.
Please clarify
1. What is the "address" you are giving to requestdispatcher. If it is absolute or relative.
2. Are you changing the response header in the included jsp page?
21 years ago
JSP
Dear Roshan,
Good 2 meet you here
I dunno the exact nature of your problem. Hope you must've solved it now. If yes please post what went wrong.
First of all at the client side, make sure that the xml string you r writing to outputStream is of the proper size. print the byte[] size and verify.
Next, If you are getting proper size @ the server side, but available() is returning lesser value, applying a small time delay could help before reading the string at the server side.
If you could show the server side snippet for reading the data, then could apply some thoughts.
21 years ago
Hello Anna,
I guess this behaviour is because in case of forward, the request never leaves the container and remains within the same application context. So u need'nt specify /myApplication/redirectPage.jsp but just /redirectPage.jsp
In case of redirect though, the "new" request from client can be issued to "any" container. This explains why it needs the complete application context. So u say /myApplication/redirectPage.jsp
A work around would be append the redirect path with servletContext.getRealPath("/");
Correct me if i am wrong.
21 years ago
You are selecting huge amount of data at one go. So the exception is expected. But will you be using all of them?
you could resort to some sort of pagination , if your application permits, and fetch
fewer records as and when needed.
Hello all,
I need to incorporate pagination with a search result.
My query may return upto a lakh records and using Tomcat with db2 7.1
( No ejbs ). What would be appropriate?
- putting the entire search result in session and retrieving them on next/previous
- or hitting the database every next/previous click. Here, I plan to store the primary keys
in session, to optimize my query