Win a copy of Microservices Testing (Live Project) this week in the Spring forum!

Dilip H Pashupathi

Ranch Hand
+ Follow
since Jul 24, 2013
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Dilip H Pashupathi

Hi,

I was working on a service where the User Interface sends out two files in JSON format (A .js file) as Multipart. This I have already done. But problem is different. When the file is sent to FTP server and if the FTP server fails to respond or has problem connecting to FTP server, then I am not able to catch hold of that exception in any way. Below is the code piece

Process that should happen:

1. At the root folder of the FTP, there is file that needs to be deleted
2. Before deleting that file, the file should be taken as a backup and placed in one of the subdirectory.
3. After that from the request I need read the data and produce a file that should be placed in the ftp root directory.

For all the above only a single FTP server is available and there are three different calls happening.
First call is to download the file from
ftp_site/somefile.js
Pass this on to
ftp_site/backup
Read the file from request params and place it in
ftp_site/somefile_update_<date_time>.js



And this is how my FTP URL Looks like
URL 1: Consumer URL for downloading the file
ftp://XXXXC@localhost:8899/?password=XXXXC&consumer.bridgeErrorHandler=true&throwExceptionOnConnectFailed=true&maximumReconnectAttempts=0&useList=true&delete=true

URL 2: Producer URL for moving to backup folder and adding current date to the fileName
ftp://XXXXC@localhost:8899/backup?password=XXXXC&consumer.bridgeErrorHandler=true&throwExceptionOnConnectFailed=true&maximumReconnectAttempts=0&useList=true&fileName=${file:name.noext}_${date:now:yyyyMMdd.hhmmss}.js


ftp://XXXX@localhost:8899/?password=XXXX&consumer.bridgeErrorHandler=true&throwExceptionOnConnectFailed=true&maximumReconnectAttempts=0

Since URL 1 and URL 2 is written inside the processor when exception happens like unable to connect to FTP, onException is not able to handle that properly. And the route ends with a lot of stack trace.

And all of this is happening with only one single FTP server. No additional servers are available for the same.

Kindly help as this is a bit urgent and I need to deliver the service soon.

Thanks & Regards
Dilip H Pashupathi
5 years ago
Hi,

I have a situation where I need to validate the value of one variable based on the input provided in another variable. But I need to do this using Annotations. Below is the code for the same.



In the above code as you can see, "type" has two different values that is validated by pattern matcher. And the "value" variable input depends on the value of "type" variable. The validation should look something like this


And for each of the above validation a different error should be displayed to the user. Like if wrong account number, then to user message should go as "Wrong Account Number" and if payee id pattern mismatches, then error should be displayed as "Wrong Payee ID".

All of the above should happen through annotations only. I tried with the below



But its' not working. I need only one message. Problem I am facing is if Payee Id is wrong, the message is coming as invalid account number.


Please help. This is very urgent

Thanks in advance
Dilip H Pashupathi
6 years ago
Hi,
Is there any one who can help me with this problem.
Please it's very important.

Thanks and Regards
Dilip H Pashupathi
6 years ago
Hi,
I am working on a simple example where i have file in source folder which contains a list of customer id's separated by a marker. I am passing this file through the camel router logic and passing it the bean class. In the bean class I am trying to extract the customer ids and then using those customer id's i am trying to dynamically generate a file with name as "Customers_<customerid>.txt". The problem I am facing is the file name i am taking is coming from header, i.e., "Customers" is coming from exchange header as "Customers.txt". This is the file that contains all the data.

Below I have provided the code
1. FileRouter.java


2. FileBean.java


But this code is not working as expected. Can any one please help where and what I am doing wrong.
as for the files they are contained in the "src/data" and the out put folder is src/outbox". My objective is to take the file available in src/data/Customer.txt and from the file extract all the customer id's and then dynamically create files and transfer it to src/outbox folder as "Customer_<customerid>.txt" file.

Please help
Thanks and Regards
Dilip H Pashupathi
6 years ago
Hi,
I have been learning the Apache Camel with "Camel In Action" book. I am total new bee to this. I was working with some of the application examples provided with the book. In that I am trying my hands on a particular example where the Custom Route Builder class is autowired and should be added to the camel context. But this is not working as expected. I have provided the code below. Please help.

1. OrderRouteBuilder.java


1. OrderRouterWithFilter


3. beans.xml


4. Added attachment as Project Structure

I am using Apache Maven 3.2.3 as Build Tool for all the required jar configurations.

5. pom.xml



Please help with this. Even with all these it's raising an NPE at context.addRoute(orderRouteBuilder) statement.

6 years ago
Hi,

I tried that too. But problem is that I the login page is the initial page where the form elements are available in the Users class. but problem is the code

is unable to look up for the data. I researched through google and found out that modelAttribute parameter associated with the form was not initialized. What I want to know is that is it required that the landing page should be associated with any bean class?

if the form tag is written as follows

is it required that user attribute be initialized with some values? Because this login page is the initial page only after the user provides some input the data will not be initialized. If spring container takes care of initialization then why this error is coming?

and when i removed the


code and replaced it with normal html text box as inputs, the page opened and i was able to perform login validation through internal coding. This takes away the spring feature and makes it look like tight coupled application.

Regards
Dilip HP
7 years ago
Hi,

I am new to spring, I am trying to create a login page with the usage of spring form tags and annotations. But I am getting an error as follows



Here is the code I am trying to use

1. homepage.jsp



2. HMSWelcomeController.java


3. UserForm.java


3. HMSProject-servlet.xml



What I am trying to achieve is on run, the first page that should come is the login page that should be bound to the UserForm, which validates the data against a database and allows the user to login.
Can anyone please tell me what I am missing or where I am going wrong

Please help
7 years ago
Hi,

I am trying my hands on a sample application which uses MultiActionController for handling requests and response. Only problem is it's not working as I expect it to. Here is what I am trying to do.

1. I have index.jsp which is mapped as welcome file in web.xml. This page jusg simply forwards it to the action controller as shown below


2. I have defined my web.xml as below



3. multipleactions-servlet.xml




4. WelcomeController.java


The problem is when I run the application it throws an error saying "Requested resource not found"
and in the console
Jul 28, 2015 10:35:59 AM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping for [/MultipleActions/] in DispatcherServlet with name 'multipleactions'

I want understand how this multiple action controller is mapped in the servlet.xml file and also how to configure different methods to a url so that on submission proper methods are executed

Please help
Regards
Dilip H P
7 years ago
Hi Srikkanth,

Thanks for the reply. But the problem is I am not sure we can add more new jars to project as this current project is scheduled for production release in another week. Since it requires much testing and R&D work we need to take permission from managers to do the changes. But any how thank you.

Regards
Dilip H P
7 years ago
Hi,

I have requirement of generating an excel report based on the data available in the database. For now we are using a String Builder and populating a html file where all the data is stored in tabular format and will be flushed into a "application/xls;charset=UTF-8" format for excel file genration.

The problem we are facing is that if we use a pure number to generate the excel report, then in the report if the number of digits is more than 20 then the excel is converting it to a exponential values.

Is there any other way we can generate a excel report without having to resort to creating a HTML file then convert this html file through string into an Excel file.

Here is a portion of the code




Regards
Dilip H P
7 years ago
Hi,

I have requirement where the application provides the user the fecility of downloading an xml file in the format of ".tar.gz" format. This should be done such a way that the xml being downloaded should be placed in a temporary dierectory and then this direcoty should be added to the ".tar.gz" file. Once the file is created, the temporary directory should be deleted. I have tried using "org.apache.commons.io.FileUtils.deleteDirectory()" and also File - "delete()" method. But the problem I am encountering here is that once the folder is created and archive is also flushed through the output stream the folder is not getting deleted.

here is the peice of code that i have written for the above.



"createTarGz()" method



And is it possible to create the tar.gz file without having to create a physical directories?



Please Help

Regards
Dilip H P
7 years ago
Hi,

I have a requirement where if the user clicks on the Download icon with respect to an XML file, the user should be prompted with a dialog for either "Open" or "Save" or "Cancel" the operation. Right now, all these are working fine. But the new requirement is that, on click of the "Open" command xml file should be direclty opened , or if "Save" button is clicked then the file should be saved as "tar.gz" file with custom defined folder structure defined in the server code.

My question is how do we invoke the server code when the file is already flushed to the output stream, and how do we make sure on click of te save button it will call the server code.

Here is a snap shot of download function
7 years ago
Hi,

We are using Jboss 7.0.1 and Weblogic 10.3.6 Servers for deployment and for development we are using Tomcat 6.0 server. Can show me how this is done, meaning how can we assign two different session ids to same application running on same server.

Thanks and Regards
Dilip H P
7 years ago
Hi,

I have a requirement where I need to have two different urls for the same application. The first url http://host:port/contextpath which leads to default applicatioin login with three fields,
1. Useraname
2. Password
3. Database

Then second url http://host:port/contextpath/agondemand.jsp which leads to the same page but with different options
1. Username
2. Password
3. Company ID
4. Database

Both are working. But my problem is with session expiry. for the second url if session expires, I am unable to capture the data and send it back to same login page. When ever session expires it goes back to default url without company id field.

Please help me to figure out how to redirect the url to second one without disturbing the default url.

Thanks and Regards
7 years ago
Hi,

Can you tell me how to clean those lisbox. because from javascript i tried all sorts of things. And nothing seems to wokr. And if I completely empty the box by selecting all the values and clicking on the "Remove" button, the same is not reflected in the form bean.

Please help.

Thanks
Dilip H P
7 years ago