[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

JSP Transformer Error with j_security_check

Posted on 2004-09-13
5
Medium Priority
?
460 Views
Last Modified: 2011-08-18
hi everyone,

This below JSP code is working fine without j_security_check, once I apply FORM based j_security_check the output is not been produce. May be its treating URL HTTPURL connection .... as new resource from output and may be excepting login user/pass again ?? If that is so why not redirecting me to error.html. May be I'm wrong.

This is my "/resource/GetResourceHierarchy" servlet which gives DOM XML as output. Is there any alternative way I can try the below code.

<%  
try {    
   StringBuffer reqURL = request.getRequestURL();
   String contextURL = reqURL.substring(0,reqURL.lastIndexOf(request.getServletPath()));    
   URL url = new URL(contextURL + "/resource/GetResourceHierarchy");        
   HttpURLConnection conn = (HttpURLConnection)url.openConnection();            
   conn.setDoInput(true);                
   TransformerFactory tFactory = TransformerFactory.newInstance();
      ServletContext context = getServletContext();
   InputStream is = context.getResourceAsStream("/stylesheets/LiveResourceTree.xsl");
   Transformer transformer = tFactory.newTransformer(new StreamSource(is) );
   transformer.transform(new StreamSource(conn.getInputStream()), new StreamResult(out));

} catch (Exception ex) {out.println( ex.toString() );}
%>

If you have better simple code pls let me know how to do transformer over.
"/resource/GetResourceHierarchy" [THIS IS SERVLET WHICH GIVES DOM XML OUTPUT]
"/stylesheets/LiveResourceTree.xsl" [THIS IS STYLE SHEET]

rEGARDS,
hYD
0
Comment
Question by:princehyderabad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 12055125
What is the output after login?
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 12062805
Are you getting any type of error or exception??
0
 

Author Comment

by:princehyderabad
ID: 12067385
I think I got the answer, since j_security_check is there, when I try

 URL url = new URL(contextURL + "/resource/GetResourceHierarchy");        
   HttpURLConnection conn = (HttpURLConnection)url.openConnection();            
   conn.setDoInput(true);                

browser reconize this as external request and not allowing. So I hv change the above jsp code to as:
<%  
try {  
   ServletContext context = getServletContext();
   Document doc = (Document)request.getAttribute(id);
   if (doc == null) {
               System.out.println("Document is null");
   }
      System.out.println("Context jsp name: " + id);
   TransformerFactory tFactory = TransformerFactory.newInstance();
   InputStream is = context.getResourceAsStream("/stylesheets/_Admin.xsl");
   Transformer transformer = tFactory.newTransformer(new StreamSource(is));
   Source source = new DOMSource(doc);
   transformer.transform(source, new StreamResult(out));

} catch (Exception ex) {out.println( ex.toString() );}
%>

I GOT THE ANSWER !!!!!!!!!!!!!!!!!!!!!!!
0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
ID: 12414671
Question answered by asker or dialog valuable.
Closed, 500 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working from home is a dream for many people who aren’t happy about getting up early, going to the office, and spending long hours at work. There are lots of benefits of remote work for employees.
What monsters are hiding in your child's room? In this article I will share with you a tech horror story that could happen to anyone, along with some tips on how you can prevent it from happening to you.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question