Author: doogie
Date: Sat Mar 21 23:24:37 2009 New Revision: 757075 URL: http://svn.apache.org/viewvc?rev=757075&view=rev Log: Fix purely empty whitespace lines, and remove trailing whitespace. Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlActivationEventListener.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginEventListener.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandlerException.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/AbstractJSONEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/DojoJSONServiceEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/EventFactory.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/EventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/EventHandlerException.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/FileUploadProgressListener.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/GroovyEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/JSONJavaEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/JSONServiceEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/JSONSimpleEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/JavaEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/RomeEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/SOAPEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceStreamHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/SimpleEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/TestEvent.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/WfsEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewRenderer.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/JpCacheIncludeTransform.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/LoopWriter.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizAmountTransform.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCacheStorage.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizContentTransform.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizUrlTransform.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/RenderWrappedTextTransform.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/SetRequestAttributeMethod.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/EntityField.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/InputValue.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/region/Content.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/region/Region.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/region/RegionManager.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/region/RegionStack.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/region/RegionTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/region/RenderTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/region/Section.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/AbstractParameterTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ContentUrlTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/EntityFieldTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/FormatTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/I18nBundleTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/I18nMessageArgumentTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/I18nMessageTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IfTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/InputValueTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IterateNextTEI.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IterateNextTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IteratorHasNextTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IteratorTEI.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/IteratorTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ObjectTEI.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ObjectTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ParamTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/PrintTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/ServiceTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/UnlessTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/UrlTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/AbstractXmlRpcTestCase.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/test/XmlRpcTests.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/AbstractViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopFactory.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/DataVisionViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/FopPdfViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/FopRenderer.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/GenericViewRenderer.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/HttpViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JPublishViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JPublishWrapper.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsJXlsViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPdfViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPoiXlsViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsXmlViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JspViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/RegionViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/VelocityViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ViewFactory.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ViewHandlerException.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/WfsViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteWorker.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/xmlrpc/XmlRpcClient.java Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java?rev=757075&r1=757074&r2=757075&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java Sat Mar 21 23:24:37 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -50,7 +50,7 @@ public static final String module = ConfigXMLReader.class.getName(); public static final String controllerXmlFileName = "/WEB-INF/controller.xml"; - + public static UtilCache<URL, ControllerConfig> controllerCache = new UtilCache<URL, ControllerConfig>("webapp.ControllerConfig"); public static UtilCache<String, List<ControllerConfig>> controllerSearchResultsCache = new UtilCache<String, List<ControllerConfig>>("webapp.ControllerSearchResults"); @@ -62,7 +62,7 @@ return null; } } - + public static ControllerConfig getControllerConfig(URL url) { ControllerConfig controllerConfig = controllerCache.get(url); if (controllerConfig == null) { // don't want to block here @@ -77,22 +77,22 @@ } return controllerConfig; } - + public static class ControllerConfig { public URL url; - + public String errorpage; public String protectView; public String owner; public String securityClass; public String defaultRequest; - + public List<Event> firstVisitEventList = FastList.newInstance(); public List<Event> preprocessorEventList = FastList.newInstance(); public List<Event> postprocessorEventList = FastList.newInstance(); public List<Event> afterLoginEventList = FastList.newInstance(); public List<Event> beforeLogoutEventList = FastList.newInstance(); - + public Map<String, String> eventHandlerMap = FastMap.newInstance(); public Map<String, String> viewHandlerMap = FastMap.newInstance(); @@ -101,17 +101,17 @@ public ControllerConfig(URL url) { this.url = url; - + Element rootElement = loadDocument(url); if (rootElement != null) { long startTime = System.currentTimeMillis(); - + loadIncludes(rootElement); loadGeneralConfig(rootElement); loadHandlerMap(rootElement); loadRequestMap(rootElement); loadViewMap(rootElement); - + if (Debug.infoOn()) { double totalSeconds = (System.currentTimeMillis() - startTime)/1000.0; String locString = this.url.toExternalForm(); @@ -119,29 +119,29 @@ } } } - + protected void absorbControllerConfig(ControllerConfig controllerConfig) { // copy/add all data except the url - + this.errorpage = controllerConfig.errorpage; this.protectView = controllerConfig.protectView; this.owner = controllerConfig.owner; this.securityClass = controllerConfig.securityClass; this.defaultRequest = controllerConfig.defaultRequest; - + this.firstVisitEventList.addAll(controllerConfig.firstVisitEventList); this.preprocessorEventList.addAll(controllerConfig.preprocessorEventList); this.postprocessorEventList.addAll(controllerConfig.postprocessorEventList); this.afterLoginEventList.addAll(controllerConfig.afterLoginEventList); this.beforeLogoutEventList.addAll(controllerConfig.beforeLogoutEventList); - + this.eventHandlerMap.putAll(controllerConfig.eventHandlerMap); this.viewHandlerMap.putAll(controllerConfig.viewHandlerMap); - + this.requestMapMap.putAll(controllerConfig.requestMapMap); this.viewMapMap.putAll(controllerConfig.viewMapMap); } - + protected void loadIncludes(Element rootElement) { for (Element includeElement: UtilXml.childElementList(rootElement, "include")) { String includeLocation = includeElement.getAttribute("location"); @@ -160,7 +160,7 @@ if (rootElement == null) { rootElement = loadDocument(this.url); } - + this.errorpage = UtilXml.childElementValue(rootElement, "errorpage"); Element protectElement = UtilXml.firstChildElement(rootElement, "protect"); if (protectElement != null) { @@ -172,7 +172,7 @@ if (defaultRequestElement != null) { this.defaultRequest = defaultRequestElement.getAttribute("request-uri"); } - + // first visit event Element firstvisitElement = UtilXml.firstChildElement(rootElement, "firstvisit"); if (firstvisitElement != null) { @@ -213,7 +213,7 @@ } } } - + public void loadHandlerMap(Element rootElement) { if (rootElement == null) { rootElement = loadDocument(this.url); @@ -224,7 +224,7 @@ String name = handlerElement.getAttribute("name"); String type = handlerElement.getAttribute("type"); String className = handlerElement.getAttribute("class"); - + if ("view".equals(type)) { this.viewHandlerMap.put(name, className); } else { @@ -244,7 +244,7 @@ this.requestMapMap.put(requestMap.uri, requestMap); } } - + public void loadViewMap(Element rootElement) { if (rootElement == null) { rootElement = loadDocument(this.url); @@ -259,22 +259,22 @@ } } - + public static Set<String> findControllerFilesWithRequest(String requestUri, String controllerPartialPath) throws GeneralException { Set<String> allControllerRequestSet = FastSet.newInstance(); - + if (UtilValidate.isEmpty(requestUri)) { return allControllerRequestSet; } - + String cacheId = controllerPartialPath != null ? controllerPartialPath : "NOPARTIALPATH"; List<ControllerConfig> controllerConfigs = (List<ControllerConfig>) controllerSearchResultsCache.get(cacheId); - + if (controllerConfigs == null) { try { // find controller.xml file with webappMountPoint + "/WEB-INF" in the path List<File> controllerFiles = FileUtil.findXmlFiles(null, controllerPartialPath, "site-conf", "site-conf.xsd"); - + controllerConfigs = FastList.newInstance(); for (File controllerFile: controllerFiles) { URL controllerUrl = null; @@ -286,13 +286,13 @@ ControllerConfig cc = ConfigXMLReader.getControllerConfig(controllerUrl); controllerConfigs.add(cc); } - + controllerSearchResultsCache.put(cacheId, controllerConfigs); } catch (IOException e) { throw new GeneralException("Error finding controller XML files to lookup request references: " + e.toString(), e); } } - + if (controllerConfigs != null) { for (ControllerConfig cc: controllerConfigs) { // make sure it has the named request in it @@ -303,26 +303,26 @@ } } } - + return allControllerRequestSet; } - + public static Set<String> findControllerRequestUniqueForTargetType(String target, String urlMode) throws GeneralException { if (UtilValidate.isEmpty(urlMode)) { urlMode = "intra-app"; } - + int indexOfDollarSignCurlyBrace = target.indexOf("${"); int indexOfQuestionMark = target.indexOf("?"); if (indexOfDollarSignCurlyBrace >= 0 && (indexOfQuestionMark < 0 || indexOfQuestionMark > indexOfDollarSignCurlyBrace)) { // we have an expanded string in the requestUri part of the target, not much we can do about that... return null; } - + if ("intra-app".equals(urlMode)) { // look through all controller.xml files and find those with the request-uri referred to by the target String requestUri = UtilHttp.getRequestUriFromTarget(target); - + Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerFilesWithRequest(requestUri, null); // if (controllerLocAndRequestSet.size() > 0) Debug.logInfo("============== In findRequestNamesLinkedtoInWidget, controllerLocAndRequestSet: " + controllerLocAndRequestSet, module); return controllerLocAndRequestSet; @@ -330,7 +330,7 @@ String webappMountPoint = UtilHttp.getWebappMountPointFromTarget(target); if (webappMountPoint != null) webappMountPoint += "/WEB-INF"; String requestUri = UtilHttp.getRequestUriFromTarget(target); - + Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerFilesWithRequest(requestUri, webappMountPoint); // if (controllerLocAndRequestSet.size() > 0) Debug.logInfo("============== In findRequestNamesLinkedtoInWidget, controllerLocAndRequestSet: " + controllerLocAndRequestSet, module); return controllerLocAndRequestSet; @@ -353,22 +353,22 @@ } return null; } - + public static class RequestMap { public String uri; public boolean edit = true; public boolean trackVisit = true; public boolean trackServerHit = true; public String description; - + public Event event; - + public boolean securityHttps = false; public boolean securityAuth = false; public boolean securityCert = false; public boolean securityExternalView = true; public boolean securityDirectRequest = true; - + public Map<String, RequestResponse> requestResponseMap = FastMap.newInstance(); public RequestMap(Element requestMapElement) { @@ -405,7 +405,7 @@ } } } - + public static class Event { public String type; public String path; @@ -426,7 +426,7 @@ this.globalTransaction = globalTransaction; } } - + public static final RequestResponse emptyNoneRequestResponse = RequestResponse.createEmptyNoneRequestResponse(); public static class RequestResponse { public String name; @@ -434,7 +434,7 @@ public String value; public boolean saveLastView = false; public Map<String, String> redirectParameterMap = FastMap.newInstance(); - + public RequestResponse(Element responseElement) { this.name = responseElement.getAttribute("name"); this.type = responseElement.getAttribute("type"); @@ -446,9 +446,9 @@ this.redirectParameterMap.put(redirectParameterElement.getAttribute("name"), from); } } - + public RequestResponse() { } - + public static RequestResponse createEmptyNoneRequestResponse() { RequestResponse requestResponse = new RequestResponse(); requestResponse.name = "empty-none"; @@ -457,7 +457,7 @@ return requestResponse; } } - + public static class ViewMap { public String viewMap; public String name; Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java?rev=757075&r1=757074&r2=757075&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java Sat Mar 21 23:24:37 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlActivationEventListener.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlActivationEventListener.java?rev=757075&r1=757074&r2=757075&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlActivationEventListener.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlActivationEventListener.java Sat Mar 21 23:24:37 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java?rev=757075&r1=757074&r2=757075&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java Sat Mar 21 23:24:37 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -65,12 +65,12 @@ public void sessionDestroyed(HttpSessionEvent event) { HttpSession session = event.getSession(); - + // Finalize the Visit boolean beganTransaction = false; try { beganTransaction = TransactionUtil.begin(); - + // instead of using this message, get directly from session attribute so it won't create a new one: GenericValue visit = VisitHandler.getVisit(session); GenericValue visit = (GenericValue) session.getAttribute("visit"); if (visit != null) { @@ -88,7 +88,7 @@ userLoginSession = userLogin.getRelatedOne("UserLoginSession"); if (userLoginSession == null) { - userLoginSession = userLogin.getDelegator().makeValue("UserLoginSession", + userLoginSession = userLogin.getDelegator().makeValue("UserLoginSession", UtilMisc.toMap("userLoginId", userLogin.getString("userLoginId"))); userLogin.getDelegator().create(userLoginSession); } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java?rev=757075&r1=757074&r2=757075&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java Sat Mar 21 23:24:37 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -82,7 +82,7 @@ */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { long requestStartTime = System.currentTimeMillis(); - RequestHandler requestHandler = this.getRequestHandler(); + RequestHandler requestHandler = this.getRequestHandler(); HttpSession session = request.getSession(); // setup DEFAULT chararcter encoding and content type, this will be overridden in the RequestHandler for view rendering @@ -111,7 +111,7 @@ if (userLogin != null) { GenericDelegator.pushUserIdentifier(userLogin.getString("userLoginId")); } - + // workaraound if we are in the root webapp String webappName = UtilHttp.getApplicationName(request); @@ -174,7 +174,7 @@ Debug.logError("[ControlServlet] ERROR: security not found in ServletContext", module); } request.setAttribute("security", security); - + request.setAttribute("_REQUEST_HANDLER_", requestHandler); // setup some things that should always be there @@ -223,7 +223,7 @@ if (request.getAttribute("_ERROR_OCCURRED_") == null && rd != null) { request.setAttribute("_ERROR_OCCURRED_", Boolean.TRUE); Debug.logError("Including errorPage: " + errorPage, module); - + // NOTE DEJ20070727 after having trouble with all of these, try to get the page out and as a last resort just send something back try { rd.include(request, response); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginEventListener.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginEventListener.java?rev=757075&r1=757074&r2=757075&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginEventListener.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginEventListener.java Sat Mar 21 23:24:37 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java?rev=757075&r1=757074&r2=757075&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java Sat Mar 21 23:24:37 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -70,7 +70,7 @@ * Common Workers */ public class LoginWorker { - + public final static String module = LoginWorker.class.getName(); public static final String resourceWebapp = "SecurityextUiLabels"; @@ -79,7 +79,7 @@ /** This Map is keyed by the randomly generated externalLoginKey and the value is a UserLogin GenericValue object */ public static Map<String, GenericValue> externalLoginKeys = FastMap.newInstance(); - + public static StringWrapper makeLoginUrl(PageContext pageContext) { return makeLoginUrl(pageContext, "checkLogin"); } @@ -87,7 +87,7 @@ public static StringWrapper makeLoginUrl(HttpServletRequest request) { return makeLoginUrl(request, "checkLogin"); } - + public static StringWrapper makeLoginUrl(PageContext pageContext, String requestName) { return makeLoginUrl((HttpServletRequest) pageContext.getRequest(), requestName); } @@ -109,7 +109,7 @@ return StringUtil.wrapString(loginUrl); } - + /** * Gets (and creates if necessary) a key to be used for an external login parameter */ @@ -154,7 +154,7 @@ if (UtilValidate.isEmpty(userLoginId)) { Debug.logWarning("Called setLogged out with empty userLoginId", module); } - + Transaction parentTx = null; boolean beganTransaction = false; @@ -254,12 +254,12 @@ // in this condition log them in if not already; if not logged in or can't log in, save parameters and return error if ((username == null) || (password == null) || ("error".equals(login(request, response)))) { - // make sure this attribute is not in the request; this avoids infinite recursion when a login by less stringent criteria (like not checkout the hasLoggedOut field) passes; this is not a normal circumstance but can happen with custom code or in funny error situations when the userLogin service gets the userLogin object but runs into another problem and fails to return an error + // make sure this attribute is not in the request; this avoids infinite recursion when a login by less stringent criteria (like not checkout the hasLoggedOut field) passes; this is not a normal circumstance but can happen with custom code or in funny error situations when the userLogin service gets the userLogin object but runs into another problem and fails to return an error request.removeAttribute("_LOGIN_PASSED_"); - + // keep the previous request name in the session session.setAttribute("_PREVIOUS_REQUEST_", request.getPathInfo()); - + // NOTE: not using the old _PREVIOUS_PARAMS_ attribute at all because it was a security hole as it was used to put data in the URL (never encrypted) that was originally in a form field that may have been encrypted // keep 2 maps: one for URL parameters and one for form parameters Map<String, Object> urlParams = UtilHttp.getUrlOnlyParameterMap(request); @@ -290,7 +290,7 @@ */ public static String login(HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); - + if (session.getAttribute("userLogin") != null) { // already logged in, do nothing... return "success"; @@ -301,7 +301,7 @@ if (username == null) username = (String) session.getAttribute("USERNAME"); if (password == null) password = (String) session.getAttribute("PASSWORD"); - + // allow a username and/or password in a request attribute to override the request parameter or the session attribute; this way a preprocessor can play with these a bit... if (UtilValidate.isNotEmpty((String) request.getAttribute("USERNAME"))) { username = (String) request.getAttribute("USERNAME"); @@ -321,7 +321,7 @@ request.setAttribute("_ERROR_MESSAGE_LIST_", unpwErrMsgList); return "error"; } - + if ((username != null) && ("true".equalsIgnoreCase(UtilProperties.getPropertyValue("security.properties", "username.lowercase")))) { username = username.toLowerCase(); @@ -644,7 +644,7 @@ // Shouldn't be here if all went well return "error"; } - + // preprocessor method to login a user from a HTTP request header (configured in security.properties) public static String checkRequestHeaderLogin(HttpServletRequest request, HttpServletResponse response) { String httpHeader = UtilProperties.getPropertyValue("security.properties", "security.login.http.header", null); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java?rev=757075&r1=757074&r2=757075&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java Sat Mar 21 23:24:37 2009 @@ -1,141 +1,141 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations - * under the License. - *******************************************************************************/ -package org.ofbiz.webapp.control; - -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import javolution.util.FastMap; - -import org.ofbiz.base.util.Debug; -import org.ofbiz.base.util.UtilHttp; -import org.ofbiz.base.util.UtilMisc; -import org.ofbiz.base.util.UtilProperties; -import org.ofbiz.base.util.UtilValidate; -import org.ofbiz.entity.GenericDelegator; -import org.ofbiz.entity.GenericEntityException; -import org.ofbiz.entity.GenericValue; -import org.ofbiz.service.ServiceUtil; + * under the License. + *******************************************************************************/ +package org.ofbiz.webapp.control; + +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import javolution.util.FastMap; + +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilHttp; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilProperties; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.entity.GenericDelegator; +import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.service.ServiceUtil; -/** +/** * Common Workers - */ -public class ProtectViewWorker { - - private final static String module = ProtectViewWorker.class.getName(); - private static final String resourceWebapp = "WebappUiLabels"; - private static final FastMap<String, Long> hitsByViewAccessed = FastMap.newInstance(); - private static final FastMap<String, Long> durationByViewAccessed = FastMap.newInstance(); - private static final Long one = new Long(1); - - /** - * An HTTP WebEvent handler that checks to see if an userLogin should be tarpitted - * The decision is made in regard of number of hits in last period of time - * - * @param request The HTTP request object for the current JSP or Servlet request. - * @param response The HTTP response object for the current JSP or Servlet request. - * @return String - */ - public static String checkProtectedView(HttpServletRequest request, HttpServletResponse response) { - HttpSession session = request.getSession(); - String viewNameId = RequestHandler.getRequestUri(request.getPathInfo()); - GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); - GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); - String returnValue = "success"; - - if (userLogin != null) { - String userLoginId = userLogin.getString("userLoginId"); - try { - List<GenericValue> protectedViews = delegator.findByAnd("UserLoginAndProtectedView", - UtilMisc.toMap("userLoginId", userLoginId, "viewNameId", viewNameId)); - // Any views to deal with ? - if (UtilValidate.isNotEmpty(protectedViews)) { - Long now = System.currentTimeMillis(); // we are not in a margin of some milliseconds - - // Is this login/view couple already tarpitted ? (ie denied access to view for login for a period of time) - List<GenericValue> tarpittedLoginViews = delegator.findByAnd("TarpittedLoginView", - UtilMisc.toMap("userLoginId", userLoginId, "viewNameId", viewNameId)); - if (UtilValidate.isNotEmpty(tarpittedLoginViews)) { - GenericValue tarpittedLoginView = tarpittedLoginViews.get(0); - Long tarpitReleaseDateTime = (Long) tarpittedLoginView.get("tarpitReleaseDateTime"); - if (now < tarpitReleaseDateTime) { - String tarpittedMessage = UtilProperties.getMessage(resourceWebapp, "protectedviewevents.tarpitted_message", UtilHttp.getLocale(request)); - // reset since now protected by the tarpit duration - hitsByViewAccessed.put(viewNameId, new Long(0)); - return ":_protect_:" + tarpittedMessage; - } - } - GenericValue protectedView = protectedViews.get(0); - // 1st hit ? - if (UtilValidate.isEmpty(hitsByViewAccessed.get(viewNameId))) { - hitsByViewAccessed.put(viewNameId, one); - Long maxHitsDuration = (Long) protectedView.get("maxHitsDuration") * 1000; - durationByViewAccessed.put(viewNameId, now + maxHitsDuration); - } else { - Long maxHits = protectedView.getLong("maxHits"); - Long maxDuration = (Long) durationByViewAccessed.get(viewNameId); - Long newMaxHits = (Long) hitsByViewAccessed.get(viewNameId) + one; - hitsByViewAccessed.put(viewNameId, newMaxHits); - // Are we in a period of time where we need to check if there was too much hits ? - if (now < maxDuration) { - // Too much hits ? - if (newMaxHits > maxHits) { // yes : block and set tarpitReleaseDateTime - String blockedMessage = UtilProperties.getMessage(resourceWebapp, "protectedviewevents.blocked_message", UtilHttp.getLocale(request)); - returnValue = ":_protect_:" + blockedMessage; - - Long tarpitDuration = (Long) protectedView.get("tarpitDuration") * 1000; - - GenericValue tarpittedLoginView = delegator.makeValue("TarpittedLoginView"); - tarpittedLoginView.set("userLoginId", userLoginId); - tarpittedLoginView.set("viewNameId", viewNameId); - tarpittedLoginView.set("tarpitReleaseDateTime", now + tarpitDuration); - - try { - delegator.createOrStore(tarpittedLoginView); - } catch (GenericEntityException e) { - Debug.logError(e, "Could not save TarpittedLoginView:", module); - } - } - } else { - // The period of time is revolved, we begin a new one. - // Actually it's not a discrete process but we do as it was... - // We don't need precision here, a theft will be catch anyway ! - // We could also take an average of hits in the last x periods of time as initial value, - // but it would does not make much more sense. - // Of course for this to works well the tarpitting period must be long enough... - hitsByViewAccessed.put(viewNameId, one); - Long maxHitsDuration = (Long) protectedView.get("maxHitsDuration") * 1000; - durationByViewAccessed.put(viewNameId, now + maxHitsDuration); - } - } - } - } catch (GenericEntityException e) { - Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.getMessage()); - String errMsg = UtilProperties.getMessage("CommonUiLabels", "CommonDatabaseProblem", messageMap, UtilHttp.getLocale(request)); - Debug.logError(e, errMsg, module); - } - } - - return returnValue; - } -} + */ +public class ProtectViewWorker { + + private final static String module = ProtectViewWorker.class.getName(); + private static final String resourceWebapp = "WebappUiLabels"; + private static final FastMap<String, Long> hitsByViewAccessed = FastMap.newInstance(); + private static final FastMap<String, Long> durationByViewAccessed = FastMap.newInstance(); + private static final Long one = new Long(1); + + /** + * An HTTP WebEvent handler that checks to see if an userLogin should be tarpitted + * The decision is made in regard of number of hits in last period of time + * + * @param request The HTTP request object for the current JSP or Servlet request. + * @param response The HTTP response object for the current JSP or Servlet request. + * @return String + */ + public static String checkProtectedView(HttpServletRequest request, HttpServletResponse response) { + HttpSession session = request.getSession(); + String viewNameId = RequestHandler.getRequestUri(request.getPathInfo()); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); + GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); + String returnValue = "success"; + + if (userLogin != null) { + String userLoginId = userLogin.getString("userLoginId"); + try { + List<GenericValue> protectedViews = delegator.findByAnd("UserLoginAndProtectedView", + UtilMisc.toMap("userLoginId", userLoginId, "viewNameId", viewNameId)); + // Any views to deal with ? + if (UtilValidate.isNotEmpty(protectedViews)) { + Long now = System.currentTimeMillis(); // we are not in a margin of some milliseconds + + // Is this login/view couple already tarpitted ? (ie denied access to view for login for a period of time) + List<GenericValue> tarpittedLoginViews = delegator.findByAnd("TarpittedLoginView", + UtilMisc.toMap("userLoginId", userLoginId, "viewNameId", viewNameId)); + if (UtilValidate.isNotEmpty(tarpittedLoginViews)) { + GenericValue tarpittedLoginView = tarpittedLoginViews.get(0); + Long tarpitReleaseDateTime = (Long) tarpittedLoginView.get("tarpitReleaseDateTime"); + if (now < tarpitReleaseDateTime) { + String tarpittedMessage = UtilProperties.getMessage(resourceWebapp, "protectedviewevents.tarpitted_message", UtilHttp.getLocale(request)); + // reset since now protected by the tarpit duration + hitsByViewAccessed.put(viewNameId, new Long(0)); + return ":_protect_:" + tarpittedMessage; + } + } + GenericValue protectedView = protectedViews.get(0); + // 1st hit ? + if (UtilValidate.isEmpty(hitsByViewAccessed.get(viewNameId))) { + hitsByViewAccessed.put(viewNameId, one); + Long maxHitsDuration = (Long) protectedView.get("maxHitsDuration") * 1000; + durationByViewAccessed.put(viewNameId, now + maxHitsDuration); + } else { + Long maxHits = protectedView.getLong("maxHits"); + Long maxDuration = (Long) durationByViewAccessed.get(viewNameId); + Long newMaxHits = (Long) hitsByViewAccessed.get(viewNameId) + one; + hitsByViewAccessed.put(viewNameId, newMaxHits); + // Are we in a period of time where we need to check if there was too much hits ? + if (now < maxDuration) { + // Too much hits ? + if (newMaxHits > maxHits) { // yes : block and set tarpitReleaseDateTime + String blockedMessage = UtilProperties.getMessage(resourceWebapp, "protectedviewevents.blocked_message", UtilHttp.getLocale(request)); + returnValue = ":_protect_:" + blockedMessage; + + Long tarpitDuration = (Long) protectedView.get("tarpitDuration") * 1000; + + GenericValue tarpittedLoginView = delegator.makeValue("TarpittedLoginView"); + tarpittedLoginView.set("userLoginId", userLoginId); + tarpittedLoginView.set("viewNameId", viewNameId); + tarpittedLoginView.set("tarpitReleaseDateTime", now + tarpitDuration); + + try { + delegator.createOrStore(tarpittedLoginView); + } catch (GenericEntityException e) { + Debug.logError(e, "Could not save TarpittedLoginView:", module); + } + } + } else { + // The period of time is revolved, we begin a new one. + // Actually it's not a discrete process but we do as it was... + // We don't need precision here, a theft will be catch anyway ! + // We could also take an average of hits in the last x periods of time as initial value, + // but it would does not make much more sense. + // Of course for this to works well the tarpitting period must be long enough... + hitsByViewAccessed.put(viewNameId, one); + Long maxHitsDuration = (Long) protectedView.get("maxHitsDuration") * 1000; + durationByViewAccessed.put(viewNameId, now + maxHitsDuration); + } + } + } + } catch (GenericEntityException e) { + Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.getMessage()); + String errMsg = UtilProperties.getMessage("CommonUiLabels", "CommonDatabaseProblem", messageMap, UtilHttp.getLocale(request)); + Debug.logError(e, errMsg, module); + } + } + + return returnValue; + } +} Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java?rev=757075&r1=757074&r2=757075&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java Sat Mar 21 23:24:37 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -71,7 +71,7 @@ if (rh == null) { rh = new RequestHandler(); servletContext.setAttribute("_REQUEST_HANDLER_", rh); - rh.init(servletContext); + rh.init(servletContext); } return rh; } @@ -91,7 +91,7 @@ this.viewFactory = new ViewFactory(this); this.eventFactory = new EventFactory(this); } - + public ConfigXMLReader.ControllerConfig getControllerConfig() { return ConfigXMLReader.getControllerConfig(this.controllerConfigURL); } @@ -107,7 +107,7 @@ GenericValue userLogin, GenericDelegator delegator) throws RequestHandlerException { HttpSession session = request.getSession(); - + // get the controllerConfig once for this method so we don't have to get it over and over inside the method ConfigXMLReader.ControllerConfig controllerConfig = this.getControllerConfig(); @@ -123,9 +123,9 @@ request.setAttribute("targetRequestUri", "/" + defaultRequestUri); } } - + String overrideViewUri = RequestHandler.getOverrideViewUri(request.getPathInfo()); - + String requestMissingErrorMessage = "Unknown request [" + defaultRequestUri + "]; this request does not exist or cannot be called directly."; ConfigXMLReader.RequestMap requestMap = null; if (defaultRequestUri != null) { @@ -157,7 +157,7 @@ // Check if X509 is required and we are not secure; throw exception if (!request.isSecure() && requestMap.securityCert) { throw new RequestHandlerException(requestMissingErrorMessage); - } + } // Check to make sure we are allowed to access this request directly. (Also checks if this request is defined.) // If the request cannot be called, or is not defined, check and see if there is a default-request we an process @@ -192,9 +192,9 @@ } } } - + // Check for HTTPS client (x.509) security - if (request.isSecure() && requestMap.securityCert) { + if (request.isSecure() && requestMap.securityCert) { X509Certificate[] clientCerts = (X509Certificate[]) request.getAttribute("javax.servlet.request.X509Certificate"); // 2.2 spec if (clientCerts == null) { clientCerts = (X509Certificate[]) request.getAttribute("javax.net.ssl.peer_certificates"); // 2.1 spec @@ -214,7 +214,7 @@ Debug.logInfo(clientCerts[i].getSubjectX500Principal().getName(), module); } } - + // check if this is a trusted cert if (SSLUtil.isClientTrusted(clientCerts, null)) { foundTrustedCert = true; @@ -256,7 +256,7 @@ if (returnString != null && !returnString.equalsIgnoreCase("success")) { if (!returnString.contains(":_protect_:")) { throw new EventHandlerException("Pre-Processor event did not return 'success'."); - } else { // protect the view normally rendered and redirect to error response view + } else { // protect the view normally rendered and redirect to error response view returnString = returnString.replace(":_protect_:", ""); if (returnString.length() > 0) { request.setAttribute("_ERROR_MESSAGE_", returnString); @@ -269,7 +269,7 @@ } else { overrideViewUri = UtilProperties.getPropertyValue("security.properties", "default.error.response.view"); } - } + } } } else if (returnString == null) { interruptRequest = true; @@ -289,7 +289,7 @@ if (Debug.verboseOn()) Debug.logVerbose("[Processing Request]: " + requestMap.uri + " sessionId=" + UtilHttp.getSessionId(request), module); request.setAttribute("thisRequestUri", requestMap.uri); // store the actual request URI - + // Perform security check. if (requestMap.securityAuth) { @@ -310,7 +310,7 @@ requestMap = controllerConfig.requestMapMap.get("checkLogin"); } } - + // after security check but before running the event, see if a post-login redirect has completed and we have data from the pre-login request form to use now // we know this is the case if the _PREVIOUS_PARAM_MAP_ attribute is there, but the _PREVIOUS_REQUEST_ attribute has already been removed if (request.getSession().getAttribute("_PREVIOUS_PARAM_MAP_FORM_") != null && request.getSession().getAttribute("_PREVIOUS_REQUEST_") == null) { @@ -325,7 +325,7 @@ // now we can start looking for the next request response to use ConfigXMLReader.RequestResponse nextRequestResponse = null; - + // Invoke the defined event (unless login failed) if (eventReturn == null && requestMap.event != null) { if (requestMap.event.type != null && requestMap.event.path != null && requestMap.event.invoke != null) { @@ -358,7 +358,7 @@ } } } - + // Process the eventReturn // at this point eventReturnString is finalized, so get the RequestResponse ConfigXMLReader.RequestResponse eventReturnBasedRequestResponse = eventReturn == null ? null : requestMap.requestResponseMap.get(eventReturn); @@ -389,7 +389,7 @@ // get the previous request info String previousRequest = (String) request.getSession().getAttribute("_PREVIOUS_REQUEST_"); String loginPass = (String) request.getAttribute("_LOGIN_PASSED_"); - + // restore previous redirected request's attribute, so redirected page can display previous request's error msg etc. String preReqAttStr = (String) request.getSession().getAttribute("_REQ_ATTR_MAP_"); Map<String, Object> previousRequestAttrMap = null; @@ -420,7 +420,7 @@ Debug.logWarning("Found special _PREVIOUS_REQUEST_ of [" + previousRequest + "], setting to null to avoid problems, not running request again", module); } else { if (Debug.infoOn()) Debug.logInfo("[Doing Previous Request]: " + previousRequest + " sessionId=" + UtilHttp.getSessionId(request), module); - + // note that the previous form parameters are not setup (only the URL ones here), they will be found in the session later and handled when the old request redirect comes back Map<String, Object> previousParamMap = UtilGenerics.checkMap(request.getSession().getAttribute("_PREVIOUS_PARAM_MAP_URL_"), String.class, Object.class); String queryString = UtilHttp.urlEncodeArgs(previousParamMap, false); @@ -429,9 +429,9 @@ redirectTarget += "?" + queryString; } callRedirect(makeLink(request, response, redirectTarget), response, request); - + // the old/uglier way: doRequest(request, response, previousRequest, userLogin, delegator); - + // this is needed as the request handled will be taking care of the view, etc return; } @@ -448,28 +448,28 @@ // Make sure we have some sort of response to go to if (nextRequestResponse == null) nextRequestResponse = successResponse; - + if (nextRequestResponse == null) { throw new RequestHandlerException("Illegal response; handler could not process request [" + requestMap.uri + "] and event return [" + eventReturn + "]."); } - + if (Debug.verboseOn()) Debug.logVerbose("[Event Response Selected] type=" + nextRequestResponse.type + ", value=" + nextRequestResponse.value + ", sessionId=" + UtilHttp.getSessionId(request), module); // ========== Handle the responses - chains/views ========== - + // if the request has the save-last-view attribute set, save it now before the view can be rendered or other chain done so that the _LAST* session attributes will represent the previous request if (nextRequestResponse.saveLastView) { session.setAttribute("_SAVED_VIEW_NAME_", session.getAttribute("_LAST_VIEW_NAME_")); session.setAttribute("_SAVED_VIEW_PARAMS_", session.getAttribute("_LAST_VIEW_PARAMS_")); } - + if (nextRequestResponse != null && "request".equals(nextRequestResponse.type)) { // chained request Debug.logInfo("[RequestHandler.doRequest]: Response is a chained request." + " sessionId=" + UtilHttp.getSessionId(request), module); doRequest(request, response, nextRequestResponse.value, userLogin, delegator); - } else { + } else { // ======== handle views ======== - + // first invoke the post-processor events. for (ConfigXMLReader.Event event: controllerConfig.postprocessorEventList) { try { @@ -498,16 +498,16 @@ callRedirect(makeLink(request, response, nextRequestResponse.value), response, request); } else if ("view".equals(nextRequestResponse.type)) { if (Debug.verboseOn()) Debug.logVerbose("[RequestHandler.doRequest]: Response is a view." + " sessionId=" + UtilHttp.getSessionId(request), module); - + // check for an override view, only used if "success" = eventReturn String viewName = (UtilValidate.isNotEmpty(overrideViewUri) && (eventReturn == null || "success".equals(eventReturn))) ? overrideViewUri : nextRequestResponse.value; renderView(viewName, requestMap.securityExternalView, request, response); } else if ("view-last".equals(nextRequestResponse.type)) { if (Debug.verboseOn()) Debug.logVerbose("[RequestHandler.doRequest]: Response is a view." + " sessionId=" + UtilHttp.getSessionId(request), module); - + // check for an override view, only used if "success" = eventReturn String viewName = (UtilValidate.isNotEmpty(overrideViewUri) && (eventReturn == null || "success".equals(eventReturn))) ? overrideViewUri : nextRequestResponse.value; - + // as a further override, look for the _SAVED and then _LAST session attributes Map<String, Object> urlParams = null; if (session.getAttribute("_SAVED_VIEW_NAME_") != null) { @@ -522,7 +522,7 @@ request.setAttribute(urlParamEntry.getKey(), urlParamEntry.getValue()); } } - + renderView(viewName, requestMap.securityExternalView, request, response); } else if ("none".equals(nextRequestResponse.type)) { // no view to render (meaning the return was processed by the event) @@ -651,7 +651,7 @@ // before mapping the view, set a request attribute so we know where we are req.setAttribute("_CURRENT_VIEW_", view); - + // save the view in the session for the last view, plus the parameters Map (can use all parameters as they will never go into a URL, will only stay in the session and extra data will be ignored as we won't go to the original request just the view); note that this is saved after the request/view processing has finished so when those run they will get the value from the previous request Map<String, Object> paramMap = UtilHttp.getParameterMap(req); // add in the attributes as well so everything needed for the rendering context will be in place if/when we get back to this view @@ -664,7 +664,7 @@ if (viewMap == null) { throw new RequestHandlerException("No definition found for view with name [" + view + "]"); } - + String nextPage; if (viewMap.page == null) { @@ -776,10 +776,10 @@ return newURL.toString(); } - + /** * Creates a query string based on the redirect parameters for a request response, if specified, or for all request parameters if no redirect parameters are specified. - * + * * @param request * @param requestUri * @param eventReturnString @@ -796,12 +796,12 @@ for (Map.Entry<String, String> entry: requestResponse.redirectParameterMap.entrySet()) { String name = entry.getKey(); String from = entry.getValue(); - + Object value = request.getAttribute(from); if (value == null) { value = request.getParameter(from); } - + if (UtilValidate.isNotEmpty(value)) { if (queryString.length() > 1) { queryString.append("&"); @@ -877,7 +877,7 @@ if (requestUri != null) { requestMap = getControllerConfig().requestMapMap.get(requestUri); } - + StringBuilder newURL = new StringBuilder(); boolean didFullSecure = false; @@ -925,12 +925,12 @@ if (encode) { boolean forceManualJsessionid = "false".equals(getServletContext().getInitParameter("cookies")) ? true : false; boolean isSpider = false; - + // if the current request comes from a spider, we will not add the jsessionid to the link if (UtilHttp.checkURLforSpiders(request)) { isSpider = true; } - + // if this isn't a secure page, but we made a secure URL, make sure we manually add the jsessionid since the response.encodeURL won't do that if (!request.isSecure() && didFullSecure) { forceManualJsessionid = true; Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandlerException.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandlerException.java?rev=757075&r1=757074&r2=757075&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandlerException.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandlerException.java Sat Mar 21 23:24:37 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/AbstractJSONEventHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/AbstractJSONEventHandler.java?rev=757075&r1=757074&r2=757075&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/AbstractJSONEventHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/AbstractJSONEventHandler.java Sat Mar 21 23:24:37 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -48,14 +48,14 @@ String respCode = service.invoke(event, requestMap, request, response); // pull out the service response from the request attribute Map<String, Object> attrMap = UtilHttp.getJSONAttributeMap(request); - + // create a JSON Object for return - JSONObject json = JSONObject.fromObject(attrMap); + JSONObject json = JSONObject.fromObject(attrMap); String jsonStr = json.toString(); if (jsonStr == null) { throw new EventHandlerException("JSON Object was empty; fatal error!"); } - + // set the X-JSON content type response.setContentType("application/x-json"); // jsonStr.length is not reliable for unicode characters @@ -64,7 +64,7 @@ } catch (UnsupportedEncodingException e) { throw new EventHandlerException("Problems with Json encoding", e); } - + // return the JSON String Writer out; try { Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java?rev=757075&r1=757074&r2=757075&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java Sat Mar 21 23:24:37 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -37,8 +37,8 @@ * BsfEventHandler - BSF Event Handler */ public class BsfEventHandler implements EventHandler { - - public static final String module = BsfEventHandler.class.getName(); + + public static final String module = BsfEventHandler.class.getName(); public static UtilCache<String, String> eventCache = new UtilCache<String, String>("webapp.BsfEvents"); /** @@ -55,27 +55,27 @@ ClassLoader cl = Thread.currentThread().getContextClassLoader(); if (cl == null) cl = this.getClass().getClassLoader(); - + if (context == null) { throw new EventHandlerException("Problem getting ServletContext"); } - - try { - // create the BSF manager + + try { + // create the BSF manager BSFManager bsfManager = new BSFManager(); bsfManager.setClassLoader(cl); - + // expose the event objects to the script bsfManager.declareBean("request", request, HttpServletRequest.class); - bsfManager.declareBean("response", response, HttpServletResponse.class); - + bsfManager.declareBean("response", response, HttpServletResponse.class); + // get the script type String scriptType = BSFManager.getLangFromFilename(event.invoke); - - // load the script - InputStream scriptStream = null; - String scriptString = null; - String cacheName = null; + + // load the script + InputStream scriptStream = null; + String scriptString = null; + String cacheName = null; if (event.path == null || event.path.length() == 0) { // we are a resource to be loaded off the classpath cacheName = event.invoke; @@ -86,7 +86,7 @@ Debug.logInfo("Loading BSF Script from classpath at location: " + event.invoke, module); scriptStream = cl.getResourceAsStream(event.invoke); if (scriptStream == null) { - throw new EventHandlerException("Could not find BSF script file at classpath location: " + event.invoke); + throw new EventHandlerException("Could not find BSF script file at classpath location: " + event.invoke); } scriptString = IOUtils.getStringFromReader(new InputStreamReader(scriptStream)); eventCache.put(cacheName, scriptString); @@ -99,31 +99,31 @@ scriptString = eventCache.get(cacheName); if (scriptString == null) { synchronized(this) { - if (scriptString == null) { + if (scriptString == null) { scriptStream = context.getResourceAsStream(event.path + event.invoke); if (scriptStream == null) { - throw new EventHandlerException("Could not find BSF script file in webapp context: " + event.path + event.invoke); + throw new EventHandlerException("Could not find BSF script file in webapp context: " + event.path + event.invoke); } scriptString = IOUtils.getStringFromReader(new InputStreamReader(scriptStream)); eventCache.put(cacheName, scriptString); } } - } - } - + } + } + // execute the script Object result = bsfManager.eval(scriptType, cacheName, 0, 0, scriptString); - + // check the result if (result != null && !(result instanceof String)) { - throw new EventHandlerException("Event did not return a String result, it returned a " + result.getClass().getName()); + throw new EventHandlerException("Event did not return a String result, it returned a " + result.getClass().getName()); } - + return (String) result; - } catch (BSFException e) { + } catch (BSFException e) { throw new EventHandlerException("BSF Error", e); } catch (IOException e) { - throw new EventHandlerException("Problems reading script", e); - } + throw new EventHandlerException("Problems reading script", e); + } } } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java?rev=757075&r1=757074&r2=757075&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java Sat Mar 21 23:24:37 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -61,7 +61,7 @@ * CoreEvents - WebApp Events Related To Framework pieces */ public class CoreEvents { - + public static final String module = CoreEvents.class.getName(); public static final String err_resource = "WebappUiLabels"; @@ -205,7 +205,7 @@ //GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); Locale locale = UtilHttp.getLocale(request); TimeZone timeZone = UtilHttp.getTimeZone(request); - + Map<String, Object> params = UtilHttp.getParameterMap(request); // get the schedule parameters String jobName = (String) params.remove("JOB_NAME"); @@ -261,7 +261,7 @@ request.setAttribute("_ERROR_MESSAGE_", "<li>" + errMsg + " [" + serviceName + "]"); return "error"; } - + // make the context valid; using the makeValid method from ModelService Map<String, Object> serviceContext = FastMap.newInstance(); Iterator<String> ci = modelService.getInParamNames().iterator(); @@ -272,13 +272,13 @@ if ("userLogin".equals(name)) continue; // don't include locale, that is also taken care of below if ("locale".equals(name)) continue; - + Object value = request.getParameter(name); // if the parameter wasn't passed and no other value found, don't pass on the null if (value == null) { value = request.getAttribute(name); - } + } if (value == null) { value = request.getSession().getAttribute(name); } @@ -286,7 +286,7 @@ // still null, give up for this one continue; } - + if (value instanceof String && ((String) value).length() == 0) { // interpreting empty fields as null values for each in back end handling... value = null; @@ -294,31 +294,31 @@ // set even if null so that values will get nulled in the db later on serviceContext.put(name, value); - } + } serviceContext = modelService.makeValid(serviceContext, ModelService.IN_PARAM, true, null, timeZone, locale); - + if (userLogin != null) { - serviceContext.put("userLogin", userLogin); + serviceContext.put("userLogin", userLogin); } - + if (locale != null) { serviceContext.put("locale", locale); } - + if (!modelService.export && !security.hasPermission("SERVICE_INVOKE_ANY", request.getSession())) { String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.not_authorized_to_call", locale); request.setAttribute("_ERROR_MESSAGE_", "<li>" + errMsg); return "error"; } - + // some conversions - if (serviceTime != null && serviceTime.length() > 0) { - try { + if (serviceTime != null && serviceTime.length() > 0) { + try { Timestamp ts1 = Timestamp.valueOf(serviceTime); startTime = ts1.getTime(); } catch (IllegalArgumentException e) { - try { - startTime = Long.parseLong(serviceTime); + try { + startTime = Long.parseLong(serviceTime); } catch (NumberFormatException nfe) { String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.invalid_format_time", locale); errorBuf.append("<li>" + errMsg); @@ -329,12 +329,12 @@ errorBuf.append("<li>" + errMsg); } } - if (serviceEndTime != null && serviceEndTime.length() > 0) { - try { + if (serviceEndTime != null && serviceEndTime.length() > 0) { + try { Timestamp ts1 = Timestamp.valueOf(serviceEndTime); endTime = ts1.getTime(); } catch (IllegalArgumentException e) { - try { + try { endTime = Long.parseLong(serviceTime); } catch (NumberFormatException nfe) { String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.invalid_format_time", locale); @@ -403,7 +403,7 @@ request.setAttribute("_ERROR_MESSAGE_", errorBuf.toString()); return "error"; } - + Map<String, Object> syncServiceResult = null; // schedule service try { @@ -417,7 +417,7 @@ request.setAttribute("_ERROR_MESSAGE_", "<li>" + errMsg + e.getMessage()); return "error"; } - + String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.service_scheduled", locale); request.setAttribute("_EVENT_MESSAGE_", errMsg); if (null!=syncServiceResult) { @@ -426,7 +426,7 @@ } return "success"; } - + public static String saveServiceResultsToSession(HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); Locale locale = UtilHttp.getLocale(request); @@ -436,13 +436,13 @@ request.setAttribute("_ERROR_MESSAGE_", "<li>" + errMsg); return "error"; } - + if (null!=request.getParameter("_CLEAR_PREVIOUS_PARAMS_") && request.getParameter("_CLEAR_PREVIOUS_PARAMS_").equalsIgnoreCase("on")) session.removeAttribute("_SAVED_SYNC_RESULT_"); - + Map<String, String[]> serviceFieldsToSave = checkMap(request.getParameterMap(), String.class, String[].class); Map<String, Object> savedFields = FastMap.newInstance(); - + for (String key: serviceFieldsToSave.keySet()) { if (null!=serviceFieldsToSave.get(key) && request.getParameter(key).equalsIgnoreCase("on") && !key.equals("_CLEAR_PREVIOUS_PARAMS_")) { String[] servicePath = key.split("\\|\\|"); @@ -453,12 +453,12 @@ if (null!=session.getAttribute("_SAVED_SYNC_RESULT_")) { Map<String, Object> savedSyncResult = checkMap(session.getAttribute("_SAVED_SYNC_RESULT_"), String.class, Object.class); savedSyncResult.putAll(savedFields); - savedFields = savedSyncResult; + savedFields = savedSyncResult; } session.setAttribute("_SAVED_SYNC_RESULT_", savedFields); return "success"; } - + //Tries to return a map, if Object is one of Map, GenericEntity, List public static Object getObjectFromServicePath(String servicePath, Map<String, ? extends Object> serviceResult) { String[] sp = servicePath.split("\\|\\|"); @@ -472,7 +472,7 @@ servicePathObject = servicePathMap.get(servicePathEntry); } servicePathMap = null; - + if (servicePathObject instanceof Map) { servicePathMap = checkMap(servicePathObject); }else if (servicePathObject instanceof GenericEntity) { @@ -510,11 +510,11 @@ * @return Response code string */ public static String runService(HttpServletRequest request, HttpServletResponse response) { - // get the mode and service name + // get the mode and service name String serviceName = request.getParameter("serviceName"); String mode = request.getParameter("mode"); Locale locale = UtilHttp.getLocale(request); - + if (UtilValidate.isEmpty(serviceName)) { String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.must_specify_service_name", locale); request.setAttribute("_ERROR_MESSAGE_", "<li>" + errMsg); @@ -524,12 +524,12 @@ if (UtilValidate.isEmpty(mode)) { mode = "sync"; } - + // now do a security check - + Security security = (Security) request.getAttribute("security"); LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - + //lookup the service definition to see if this service is externally available, if not require the SERVICE_INVOKE_ANY permission ModelService modelService = null; try { @@ -551,35 +551,35 @@ request.setAttribute("_ERROR_MESSAGE_", "<li>" + errMsg + "."); return "error"; } - + Debug.logInfo("Running service named [" + serviceName + "] from event with mode [" + mode + "]", module); - - // call the service via the ServiceEventHandler which + + // call the service via the ServiceEventHandler which // adapts an event to a service. Event event = new Event("service", mode, serviceName, false); try { return seh.invoke(event, null, request, response); } catch (EventHandlerException e) { - String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.service_eventhandler_exception", locale); + String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.service_eventhandler_exception", locale); request.setAttribute("_ERROR_MESSAGE_", "<li>" + errMsg + ": " + e.getMessage()); return "error"; } } - + public static String streamFile(HttpServletRequest request, HttpServletResponse response) { //RequestHandler rh = (RequestHandler) request.getAttribute("_REQUEST_HANDLER_"); String filePath = RequestHandler.getOverrideViewUri(request.getPathInfo()); //String fileName = filePath.substring(filePath.lastIndexOf("/")+1); - + // load the file File file = new File(filePath); if (file.exists()) { Long longLen = Long.valueOf(file.length()); int length = longLen.intValue(); try { - FileInputStream fis = new FileInputStream(file); + FileInputStream fis = new FileInputStream(file); UtilHttp.streamContentToBrowser(response, fis, length, null); - fis.close(); + fis.close(); } catch (FileNotFoundException e) { Debug.logError(e, module); return "error"; @@ -587,7 +587,7 @@ Debug.logError(e, module); return "error"; } - } + } return null; } } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/DojoJSONServiceEventHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/DojoJSONServiceEventHandler.java?rev=757075&r1=757074&r2=757075&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/DojoJSONServiceEventHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/DojoJSONServiceEventHandler.java Sat Mar 21 23:24:37 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -44,7 +44,7 @@ /** * DojoJSONServiceEventHandler - JSON Object Wrapper around the ServiceEventHandler - * + * * This handles two issues with the Dojo version of JSON. Actually, it may only applies when a form is used to upload a file. * Dojo expects the json response to be wrapped in html like this: * <html><head></head><body><textarea style="width: 100%%; height: 100px;">{name: value, name2: value2}</textarea></body></html> |
Free forum by Nabble | Edit this page |