Re: ssl-forwarding filter not working in IE 6
Actually, I fixed the code by adding encodeRedirectURL method. Strange thing is Firefox does not seem to care about proper url encoding, where as IE does. On 4/15/05, Sng Wee Jim [EMAIL PROTECTED] wrote: Try setting the following 2 response header response.setHeader(Pragma, public); response.setHeader(Cache-Control, max-age=0); - Jim -Original Message- From: sudip shrestha [mailto:[EMAIL PROTECTED] Sent: Friday, April 15, 2005 9:54 PM To: Struts Users Mailing List; Tomcat Users List Subject: ssl-forwarding filter not working in IE 6 Hi : I have following code for automatic ssl-forwarding filter: public void doFilter(ServletRequest servletrequest, ServletResponse servletresponse, FilterChain filterchain) throws IOException, ServletException { String s = servletrequest.getScheme(); if( !s.equalsIgnoreCase(http) ) { //System.out.println( Normal filter Operation ); filterchain.doFilter(servletrequest, servletresponse); } else { HttpServletResponse response = (HttpServletResponse)servletresponse; HttpServletRequest request = (HttpServletRequest)servletrequest; //System.out.println( currPort: +request.getServerPort() ); String url = https://; + request.getServerName(); //System.out.println( currUrl: +url ); url = url + : + PORT; //System.out.println( currUrl: +url ); url = url + request.getRequestURI(); //System.out.println( currUrl: +url ); String queryStr = request.getQueryString(); if( queryStr!=null ) url = url + ? + queryStr; //System.out.println( currUrl: +url ); response.sendRedirect(url); return; } } This works perfectly in Firefox. However, IE just sits there till it throws me a page cannot be displayed. If I directly type secure url, e.g., https://domain.com/siteAdd, it works in IE as well, but IE just cannot seem to forward it to the secure url from the plain url. Any suggestions? The information in this email is confidential and is intended solely for the addressee(s). Access to this email by anyone else is unauthorized. If you are not an intended recipient, please notify the sender of this email immediately. You should not copy, use or disseminate the information contained in the email. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Capco. http://www.capco.com/ - 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: getResources(HttpServletRequest) in ActionForm?
Michael J. wrote the following on 4/16/2005 2:24 PM: Action class defines getResources(HttpServletRequest) as follows: protected MessageResources getResources(HttpServletRequest request) { return ((MessageResources) request.getAttribute(Globals.MESSAGES_KEY)); } I don't see why this method is not static. Hopefully, this will be refactored. Hopefully it WON'T be. Why would you want it static? If you wanted to provide your own implementation of ActionForm, I wouldn't want this base class method being static since an instance method in my subclass can't override it (it can only hide it). Statics are usually a bad idea if you plan to use any sort of inheritance. http://java.sun.com/docs/books/tutorial/java/javaOO/override.html -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Keeping general and field specific error messages separate
My form uses the Struts validator. One of its fields is 'required' and I want the error message to show up alongside the field when the form is redisplayed. There may also be general errors and I want these to be listed at the top of the page. Problem is, the field specific error (created by the validator framework) gets displayed alongside the field (correctly) AND as a general error at the top of the page! I don't understand this; the error message must be associated with a field property otherwise it wouldn't show up alongside the field, so why is it also being treated as a general error? The relevant snippets from my code are below. Any help gratefully received. David -- [ struts-config.xml ] form-bean name=areaHierarchyForm type=org.apache.struts.validator.DynaValidatorForm form-property name=name type=java.lang.String/ ... /form-bean ... action path=/area-hierarchy/submit type=com.acme.UpdateAreaHierarchyAction name=areaHierarchyForm scope=session validate=true input=/AreaHierarchy.jsp forward name=continue path=/AreaHierarchy.jsp/ forward name=success path=/area-hierarchy/list.do/ /action [ validation.xml ] form name=areaHierarchyForm field property=name depends=required arg0 key=areaHierarchyForm.name/ /field /form [ MessageResources.properties ] areaHierarchyForm.name=Hierarchy Name [ AreaHierarchy.jsp ] ... !-- General error messages -- logic:messagesPresent span class=errorbean:message key=errors.validation.header//span ul class=error html:messages id=error lic:out value=${error}//li /html:messages /ul /logic:messagesPresent html:form action=/area-hierarchy/submit html:text styleId=name property=name/ !-- Field specific error message -- span class=errorhtml:errors property=name//span ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Best practice for storing configuration data
Title: Messaggio Today I run into an dubt: is the way I always used to store application dependent configuration is correct? I use to store this kind of information in the we.xml file using context-paramlike this one context-paramparam-nameuploadedFilePath/param-name param-valueD:/Documenti/Progetti/jClubHouse/build/uploadedFiles//param-value descriptionThe path to save the uploadedFiles to/description /context-param and then inside actions, I retrieve it using String uploadDir=getServlet().getServletContext().getInitParameter("uploadedFilePath"); is there a better practice or is this the right one? Simone -Simone Chiarettawww.piyosailing.com/SAny sufficiently advanced technology is indistinguishable from magic "Life is short, play hard"
Re: Keeping general and field specific error messages separate
At 7:13 PM +0100 4/17/05, David Easley wrote: My form uses the Struts validator. One of its fields is 'required' and I want the error message to show up alongside the field when the form is redisplayed. There may also be general errors and I want these to be listed at the top of the page. Problem is, the field specific error (created by the validator framework) gets displayed alongside the field (correctly) AND as a general error at the top of the page! I don't understand this; the error message must be associated with a field property otherwise it wouldn't show up alongside the field, so why is it also being treated as a general error? When you ask a JSP tag (html:messages or html:errors) to iterate through errors without specifying a property, it iterates through all messages; basically, you are just guessing wrong as to its default behavior. To get the behavior you want, one must specify as the property the String literal used for global errors, that is: org.apache.struts.action.GLOBAL_MESSAGE It would be good to extend those JSP tag implementations to have another attribute which basically meant only show global messages so that you wouldn't have to know that literal value. In fact, I just filed an enhancement ticket in Bugzilla about it: http://issues.apache.org/bugzilla/show_bug.cgi?id=34489 I don't have time to write the patch right now, but as noted in the ticket, this would be a pretty easy one for someone interested in volunteering some time. Joe The relevant snippets from my code are below. Any help gratefully received. David -- [ struts-config.xml ] form-bean name=areaHierarchyForm type=org.apache.struts.validator.DynaValidatorForm form-property name=name type=java.lang.String/ ... /form-bean ... action path=/area-hierarchy/submit type=com.acme.UpdateAreaHierarchyAction name=areaHierarchyForm scope=session validate=true input=/AreaHierarchy.jsp forward name=continue path=/AreaHierarchy.jsp/ forward name=success path=/area-hierarchy/list.do/ /action [ validation.xml ] form name=areaHierarchyForm field property=name depends=required arg0 key=areaHierarchyForm.name/ /field /form [ MessageResources.properties ] areaHierarchyForm.name=Hierarchy Name [ AreaHierarchy.jsp ] ... !-- General error messages -- logic:messagesPresent span class=errorbean:message key=errors.validation.header//span ul class=error html:messages id=error lic:out value=${error}//li /html:messages /ul /logic:messagesPresent html:form action=/area-hierarchy/submit html:text styleId=name property=name/ !-- Field specific error message -- span class=errorhtml:errors property=name//span ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getResources(HttpServletRequest) in ActionForm?
On 4/17/05, Rick Reumann [EMAIL PROTECTED] wrote: Michael J. wrote the following on 4/16/2005 2:24 PM: Action class defines getResources(HttpServletRequest) as follows: protected MessageResources getResources(HttpServletRequest request) { return ((MessageResources) request.getAttribute(Globals.MESSAGES_KEY)); } I don't see why this method is not static. Hopefully, this will be refactored. Hopefully it WON'T be. Why would you want it static? If you wanted to provide your own implementation of ActionForm, I wouldn't want this base class method being static since an instance method in my subclass can't override it (it can only hide it). Statics are usually a bad idea if you plan to use any sort of inheritance. http://java.sun.com/docs/books/tutorial/java/javaOO/override.html -- Rick I see your point. So what choices are available? * Make a separate static method in a utility class. Actually, this is already done: getResources() in org.apache.struts.validator.Resources does exactly what original question author asked for. * Make method public. I don't see how this can harm in this particular situation. * Make method static. You are against it, but let's see. getResources() is a utility method. Most likely, one would not redefine it for every child type. At most, one would redefine this method only once in the root of the hierarchy, and then just call it throughout the hierarchy. In this case the fact that this method is static, won't make a difference, as long as all classes are cast to the root class of custom hierarchy. But I see how it can cause bugs if proper typecast is not made. On the other hand, Struts uses typecasts all around, starting from casting Form class to a particular form bean. Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with Struts 1.2.4 - ActionMessage vs ActionError
Joe wroteA common case here would be if you are returning a redirecting forward; in that case, the JSP would be drawn in response to a second HTTP request, and the saved errors would have been lost. No, nothing special just the plain vanilla form-jsp setup. struts-config snips: form-bean name=logonForm type=us.glsi.base.LogonForm/ !-- Logon Action -- action path=/logon type=org.apache.struts.actions.ForwardAction forward=/index.jsp/ action path=/submit_logon type=us.glsi.base.LogonAction name=logonForm scope=request validate=true input=/index.jsp forward name=success path=/pub_home.do/ /action And Yes, my taglibs are bound to h:, l:, . (less typing ;-) -- L.W.(Les) Dunaway GL Services 770-974-4289 / 888-243-9886 [EMAIL PROTECTED] Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Admiral Hyman Rickover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]