Solved

JSP Transformer Error with j_security_check

Posted on 2004-09-13
5
449 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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

After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
Let’s face it: one of the reasons your organization chose a SaaS solution (whether Microsoft Dynamics 365, Netsuite or SAP) is that it is subscription-based. The upkeep is done. Or so you think.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

728 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