Disjoint Base64 Encoded String

2008-10-29 Thread Jeng Yu
Hi Friends,

I am seeing a problem with my servlet running in 
Tomcat and I'm a bit baffled.

When I post a base64 encoded string that has a + 
character in it from a client to my servlet (via 
form post), the string becomes disjointed at + 
character making  it two strings. That is, the + 
character gets replaced by a  , which makes the 
string two base64 encoded strings at the servlet 
end.

I've had to do an ugly hack of scanning the base64 
encoded string first to replace   with + before 
I can decode the original string properly in the 
servlet. There's gotta be a better way!

Certainly, I'm missing something here. What is it,
Urlencode it? I thought that is implicitly done.

Thanks,

Jeng



  

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Suspending Servlet Request Acceptance?

2008-10-24 Thread Jeng Yu
Hi Folks!

What is the best way for an administrator to tell
Tomcat (or maybe tell a specific servlet) to 
temporarily stop accepting new requests for a running
servlet?

I'm thinking of a scheme like this: I put code in the
servlet doGet()/doPost() processing block of the 
servlet and have it check if a particular file 
somewhere exists. If so, send request reject message
to
client. If the file does not exist, go ahead with the
processing. Downside: Someone that knows could use it
to cause denial of service to my servlet, but security

checks can be put in place to make it harder to do so.

What do you folks think?

Thanks,

Jeng



  

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Obfuscating a Servlet

2008-10-24 Thread Jeng Yu
Hi All,

I just wanted to know if I can first obfuscate my
selvlet
with ProGuard before I deploy it in Tomcat
environment.

Will doing this really protect my servlet and make it 
really difficult for someone to reverse engineer or 
decompile it, as people seem to say?

Thank you.

Jeng


  

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat Servlet Bouncy Castle Problem

2008-10-06 Thread Jeng Yu

--- Mark Thomas [EMAIL PROTECTED] wrote:

 Jeng Yu wrote:
  Interestngly, the same RSA public encryption code
 with
  Bouncy Castle library works flawlessly when I
 develop
  it in Netbeans IDE and run it as a java
 application
  (not servlet). In servlet environment, it fails.
 Yes,
  I added cldc_classes.zip class library file from
  Bouncy Castle to compile the code.
 
 Tomcat only loads '.jar' files. '.zip' files will be
 ignored. Rename
 cldc_classes.zip to cdlc_classes.jar and you should
 be good to go.
 
 Mark

Hi Mark!

Thanks a lot. This suggestion from you solved
the problem.

'Preciate it, dude!

Jeng


  

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Tomcat Servlet Bouncy Castle Problem

2008-10-02 Thread Jeng Yu
Hello Friends!

I have a debugging problem here that I hope the gurus
here can help me figure out.

I'm trying to do RSA public key encryption in a
servlet that I'm developing inside Netbeans 6.1. I'm
using the Bouncy Castle (BC) crypto package. When I
build the servlet, there are no errors. Then I run it,
and Netbeans invokes the Tomcat 6.0.16 container in it
and  waits for a client to conect. But when I connect
to the servlet from a client, it crashes when it
executes this line in my code:

private RSAPrivateCrtKeyParameters RSAprivKey = null;

with this message in the Tomcat log output:

SEVERE: Allocate exception for servlet Fortune
java.lang.NoClassDefFoundError:
Lorg/bouncycastle/crypto/params/RSAPrivateCrtKeyParameters;

and prints this stack trace:

at java.lang.Class.getDeclaredFields0(Native
Method)
at
java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at
java.lang.Class.getDeclaredFields(Class.java:1743)
at
org.apache.catalina.util.DefaultAnnotationProcessor.processAnnotations(DefaultAnnotationProcessor.java:131)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1108)
at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)

Interestngly, the same RSA public encryption code with
Bouncy Castle library works flawlessly when I develop
it in Netbeans IDE and run it as a java application
(not servlet). In servlet environment, it fails. Yes,
I added cldc_classes.zip class library file from
Bouncy Castle to compile the code.

Oh, and the client reports the following error when
trying to connect to the servlet:

The server encountered and internal error that
prevented it from fulfilling this request.
ServletException: Error instantiating servlet 
class fortune.Fortune.

What am I not doing right? Has anyone else seen
something similar and what's the 
getaround/workaround?

Thanks,

Jeng Yu




  

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Chaining Request Processing

2008-08-12 Thread Jeng Yu
Hello Good People!

I need your help! I can't find a good answer where
I've
looked. Here's my problem:

I have a web application client that shows a user a 
form to fill out and then submits the form input to a 
servlet in an application server (Appserver A) running
Tomcat.

The servlet (in Appserver A) then processes part of
the
form input in the doGet method and then needs to send 
the rest of the form to another web server 
(Appserver B) to process and return the results 
(response code or something) to the calling servlet 
which is waiting for it. The servlet receives the 
results and based on the results, sends
response back to the client, all within the same doGet
method.

Is this doable, and What's the best way to go about
it?
Should I make the call to Appserver B in a separate
thread (I'm considering it)?

Thanks for your help.

Jeng


Send instant messages to your online friends http://uk.messenger.yahoo.com 

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Chaining Request Processing

2008-08-12 Thread Jeng Yu

--- Peter Crowther [EMAIL PROTECTED]
wrote:

  From: Jeng Yu [mailto:[EMAIL PROTECTED]
  The servlet (in Appserver A) then processes part
 of
  the
  form input in the doGet method and then needs to
 send
  the rest of the form to another web server
  (Appserver B) to process and return the results
  (response code or something) to the calling
 servlet
  which is waiting for it. The servlet receives the
  results and based on the results, sends
  response back to the client, all within the same
 doGet
  method.
 
  Is this doable, and What's the best way to go
 about
  it?
 
 Best or Easiest to code? :-)
 
 Best from a performance point of view is to change
 your application so that it's *not* all happening in
 the same doGet call.  You don't know how long your
 call will take.  You should submit the request via
 some appropriate mechanism and return a holding page
 to the user.  Every so often, the holding page
 should poll to see whether the call has completed. 
 You'll need some way of storing the results from
 appserver B, along with a way of managing timeouts
 and similar.  Since you've not said how appserver B
 expects its data, we can't really suggest specific
 technologies.  This approach minimises the number of
 threads that will be waiting at any time.

Sorry, I should have mentioned how appserver B expects
its data. Essentially, it expects its data via a URL
call - post or get. In other words, appserver B is
another web server elsewhere. 

So what options or specific technologies do you have
in mind?

Thanks,

Jeng 


Send instant messages to your online friends http://uk.messenger.yahoo.com 

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]