Re: jndi question

2005-08-25 Thread haim

Hi

I had the same problem and I managed to make this work when following 
this post

http://forums.devshed.com/archive/t-120081

The only problem is that it works when a deploy a war file.
When I try using this out of Eclipse (I am running tomcat using sysdeo 
plug-in) it makes problems.


Let me know how do you use tomcat.

Regards
Haim




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



Re: How do I handle International Characters

2005-05-09 Thread haim
I am using the following plug-in for properties file.
http://propedit.sourceforge.jp/index_en.html
Helps when using messages resources , eliminate the need of native2ascii.exe
Regards
Haim
Harry Mantheakis wrote:
Hello
 

I am using Tomcat 5.0 and I am trying to receive and
send  thai characters. Can someone please tell me the
simplest ways to do this.
   


This worked for me with Japanese characters:
Use a filter to set encodings for both requests and responses:
   request.setCharacterEncoding( UTF-8 );
   response.setContentType( text/html; charset=UTF-8 );
Specify the following HTML header meta-tag in your JSPs:
   meta http-equiv=Content-Type content=text/html; charset=UTF-8
Always specify UTF-8 as the charset.
Stick to submitting form-data with POST methods.
I have not tried encoding URI's with GET requests. If you must use URI's
with GET requests, try to limit yourself to working with ID-string
parameters, so that you can avoid encoding issues.
NOTE: Calling the 'ServletResponse.setContentType()' method (as above) is
equivalent to calling the following two ServletResponse methods together:
   response.setContentType( text/html );
   response.setCharacterEncoding( UTF-8 );
Browsers should (and mostly do, I think) respect the encoding you specify
when setting the response content-type (and the meta-tag content-type) so
you can simply assume (in your filter) that your form-data will be in UTF-8.
Clients still need to, of course, set their browsers to display the relevant
charsets correctly.
HTH.
Harry Mantheakis
London, UK

-
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: IP based restriction

2005-04-04 Thread haim
Try the following filer class
Add this to web.xml
filter
   filter-nameAccessControl/filter-name
   filter-classpackage.AccessControl/filter-class   
 /filter

 filter-mapping
   filter-nameAccessControl/filter-name
   url-pattern/directoryName/*/url-pattern
 /filter-mapping
import java.io.IOException;
import java.util.Properties;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @author haim
*/
public class AccessControl implements Filter {
 /* (non-Javadoc)
* @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
*/
   public void init(FilterConfig arg0) throws ServletException {
   System.out.println(Init AccessControl);
  
   }
   /**
*  Filter the pages accessing back office by their IP address prefix.
*  The following must be set in order to keep this filter working
*  1. Setting of the filter in the web.xml file
*  2. Defining address prefix in the main.properties file by 
defining the
*key access.filter
*  @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, 
javax.servlet.ServletResponse, javax.servlet.FilterChain)
*/
   public void doFilter(ServletRequest request, ServletResponse 
response, FilterChain chain)
throws IOException, ServletException {
  
 HttpServletRequest httpReq = (HttpServletRequest) request;
 HttpServletResponse httpResp = (HttpServletResponse) response;

 String remoteAddress=request.getRemoteAddr();
 System.out.println(Backoffice Access request from +  
remoteAddress);
 //allow only ip's starting with 10.0.
 if(remoteAddress.startsWith(10.0.)){

  System.out.println(Access aproved);
  
 }else{
  System.out.println(Access rejected!);
  httpResp.sendError(HttpServletResponse.SC_FORBIDDEN);
 }

   /*
* Process the rest of the filter chain, if any, and ultimately
* the requested servlet or JSP page.
*/
 chain.doFilter(request, response);
  
   }

}
Regards
Haim
Jobish P wrote:
Hi all,
I am a newbie to Tomcat. I have installed Tomcat 5.0.19 on Redhat LInux 9,
and going fine. I would like to restrict some of my directories to certain
IP's only, say a range of IP. How can I restrict access to a directory in
/tomcat/webappas/ROOT on the basis of IP ? I tried with valves, but not
sure how to restrict the restriction only to particular directories.
It will be of nice if you could provide a solution,
cheers,
---
JOBISH P
NCSI
Indian Institute of Science
Bangalore-12

-
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]


Using hibernate

2005-03-13 Thread haim
We are planing to use object/relational persistence and query service 
like  hibernate or Castor JDO.
Does anyone have any recomaidations for the above?
Does anyone has good/bad experience using similar technologies?

Thanks
Haim

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


Re: Problems loading external stylesheet in Tomcat

2005-02-28 Thread haim
Mieke Banderas wrote:
Anyone seen that the first hit of the day on a Tomcat website, doesn't
load the external stylesheets? Reloading the page loads the stylesheets
also. Can I enforce external stylesheets must be sent with the page
somehow? I only seen this is in Safari so far, but it looks like a server
problem, I'll put a log on there to see if it's true, but if you
recognize this problem, please share your experience.

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

 

I had something similar and it was because I placed the link element 
outside of the head element in my a JSP file that was included as an header.
Check it out , haim .


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


Defining application Global properties.

2005-01-03 Thread haim
I would like to set up some application global properties.
I would like those properties to be available application width, and 
should be loaded as soon as the application loads no mater witch page 
was visit.
I guess I have few options for that , which one do you think is the best 
practice?

 1.  Using the init-param , but those are servelt related and not
application related ?
 2. Using java properties file , but now I need some one to load then
at server startup ?
 3.  Any other good Idea that you may think of?
Thanks
P.S. Does any one know why the search list page is not working?

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