shiva murugan

Greenhorn
+ Follow
since Jan 08, 2010
Merit badge: grant badges
For More
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 shiva murugan

HI All,

I am into a situation where I need to trigger a http URL from shell script passing 2 parameter say param 1 and param 2 to a web project.

I need to write a spring controller which is capable of handling this get request and return a String say "Success" on successful completion of the request.

I need to use Spring 3.

As per my analysis, i understood i need a method something like this




Guide me whether i am going on the right path, is this doable?

Regards
Siva
12 years ago
Thanks for the replies.

I am using this approach to do my job.


Regards
Siva
Hi i am into a situation where i need to transform one form of XML to another and then split the file based on threshold limit or via some grouping, mostly succeeded in the implementation but have small confusion with respect to file name.

I want the file name to be sequentially incremented, i tried all sort of option none succeeds, can someone give some heads up on it.

I am also new to XSLT, if you have better approach please feel free to tell me, My goal is to convert one form of XML to another and split the same in multiple file




Regards
Siva
Thanks Ernest, now i understand the concept here.

thanks all who helped me in cracking down this doubt.

Regards
Siva
13 years ago
ok, let me summarize my understanding please correct me if i am wrong.

Backbone of OOPS concept inheritance will not be applicable for JVM when it tries to call main method.
even though main method is also a normal method like other methods in java ,which could be overrided or overloaded, will not be applicable for broadening rule.

if the above said information is true, do any of you guys have any idea, how to implement the same in our program, that is disabling broadening or inheritance rule in java.

I did some googling on this, but it turns to be negative.

Regards
Siva
13 years ago
I think you misinterpreted the snippet in my previous post, i mean to say, i have a user defined method with Object array as an argument, and triggered that method using a String array argument from my main method. since this was working, i am expecting when a JVM tries to call main method with String array argument, it should obviously land inside the main method with object array as argument.

Am i missing any rule of JAVA

Regards
Siva
13 years ago
I do not understand the fact here, you guys state that since String Array is not a sub type of Object Array, we get this problem.

if this is the scenario, i believe even this snippet should not work, i should get an error

public class Test {
public static void main(String... a) {
method(new String[1]);
}

static void method(Object[] mnp){
System.out.println("Entered Object Method");
}
}

interestingly it executes and displays the output.

only when JVM tries to trigger main method it get stuck with this problem, in all other scenario, it is working fine.

Regards
Siva
13 years ago
Hi All,

I might sound stupid, but i have a basic doubt with a plain standalone JAVA program.

consider the following Snippet

public class test1 {


public static void main(Object[] args) {
// TODO Auto-generated method stub

}

}

on executing the above code, i got a fatal error, with this exception
Exception in thread "main" java.lang.NoSuchMethodError: /test1.main([Ljava/lang/String;)V

My doubt is, i am expecting this program to execute properly, since String is a subclass of Object class, but that is not happening.

Is my interpretation is wrong by any chance

Regards
Siva
13 years ago
My struts.xml is configured as

<package name="Base" extends="struts-default">
<interceptors>
<interceptor name="xssFilterInterceptor"
class="XSSFilterInterceptor">
</interceptor>


<interceptor-stack name="criteriaInterceptorStack">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="xssFilterInterceptor" />
</interceptor-stack>

</interceptors>

<default-interceptor-ref name="criteriaInterceptorStack" />
<global-results>

<result name="errorPage">/common/servletErrPage.jsp</result>
</global-results>

</package>

<package name="com.mastercard.mastercom.casefilling.web.action"
extends="Base">

action configuration here
</package>

on trying to run the application i am getting some error as
[Servlet Error]-[Filter [struts2]: could not be initialized]: Unable to load configuration. - package - file:/E:/pjt-web/WebContent/WEB-INF/classes/struts.xml: (line number which states extends = "Base")

Any idea, i searched info, yet no solution
14 years ago
The scenario is, the value is generated in the Filter class, and it is added in the session, once the JSP loads the value from the session is assigned to the Hidden variable in the JSP, on submitting the form, in the action class, the value generated in the Filter class is compared with the hidden variable.

if both the value is same i will process the submitted form, if not i will send a error page.

On successful submission, a request is dispatched, which again passes through the Filter class, and the cycle continues.

This is working when i am accessing the .jsp page in the URL, but in the case of the .do service, before the generated value is assigned to a hidden variable, it is been verified in the action class, any suggestion in how to tackle this problem

Siva
14 years ago
I wish only to do a check on submitting the request, but not on while loading the page.
14 years ago
Hi All,

I am trying to provide security solution for a Cross site request forgery issue.

Solution:
*********
1 using a filter, generated a Random number using Secure Random class, and add the same in a session variable

2 In a JSP, i have added a Hidden variable that gets populated with the Value generated by the filter class

3 On submitting the page, in the action servlet, i am checking whether the value generated by the filter is same as the value currently in the JSP hidden variable, if same i will process the request, if not i send him a error page.

Note : For each and every hit(from page to page), a new random number is genrated.

Problem:
********
This works 100% fine when i am trying to access any .jsp files, but this does not work when i try to access .do service.

I knew that, on accessing a .do file, it first calls the controller, and based on the controller only the view page loads. since i am checking in the action servlet for the hidden variable that is not populated in JSP at that point of time, i am getting a error page, even though a valid course of action takes place.

Any solution for this, i am very Confused, any sort of help would he highly helpfull.



Regards
Siva
14 years ago
Hi Guys,

I have a doubt, based on the output from the filter class, how do i mention which view page needs to be laoded

Any suggestion?

Regards
Siva
14 years ago
Thanks guys, i got some good replies for my first post.

Also it is not finalize, it is destroy method of the filter servlet, that is responsible of releasing all the resources held by it

Regards
Siva
14 years ago

Wouter Oet wrote:If the variable is static you can't because you'll always have an accessible reference to that object.
If not then just make then surrounding instance eligible for gc.




Actually in my case i am creating a filter class and it uses, and i had defined the logger as a final instance variable, under this circumstances, in the destroy method of the filter class i wish to explicity free the logger resource.

is this possible?

14 years ago