?
Solved

JSP Transformer Error with j_security_check

Posted on 2004-09-13
5
Medium Priority
?
454 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

New style of hardware planning for Microsoft Exchange server.
I don't pretend to be an expert at this, but I have found a few things that are useful. I hope that sharing them here will help others, so they will not have to face some rather hard choices. Since I felt this to be a topic of enough importance and…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

765 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