Re: RE: can iframe include files in web-inf folder?

2004-04-09 Thread bjyang
streaming the content yourself using your own code, or in this case your Struts code.
Couled more detials please?


  bjyang
  [EMAIL PROTECTED]
  2004-04-10





Hi,
Per the servlet spec, a servlet container is not allowed to serve content under 
/WEB-INF to the browser.  That's why your normal HTML links and references like 
src=/WEB-INF/xxx fail.  You can get around this (but you shouldn't) by streaming 
the content yourself using your own code, or in this case your Struts code.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: bjyang_dream [mailto:[EMAIL PROTECTED]
Sent: Friday, April 09, 2004 10:21 AM
To: tomcat-user
Subject: can iframe include files in web-inf folder?

1.in my jsp page information.jsp I do this:
 iframe width=100 height=400 frameborder=1 scrolling=Auto
src=/web-inf/test.jsp
  but when the Tomcat 5.0 just tell me that such page is not available.
2.Then i try another way.
  i created another page called import page,in this page:
  c:import url=${HTMLUrl}/
  jsp:include page=information.jsp 
  Here HTMLUrl comes from my Struts Action,and refer the URL in want to
import in
  the iframe.
  This time,I do get it worked and have HTMLUrl page in the iframe,The
problem
 is when the HTMLUrl has changed,The page in the iframe didn't changed at
the
 same time.
   I use c:out value=${HTMLUrl}/,i can see this also changed.

  Hoping someone to help me,Thank you very much!


$B(Jdream_and_yang
$B([EMAIL PROTECTED]
$B(J2004-04-09


$B(Jbjyang_dream
$B([EMAIL PROTECTED]
$B(J2004-04-09



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

= = = = = = = = = = = = = = = = = = = =



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Re: can iframe include files in web-inf folder?

2004-04-09 Thread bjyang
Thanks,Matt!
I work with Tomcat 5.0 and I do need to access files in the Web-inf folder.
Would you tell me,how can i manage to do that?
Thank you again.





Do you run this through apache or other http server?

The reason that I ask is that the jsp file could have restricted access from
the outside world because it is in the WEB-INF folder.

As a pointer, I wouldn't put you want to be seen by the outside world under
the WEB-INF folder.  You need to keep this for config files, java files/jars
etc etc, because in the future you would want to block any http traffic from
seeing this.

Matt

- Original Message -
From: bjyang_dream [EMAIL PROTECTED]
To: tomcat-user [EMAIL PROTECTED]
Sent: Friday, April 09, 2004 9:20 AM
Subject: can iframe include files in web-inf folder?


 1.in my jsp page information.jsp I do this:
  iframe width=100 height=400 frameborder=1 scrolling=Auto
src=/web-inf/test.jsp
   but when the Tomcat 5.0 just tell me that such page is not available.
 2.Then i try another way.
   i created another page called import page,in this page:
   c:import url=${HTMLUrl}/
   jsp:include page=information.jsp 
   Here HTMLUrl comes from my Struts Action,and refer the URL in want to
import in
   the iframe.
   This time,I do get it worked and have HTMLUrl page in the iframe,The
problem
  is when the HTMLUrl has changed,The page in the iframe didn't changed at
the
  same time.
I use c:out value=${HTMLUrl}/,i can see this also changed.

   Hoping someone to help me,Thank you very much!


 dream_and_yang
 [EMAIL PROTECTED]
 2004-04-09


 bjyang_dream
 [EMAIL PROTECTED]
 2004-04-09




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

= = = = = = = = = = = = = = = = = = = =



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: RE: can iframe include files in web-inf folder?

2004-04-09 Thread Parsons Technical Services
bjyang,

The jvm running under Tomcat can read any file with the standard file
read/write operations provided in the Java api as long as the user that the
jvm is running as has rights to that file. So write a servlet that receives
the request reads the file from the directory and the streams it back to the
client.

As for code I have none at this point, but a little googling should turn up
something.

Doug


- Original Message - 
From: bjyang [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Saturday, April 10, 2004 12:00 AM
Subject: Re: RE: can iframe include files in web-inf folder?


streaming the content yourself using your own code, or in this case your
Struts code.
Couled more detials please?


  bjyang
  [EMAIL PROTECTED]
  2004-04-10





Hi,
Per the servlet spec, a servlet container is not allowed to serve content
under /WEB-INF to the browser.  That's why your normal HTML links and
references like src=/WEB-INF/xxx fail.  You can get around this (but you
shouldn't) by streaming the content yourself using your own code, or in this
case your Struts code.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: bjyang_dream [mailto:[EMAIL PROTECTED]
Sent: Friday, April 09, 2004 10:21 AM
To: tomcat-user
Subject: can iframe include files in web-inf folder?

1.in my jsp page information.jsp I do this:
 iframe width=100 height=400 frameborder=1 scrolling=Auto
src=/web-inf/test.jsp
  but when the Tomcat 5.0 just tell me that such page is not available.
2.Then i try another way.
  i created another page called import page,in this page:
  c:import url=${HTMLUrl}/
  jsp:include page=information.jsp 
  Here HTMLUrl comes from my Struts Action,and refer the URL in want to
import in
  the iframe.
  This time,I do get it worked and have HTMLUrl page in the iframe,The
problem
 is when the HTMLUrl has changed,The page in the iframe didn't changed at
the
 same time.
   I use c:out value=${HTMLUrl}/,i can see this also changed.

  Hoping someone to help me,Thank you very much!


$B(Jdream_and_yang
$B([EMAIL PROTECTED]
$B(J2004-04-09


$B(Jbjyang_dream
$B([EMAIL PROTECTED]
$B(J2004-04-09



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

= = = = = = = = = = = = = = = = = = = =



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: RE: can iframe include files in web-inf folder?

2004-04-09 Thread Shapira, Yoav

Hi,

streaming the content yourself using your own code, or in this case
your
Struts code.
Couled more detials please?

a href=WEB-INF/someFile.txtClick Here!/a would lead to a 404 if
the user clicks on it as I previously explained.

Now imagine a servlet:

public class BadServlet extends HttpServlet {
  protected void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException {
String requestedFile = req.getParameter(requestedFile);
InputStream is =
getServletContext().getResourceAsStream(requestedFile);
BufferedInputStream bis = new BufferedInputStream(is);
String line = null;

res.setContentType(text/html);
PrintWriter out = res.getWriter();

while((line = bis.readLine()) != null) {
  out.println(line);
}

bis.close();
  }
}

Map this servlet in web.xml to /BadServlet, and go to
http://localhost:8080/BadServlet?requestedFile=/WEB-INF/someFile.txt to
see how it's served.  I typed the above from memory without testing, but
it should be close enough to illustrate this point, which is: what
you're doing is bad design.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Re: RE: can iframe include files in web-inf folder?

2004-04-09 Thread bjyang
Thanks,Doug!
Let me try,since it looks a bit trouble to write a servlet to do that.
I do get the file in web-inf folder with jsp:include,but failed to
make it flush in the iframe.
Thans again.


bjyang,

The jvm running under Tomcat can read any file with the standard file
read/write operations provided in the Java api as long as the user that the
jvm is running as has rights to that file. So write a servlet that receives
the request reads the file from the directory and the streams it back to the
client.

As for code I have none at this point, but a little googling should turn up
something.

Doug


- Original Message -
From: bjyang [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Saturday, April 10, 2004 12:00 AM
Subject: Re: RE: can iframe include files in web-inf folder?


streaming the content yourself using your own code, or in this case your
Struts code.
Couled more detials please?


  bjyang
  [EMAIL PROTECTED]
  2004-04-10





Hi,
Per the servlet spec, a servlet container is not allowed to serve content
under /WEB-INF to the browser.  That's why your normal HTML links and
references like src=/WEB-INF/xxx fail.  You can get around this (but you
shouldn't) by streaming the content yourself using your own code, or in this
case your Struts code.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: bjyang_dream [mailto:[EMAIL PROTECTED]
Sent: Friday, April 09, 2004 10:21 AM
To: tomcat-user
Subject: can iframe include files in web-inf folder?

1.in my jsp page information.jsp I do this:
 iframe width=100 height=400 frameborder=1 scrolling=Auto
src=/web-inf/test.jsp
  but when the Tomcat 5.0 just tell me that such page is not available.
2.Then i try another way.
  i created another page called import page,in this page:
  c:import url=${HTMLUrl}/
  jsp:include page=information.jsp 
  Here HTMLUrl comes from my Struts Action,and refer the URL in want to
import in
  the iframe.
  This time,I do get it worked and have HTMLUrl page in the iframe,The
problem
 is when the HTMLUrl has changed,The page in the iframe didn't changed at
the
 same time.
   I use c:out value=${HTMLUrl}/,i can see this also changed.

  Hoping someone to help me,Thank you very much!


$B(Jdream_and_yang
$B([EMAIL PROTECTED]
$B(J2004-04-09


$B(Jbjyang_dream
$B([EMAIL PROTECTED]
$B(J2004-04-09



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

= = = = = = = = = = = = = = = = = = = =



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

= = = = = = = = = = = = = = = = = = = =



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: RE: RE: can iframe include files in web-inf folder?

2004-04-09 Thread bjyang
haha,May be i have to persuade my boss the point you've illustrated
enoughly



Hi,

streaming the content yourself using your own code, or in this case
your
Struts code.
Couled more detials please?

a href=WEB-INF/someFile.txtClick Here!/a would lead to a 404 if
the user clicks on it as I previously explained.

Now imagine a servlet:

public class BadServlet extends HttpServlet {
  protected void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException {
String requestedFile = req.getParameter(requestedFile);
InputStream is =
getServletContext().getResourceAsStream(requestedFile);
BufferedInputStream bis = new BufferedInputStream(is);
String line = null;

res.setContentType(text/html);
PrintWriter out = res.getWriter();

while((line = bis.readLine()) != null) {
  out.println(line);
}
 
bis.close();
  }
}

Map this servlet in web.xml to /BadServlet, and go to
http://localhost:8080/BadServlet?requestedFile=/WEB-INF/someFile.txt to
see how it's served.  I typed the above from memory without testing, but
it should be close enough to illustrate this point, which is: what
you're doing is bad design.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

= = = = = = = = = = = = = = = = = = = =



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]