SAM KUMAR

Greenhorn
+ Follow
since Jan 02, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by SAM KUMAR

Hi,

We have selected "Medium" setting as session persistence.
"Write frequency End of servlet service
Write contents Only updated attributes
Schedule sessions cleanup: false"

My question is whether session data is written into database in Asynchronous or Synchronous thread. If it is synchronous then whether current servlet request will wait till all the data is written into session database?

TIA.

Sam
15 years ago
Hi:

Thanks for your reply. That was very helpful.

Now I am trying to prevent continous dot's, for ex: test......ing@host.com. Please let me know how do i prevent this using RE.

Beck, please eloborate why it does not make sense to use reg exp? Is there any performance issue?

"....trying to validate entire e-mail messages with a regular expression wouldn't make much sense, after all."


Thanks.

SK
15 years ago
Hi,

Thanks for your reply.

Please eloborate why it does not make sense to use reg exp?
"....trying to validate entire e-mail messages with a regular expression wouldn't make much sense, after all."


I am trying to add reg exp which should allow quoted user, for "firstname lastname"@host.com. This is what I have:
RE emailPattern = new RE("((^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9])|([^\"*$\"]))@[a-z-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$");

Thanks.

SK
15 years ago
Hi,

I am looking for email validation regular expression using org.apache.regexp.RE?

Also, where can I find document describing email address specification?


Thanks.

SK
15 years ago
Hi:

I was wondering whether "IN" clause is faster or "EQUAL" is faster. For ex:

Query #1
SELECT * FROM dept
WHERE dept_name = 'SALES'

Query #2
SELECT * FROM dept
WHERE dept_name in ('SALES')

In some scneario, I need to pass multiple dept_name, in that case I need to use "IN" clause.

I was wondering if there is any performance impact if I use "IN" clause even though I am passing one dept name?

Thanks in advance.

SK
Yes, its a servlet. In doGet method basically servlet redirect to various JSP based on request parameter. This redirection is handled in a seperate method for clarity and also that method creates the appropriate bean and then forward to appropriate JSP.

My question was whether I should declare the redToHomePage(HttpServletRequest req,HttpServletResponse res) as public or private?

Thanks.

Sam
16 years ago
Hi,

In my servlet, doGet method to calls another method which basically create bean and forward to JSP, my question is that whether that method should be public or should I declare that as a private method?

Code Snippet:

public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
redToHomePage(req, res);
}

private void redToHomePage(HttpServletRequest req,HttpServletResponse res) {
....
}


I am not sure whether I should declare redToHomePage as public or private?

Thanks in advance.

Sam
16 years ago
Hi,
Thanks for your reply.
With "token" I can identify the duplicate request. But I am still confuse about the first request, for ex:
1. User clicks save button.
2. Servlet is saving data.
3. User again clicks Save Button.
4. Using Token, now I can identify that its a duplicate request.
5. But lets say first request is still saving the data, now how do I know then first request has completed saving and 2nd request should redirect to success page.
Thanks.
Sam
16 years ago
Hi,
In a web page, if customer double click a button (lets say save button) then browser is submitting two request which is causing problem in server side, my code is trying save the data twice for the same user/browser. I know I can have some JavaScript which can disable double click by greying out the button itself, but I am interested in Server side solution.
Any help.
Thanks in advance.
Sam
16 years ago
Hi,
I am trying to validate following XML which has javascript value in the "DESCRIPTION" element:
<?xml version="1.0"?>
<!DOCTYPE TEST [
<!ELEMENT TEST (MESSAGE+)>
<!ELEMENT MESSAGE (ID, DESCRIPTION)>
<!ELEMENT ID (#PCDATA) >
<!ELEMENT DESCRIPTION ANY>
]>
<TEST>
<MESSAGE>
<ID>1</ID>
<DESCRIPTION>Test message, <a href="javascript op('/help.html','Help','menubar,status,scrollbars,width=550,height=610')">click here for help.</a></DESCRIPTION>
</MESSAGE>
</TEST>
I am getting following error:
"The element a is used but not declared in the DTD/Schema"
Error line:11
Any suggestion?
Thanks in advance.
Sam
Hi,
I am writing a helper class which provides various static method to parse XML and return Document etc. This helper class will be called by several programs.
Here the snippet:
public class MyParser {
public static Document parse(String xmlString) throws SAXException, IOException {
InputSource in = new InputSource(new StringReader(xmlString));
DOMParser parser = new DOMParser();
parser.parse(in);
return parser.getDocument();
}
//....
}
Now my question is that whether I can declare DOMParser also as a static member variable and do not instantiate every time?
public class MyParser {
private static DOMParser parser = new DOMParser();
public static Document parse(String xmlString) throws SAXException, IOException {
InputSource in = new InputSource(new StringReader(xmlString));
parser.parse(in);
return parser.getDocument();
}
//....
}
I could not understand if it will have any adverse impact?
Thanks.
Sam
16 years ago
Hi:
Thanks for your reply.
Here is the link for WSDL:
http://www.xmethods.net/sd/2001/TemperatureService.wsdl
I did not used WSDL2JAVA to generate the Client, instead I downloaded from following location:
http://www.xmethods.net/download/servicefiles/TempClient.java
Thanks in advance.
Sam
17 years ago
Hi,
I am new to webservice and trying to execute temperature webservice provided by xmethods.net but I am getting following error:
Caught SOAPException (SOAP-ENV:Client): No Deserializer found to deserialize a ':return' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.
Here is the code snippet:
URL url = null;
String name = null;
url = new URL("http://services.xmethods.net:80/soap/servlet/rpcrouter");
name = args[0];
// Build the call.
Call call = new Call();
call.setTargetObjectURI("urn:xmethods-Temperature");
call.setMethodName("getTemp");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Vector params = new Vector();
params.addElement(new Parameter("zipcode", String.class, name, null));
call.setParams(params);
// Invoke the call.
Response resp = null;
try
{
resp = call.invoke(url, "");
}
catch( SOAPException e )
{
System.err.println("Caught SOAPException (" + e.getFaultCode() + "): " + e.getMessage());
System.exit(-1);
}

// Check the response.
if( !resp.generatedFault() )
{
Parameter ret = resp.getReturnValue();
Object value = ret.getValue();
System.out.println(value);
}
else
{
Fault fault = resp.getFault();
System.err.println("Generated fault: ");
System.out.println (" Fault Code = " + fault.getFaultCode());
System.out.println (" Fault String = " + fault.getFaultString());
}

Any help is highly appreciated.
Thanks in advance.
Sam
17 years ago
Hi,
I am getting following error when my servlet forwards to JSP but the strange part is it is not always.
java.io.IOException: The
re is no process to read data written to a pipe.
at java.net.SocketOutputStream.socketWrite(Native Method)
at java.net.SocketOutputStream.write(SocketOutputStream.java:103)
at com.ibm.ws.io.Stream.write(Stream.java:26)
at com.ibm.ws.io.WriteStream.flushMyBuf(WriteStream.java:131)
at com.ibm.ws.io.WriteStream.flush(WriteStream.java:123)
at com.ibm.ws.http.ResponseStream.flush(ResponseStream.java:323)
at com.ibm.ws.io.WriteStream.flush(WriteStream.java:125)
at com.ibm.servlet.engine.http11.HttpConnection.flush(HttpConnection.java:383)
at com.ibm.servlet.engine.srp.SRPConnection.flush(SRPConnection.java:242)
at com.ibm.servlet.engine.srt.SRTOutputStream.flush(SRTOutputStream.java:41)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:259)
at com.ibm.servlet.engine.srt.BufferedWriter.flushChars(BufferedWriter.java:341)
at com.ibm.servlet.engine.srt.BufferedWriter.flush(BufferedWriter.java:322)
I am not sure why I am getting this error.
Thanks in advance.
Sam
17 years ago
Hi,
In the form, I am having encoded hidden parameter:
<FORM name="testfrm" method="POST">
<input type="hidden" name="hiddenParam" value="test%40host.com">
When my servlet receives the POST request, getParamter still returns the encoded value only instead of decoded value.
String value = request.getParameter("hiddenParam");
I am still getting value as "test%40@host.com" instead of "test@host.com"
Thanks in advance.
Sam
17 years ago