A Farroll

Ranch Hand
+ Follow
since Oct 26, 2012
Merit badge: grant badges
For More
Prestwick, Scotland
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
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by A Farroll

Joe Harry wrote:Is the 3rd party web front-end only a java script front end or what is it?

One way to intercept requests and responses would be by using a filter configured in your web.xml.



Using wappalyser it says it is 50% sure it is built on ASP.NET

I will try and find out how to set up a filter configured in the web.xml. Never done that before

Thanks Joe
8 years ago

Bear Bibeault wrote:

A Farroll wrote:I am maintaining a servlet program built on Java and running on Tomcat 7 with Windows operating system. The servlet application has no actual servlet class.


I'm confused: how can you have a servlet program with no servlets?



Hi Bear,

Forgive me as I am no expert in Java. What I mean is the application was built to handle web service requests and from what I can tell has no class which has "extends HttpServlet", for example public class classname extends HttpServlet. From my investigation if I have a servlet class like this I can use the "doGet" method. But I am at present of the understanding that to use the doGet method I need to know the URL which is what I am trying to find out in the first place.
8 years ago
Hi,

I am maintaining a servlet program built on Java and running on Tomcat 7 with Windows operating system. The servlet application has no actual servlet class. A third party web front end calls the web service end points in the servlet application but a problem has developed in one of the web service requests. To assist me finding the problem it would be useful to determine the complete URL - including query string - when the relevant web service request is made.

Can I do using the message context or do I have to create a servlet class?

Thanks in advance

AF
8 years ago
I would like to thank you both Junilu Lacar and Dave Tolls for your feedback

I will work away with this and approach my boss about refactoring some of the classes and see if I can be allocated time to do this.

Regards

AJF
9 years ago
You are both correct Junilu Lacar and Dave Toll. I have never been trained in Xpages you see and no expert in XPages. Also about the Integer part again you are correct. I did not want to confuse this forum thread any further but the reason for the integer is because as well as the documents (they are called Contracts) being stored in Notes they are also pushed through to a SQL Server Database and so requires some handling as an integer in SQL Server as well as a Long in Notes - YES I realise this is duplication of data and overly complicated without it being necessary to be but I did not design this application. I am just stuck with maintaining it. I would frankly rebuild it in a less complicated manner.

Dave Toll you were close regarding the doValidation declaration. It is;

public static boolean doValidation(UIInputText field,FacesContext facescontext) {

...

}

I will try what you guys have suggested and let you know. It is finishing time here today where I am. I will try it tomorrow morning.

Thanks for your patience

Regards

AJF
9 years ago

Dave Tolls wrote:

A Farroll wrote:Thanks once again Dave. I agree there doesn't seem to be anything changing the value of "value" that is why I found it so confusing. I have spent some time trying to get the contents of "value" parameter to the second try-catch block. How do I do this or amend the try-catch to allow this?

Regards

AJF



So what is it you are actually trying to achieve?
Because it really isn't clear.

"get(ting) the contents of "value" parameter to the second try-catch block" explains nothing.
You could do that by simply sticking it at the beginning of the method and removing everything else.



What I attempting to acheive is amend the If - else statement or\and the second try catch block to process the second "Long retval = Long.parseLong(value)" and "return retval" statements with the original value of the "value" parameter. I have already attempted placing a single "Long retval = Long.parseLong(value)" before the If statement but I kept getting errors with that too.

Thanks

Regards

AJF
9 years ago
Thanks once again Dave. I agree there doesn't seem to be anything changing the value of "value" that is why I found it so confusing. I have spent some time trying to get the contents of "value" parameter to the second try-catch block. How do I do this or amend the try-catch to allow this?

Regards

AJF
9 years ago
Thanks again Dave Tolls

I confirm the "value" parameter has a value before the If statement begins because I have output a debug statement to make sure. I then tried placing the second try-catch block inside the else statement as I can see how that would make sense but I'm afraid the outcome is still the same.

Perhaps it is the initial If condition??? Speaking as an non XPages person what exactly is that checking in the If condition? Although I can confirm the "UiValidationTools.doValidation" is another class in the application and the "doValidation" part is a function within it that returns a type Boolean, but what about the "(UIInputText)component, context)" part of the If condition???

Regards

AJF
9 years ago

Dave Tolls wrote:Not convinced by this bit of the code (lines 14 - 17 in the above):


If value is empty then it will never reach the if statement as the parseLong will have thrown a NumberFormatException, so no point with the check there at all.

That aside, what is printed out by the println statement in the else block?



Thanks for response Dave Tolls. If have put in numerous debugging outputs in this class, they are just now shown in the code above as I wanted to keep it clean and readable.

I have placed dubug outputs around the lines 14 - 17 and the "value" parameter does have a value even after the Long retval = Long.parseLong(value); line of code on line 14. In fact the Xpage interface and XML has conditions to ensure it has a value.

To answer your second question of "what is printed out by the println statement in the else block" - it simple prints out in the logs "value is ". This is what is really confusing me because right before the "return retval" in the first try-catch the "value" parameter has a value as I have outputted it previously but by the time it gets to the else block the "value" parameter is empty!!! I have tried numerous things here, changing the scope of the retval variable, removing the second try-catch block, removing the else block and all these cause other issues. I have even tried creating a seperate class with a getter and setter to store the "value" parameter in an object and using this it retains the value of the "value" parameter inside the FIRST try-catch statement but NOT THE SECOND try-catch block.

That is why the only solution I have found that works is the fudge up I described in my previous comment which I do not like. A former colleague who was an Xpages person developed this and then left the company with little documentation

Regards

AJF
9 years ago
Ivan Jozsef Balazs thanks for your response. I have been trying to this working all day again and have found the only fix is a sort of "fudge fix" that I am not happy with. Regarding the parameter "value" it does have an actual value because I have input several debug statements are the parameter named "value" outputs a value right up to the first return retval. After that it does not have a value. I even tried creating a new Class of type String and used this to create an object that will store the value of the parameter named "value" and it does this successfully in the first try-catch block but when I tried to retrieve the value from the object in the second try-catch block it states it is null.

However if I place the code below (the fudge fix) in the second try-catch block, the problem goes away.

String firstValue = "";

if(firstValue == ""){
firstValue = "0";
}

Long retval = Long.parseLong(firstValue);
return retval;

I still cannot understand why this is occurring

Regards

AJF
9 years ago
Hi all. Thanks for responding. I will post the code of the entire procedure below and frankly I am very confused at what the original developer is trying to do with the second try catch block. Have a look and see. When the second Long retval = Long.parseLong(value); occurs the "value" is empty and creating enormous entries in the logs - this is the problem I am trying to resolve. Right before the first Long retval = Long.parseLong(value); I have placed a system out and the "value" contains a value, but after the first return retval the "value" is empty. I hav tried swapping around the scope, i.e. having retval declared outside the try-catch but it does not work.

Thanks in advance. Also, this is actually Xpages but I have found forum help on Xpages very few and far between.

9 years ago
Hi,

I am maintaining an application developed by a former colleague and a Java class converts a String input parameter named "value" in a function to a Long value with the following code;

Long retval = Long.parseLong(value);

This occurs within a try catch block and also within the try catch block is the return value of the function with the code;

return retval

However, the return statement above makes the input parameter "value" an empty string. How can I retain the value of the parameter "value" for further manipulation?

Thanks in advance

AJF

9 years ago
Thanks Tim Holloway. I have found a otential option is in the SQL Server properties to Force Encryption but trouble is that option can only be applied if all applications connecting to the database use SSL, which I don't think they do but I am checking with our infrastructure.

Regarding the JDBC, do you mean it is possible to amend the JDBC to ensure encryption takes place on each data transfer?

Thnaks again

Regards

AJF
9 years ago
Hi all,

We have a Java servlet running on Tomcat and Windows and all database connections are encrypted using SSL. This works apart from a strange issue on one of the connections (SQL Server) which I do not understand. I am using WireShark to check the encryption is working but, whenever a new login is performed through the servlet, the FIRST data transfer for this particular connection is only partially encrypting, but if a second or third data transfer to this database connection is made under the same login the entire message is encrypted.

After the login all requests are handled through a token provided by Tomcat. The servlet also connects to an Oracle database which encrypts all the messages from the outset.

Why will the first data transfer only be partially encrypting?

Here is the JNDI entry in Tomcats context.xml file but obviously a few things amended to hide them

<Resource auth="Container"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
factory="org.moss.jdj.dbcp.EncryptedDataSourceFactory" maxActive="100"
maxIdle="30" maxWait="10000" name="jdbc/connectionname"
password="*******" type="javax.sql.DataSource"
url="jdbc:sqlserver://databaseinstallname\db_instancename:2369;
databaseName=Images;encrypt=true;trustServerCertificate=true"
username="*******" />


Here is the entry in Tomcats server.xml file but again a few things amended to hide them

<Connector port="8443"
protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true"
maxThreads="150" minSpareThreads="25"
enableLookups="true" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" KeyAlias="ows"
KeystoreFile="C:\SSLKeys\ows.key" KeystorePass="********" />

Thanks in advance

Regards

AJF
9 years ago
Hi all,

We have a Java servlet running on Tomcat and Windows and all database connections are encrypted using SSL. This works apart from a strange issue on one of the connections (SQL Server) which I do not understand. I am using WireShark to check the encryption is working but, whenever a new login is performed through the servlet, the FIRST data transfer for this particular connection is only partially encrypting, but if a second or third data transfer to this database connection is made under the same login the entire message is encrypted.

After the login all requests are handled through a token provided by Tomcat. The servlet also connects to an Oracle database which encrypts all the messages from the outset.

Why will the first data transfer only be partially encrypting?

Here is the JNDI entry in Tomcats context.xml file but obviously a few things amended to hide them

<Resource auth="Container"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
factory="org.moss.jdj.dbcp.EncryptedDataSourceFactory" maxActive="100"
maxIdle="30" maxWait="10000" name="jdbc/connectionname"
password="*******" type="javax.sql.DataSource"
url="jdbc:sqlserver://databaseinstallname\db_instancename:2369;
databaseName=Images;encrypt=true;trustServerCertificate=true"
username="*******" />


Here is the entry in Tomcats server.xml file but again a few things amended to hide them

<Connector port="8443"
protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true"
maxThreads="150" minSpareThreads="25"
enableLookups="true" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" KeyAlias="ows"
KeystoreFile="C:\SSLKeys\ows.key" KeystorePass="********" />

Thanks in advance

Regards

AJF
9 years ago