svn commit: r1700119 [9/26] - in /ofbiz/trunk: ./ runtime/indexes/ specialpurpose/ specialpurpose/solr/ specialpurpose/solr/conf/ specialpurpose/solr/config/ specialpurpose/solr/entitydef/ specialpurpose/solr/lib/ specialpurpose/solr/lib/compile/ speci...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1700119 [9/26] - in /ofbiz/trunk: ./ runtime/indexes/ specialpurpose/ specialpurpose/solr/ specialpurpose/solr/conf/ specialpurpose/solr/config/ specialpurpose/solr/entitydef/ specialpurpose/solr/lib/ specialpurpose/solr/lib/compile/ speci...

shijh
Added: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/SolrUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/SolrUtil.java?rev=1700119&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/SolrUtil.java (added)
+++ ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/SolrUtil.java Sun Aug 30 13:27:07 2015
@@ -0,0 +1,243 @@
+/*******************************************************************************
+ * 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.solr;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javolution.util.FastMap;
+
+import org.apache.solr.client.solrj.SolrQuery;
+import org.apache.solr.client.solrj.SolrRequest.METHOD;
+import org.apache.solr.client.solrj.impl.HttpSolrServer;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.common.SolrInputDocument;
+import org.ofbiz.base.component.ComponentConfig;
+import org.ofbiz.base.component.ComponentConfig.WebappInfo;
+import org.ofbiz.base.component.ComponentException;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilGenerics;
+import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.GenericEntityException;
+
+/**
+ * Solr utility class.
+ */
+public abstract class SolrUtil {
+    
+    public static final String module = SolrUtil.class.getName();
+    private static String[] solrProdAttribute = { "productId", "internalName", "manu", "size", "smallImage", "mediumImage", "largeImage", "listPrice", "defaultPrice", "inStock", "isVirtual" };
+
+    public static final String solrConfigName = "solrconfig.properties";
+    public static final String solrUrl = makeSolrWebappUrl();
+    
+    public static String makeSolrWebappUrl() {
+        final String solrWebappProtocol = UtilProperties.getPropertyValue(solrConfigName, "solr.webapp.protocol");
+        final String solrWebappDomainName = UtilProperties.getPropertyValue(solrConfigName, "solr.webapp.domainName");
+        final String solrWebappPath = UtilProperties.getPropertyValue(solrConfigName, "solr.webapp.path");
+        final String solrWebappPortOverride = UtilProperties.getPropertyValue(solrConfigName, "solr.webapp.portOverride");
+        
+        String solrPort;
+        if (UtilValidate.isNotEmpty(solrWebappPortOverride)) {
+            solrPort = solrWebappPortOverride;
+        }
+        else {
+            solrPort = UtilProperties.getPropertyValue("url.properties", ("https".equals(solrWebappProtocol) ? "port.https" : "port.http"));
+        }
+        
+        return solrWebappProtocol + "://" + solrWebappDomainName + ":" + solrPort + solrWebappPath;
+    }
+    
+    public static boolean isSolrEcaEnabled() {
+        Boolean ecaEnabled = null;
+        String sysProp = System.getProperty("ofbiz.solr.eca.enabled");
+        if (UtilValidate.isNotEmpty(sysProp)) {
+            if ("true".equalsIgnoreCase(sysProp))  {
+                ecaEnabled = Boolean.TRUE;
+            }
+            else if ("false".equalsIgnoreCase(sysProp)) {
+                ecaEnabled = Boolean.FALSE;
+            }
+        }
+        if (ecaEnabled == null) {
+            ecaEnabled = UtilProperties.getPropertyAsBoolean(SolrUtil.solrConfigName, "solr.eca.enabled", false);
+        }
+        return Boolean.TRUE.equals(ecaEnabled);
+    }
+    
+    public static WebappInfo getSolrWebappInfo() {
+        WebappInfo solrApp = null;
+        try {
+            ComponentConfig cc = ComponentConfig.getComponentConfig("solr");
+            for(WebappInfo currApp : cc.getWebappInfos()) {
+                if ("solr".equals(currApp.getName())) {
+                    solrApp = currApp;
+                    break;
+                }
+            }
+        }
+        catch(ComponentException e) {
+            throw new IllegalStateException(e);
+        }
+        return solrApp;
+    }
+    
+    public static boolean isEcaTreatConnectErrorNonFatal() {
+        Boolean treatConnectErrorNonFatal = UtilProperties.getPropertyAsBoolean(solrConfigName, "solr.eca.treatConnectErrorNonFatal", true);
+        return Boolean.TRUE.equals(treatConnectErrorNonFatal);
+    }
+    
+    
+    public static SolrInputDocument generateSolrDocument(Map<String, Object> context) throws GenericEntityException {
+        SolrInputDocument doc1 = new SolrInputDocument();
+
+        // add defined attributes
+        for (int i = 0; i < solrProdAttribute.length; i++) {
+            if (context.get(solrProdAttribute[i]) != null) {
+                doc1.addField(solrProdAttribute[i], context.get(solrProdAttribute[i]).toString());
+            }
+        }
+
+        // add catalog
+        if (context.get("catalog") != null) {
+            List<String> catalog = UtilGenerics.<String>checkList(context.get("catalog"));
+            for (String c : catalog) {
+                doc1.addField("catalog", c);
+            }
+        }
+
+        // add categories
+        if (context.get("category") != null) {
+            List<String> category = UtilGenerics.<String>checkList(context.get("category"));
+            Iterator<String> catIter = category.iterator();
+            while (catIter.hasNext()) {
+                /*
+                 * GenericValue cat = (GenericValue) catIter.next(); GenericValue prodCategory = cat.getRelatedOneCache("ProductCategory"); if (prodCategory.get("description") != null) {
+                 * doc1.addField("category", prodCategory.get("description")); } doc1.addField("cat", prodCategory.get("productCategoryId"));
+                 */
+                String cat = (String) catIter.next();
+                doc1.addField("cat", cat);
+            }
+        }
+
+        // add features
+        if (context.get("features") != null) {
+            Set<String> features = UtilGenerics.<String>checkSet(context.get("features"));
+            Iterator<String> featIter = features.iterator();
+            while (featIter.hasNext()) {
+                String feat = featIter.next();
+                doc1.addField("features", feat);
+            }
+        }
+
+        // add attributes
+        if (context.get("attributes") != null) {
+            List<String> attributes = UtilGenerics.<String>checkList(context.get("attributes"));
+            Iterator<String> attrIter = attributes.iterator();
+            while (attrIter.hasNext()) {
+                String attr = attrIter.next();
+                doc1.addField("attributes", attr);
+            }
+        }
+
+        // add title
+        if (context.get("title") != null) {
+            Map<String, String> title = UtilGenerics.<String, String>checkMap(context.get("title"));
+            for (Map.Entry<String, String> entry : title.entrySet()) {
+                doc1.addField("title_i18n_" + entry.getKey(), entry.getValue());
+            }
+        }
+
+        // add short_description
+        if (context.get("description") != null) {
+            Map<String, String> description = UtilGenerics.<String, String>checkMap(context.get("description"));
+            for (Map.Entry<String, String> entry : description.entrySet()) {
+                doc1.addField("description_i18n_" + entry.getKey(), entry.getValue());
+            }
+        }
+
+        // add short_description
+        if (context.get("longDescription") != null) {
+            Map<String, String> longDescription = UtilGenerics.<String, String>checkMap(context.get("longDescription"));
+            for (Map.Entry<String, String> entry : longDescription.entrySet()) {
+                doc1.addField("longdescription_i18n_" + entry.getKey(), entry.getValue());
+            }
+        }
+
+        return doc1;
+    }
+    
+    public static Map<String, Object> categoriesAvailable(String catalogId, String categoryId, String productId, boolean displayproducts, int viewIndex, int viewSize) {
+        return categoriesAvailable(catalogId,categoryId,productId,null,displayproducts,viewIndex,viewSize);
+    }
+
+    public static Map<String, Object> categoriesAvailable(String catalogId, String categoryId, String productId, String facetPrefix, boolean displayproducts, int viewIndex, int viewSize) {
+        // create the data model
+        Map<String, Object> result = FastMap.newInstance();
+        HttpSolrServer server = null;
+        QueryResponse returnMap = new QueryResponse();
+        try {
+            // do the basic query
+            server = new HttpSolrServer(solrUrl);
+            // create Query Object
+            String query = "inStock[1 TO *]";
+            if (categoryId != null)
+                query += " +cat:"+ categoryId;
+            else if (productId != null)
+                query += " +productId:" + productId;
+            SolrQuery solrQuery = new SolrQuery();
+            solrQuery.setQuery(query);
+
+            if (catalogId != null)
+                solrQuery.setFilterQueries("catalog:" + catalogId);
+            if (displayproducts) {
+                if (viewSize > -1) {
+                    solrQuery.setRows(viewSize);
+                } else
+                    solrQuery.setRows(50000);
+                if (viewIndex > -1) {
+                    solrQuery.setStart(viewIndex);
+                }
+            } else {
+                solrQuery.setFields("cat");
+                solrQuery.setRows(0);
+            }
+            
+            if(UtilValidate.isNotEmpty(facetPrefix)){
+                solrQuery.setFacetPrefix(facetPrefix);
+            }
+            
+            solrQuery.setFacetMinCount(0);
+            solrQuery.setFacet(true);
+            solrQuery.addFacetField("cat");
+            solrQuery.setFacetLimit(-1);
+            Debug.logVerbose("solr: solrQuery: " + solrQuery, module);
+            returnMap = server.query(solrQuery, METHOD.POST);
+            result.put("rows", returnMap);
+            result.put("numFound", returnMap.getResults().getNumFound());
+        } catch (Exception e) {
+            Debug.logError(e.getMessage(), module);
+        }
+        return result;
+    }
+
+}
\ No newline at end of file

Propchange: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/SolrUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/SolrUtil.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/SolrUtil.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/control/OFBizSolrLoginWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/control/OFBizSolrLoginWorker.java?rev=1700119&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/control/OFBizSolrLoginWorker.java (added)
+++ ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/control/OFBizSolrLoginWorker.java Sun Aug 30 13:27:07 2015
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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.solr.control;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.webapp.control.LoginWorker;
+
+/**
+ * OFBiz Solr Login Workers
+ */
+public class OFBizSolrLoginWorker extends LoginWorker {
+
+    public final static String module = OFBizSolrLoginWorker.class.getName();
+
+    /**
+     * An HTTP WebEvent handler that logs in a userLogin. This should run before the security check.
+     *
+     * @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 Return a boolean which specifies whether or not the calling Servlet or
+     *         JSP should generate its own content. This allows an event to override the default content.
+     */
+    public static String login(HttpServletRequest request, HttpServletResponse response) {
+     String result = LoginWorker.login(request, response);
+     if (result.equals("success")) {
+            // send the redirect
+            try {            
+                response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
+                response.setHeader("Location", request.getContextPath());
+                response.setHeader("Connection", "close");
+            } catch (IllegalStateException ise) {
+                Debug.logError(ise.getMessage(), module);
+                return "error";
+            }
+     }
+     return result;
+    }
+
+    public static String extensionCheckLogin(HttpServletRequest request, HttpServletResponse response) {
+     String result = LoginWorker.extensionCheckLogin(request, response);
+     if (result.equals("success")) {
+            // send the redirect
+            try {            
+                response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
+                response.setHeader("Location", request.getContextPath());
+                response.setHeader("Connection", "close");
+            } catch (IllegalStateException ise) {
+                Debug.logError(ise.getMessage(), module);
+                return "error";
+            }
+     }
+        return result;
+    }
+}

Propchange: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/control/OFBizSolrLoginWorker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/control/OFBizSolrLoginWorker.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/control/OFBizSolrLoginWorker.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java?rev=1700119&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java (added)
+++ ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java Sun Aug 30 13:27:07 2015
@@ -0,0 +1,515 @@
+/*******************************************************************************
+ * 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.solr.webapp;
+
+import static org.ofbiz.base.util.UtilGenerics.checkMap;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.solr.core.ConfigSolr;
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.core.SolrResourceLoader;
+import org.apache.solr.servlet.SolrDispatchFilter;
+import org.ofbiz.base.conversion.ConversionException;
+import org.ofbiz.base.conversion.JSONConverters.MapToJSON;
+import org.ofbiz.base.lang.JSON;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.StringUtil;
+import org.ofbiz.base.util.UtilGenerics;
+import org.ofbiz.base.util.UtilHttp;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilObject;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.DelegatorFactory;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
+import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.security.Security;
+import org.ofbiz.security.SecurityConfigurationException;
+import org.ofbiz.security.SecurityFactory;
+import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ServiceContainer;
+import org.ofbiz.webapp.control.LoginWorker;
+import org.ofbiz.webapp.event.RequestBodyMapHandlerFactory;
+import org.ofbiz.webapp.website.WebSiteWorker;
+
+/**
+ * ContextFilter - Restricts access to raw files and configures servlet objects.
+ */
+public class OFBizSolrContextFilter extends SolrDispatchFilter {
+
+    public static final String module = OFBizSolrContextFilter.class.getName();
+    public static final String FORWARDED_FROM_SERVLET = "_FORWARDED_FROM_SERVLET_";
+
+    protected FilterConfig config = null;
+    protected boolean debug = false;
+    
+    /**
+     * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
+     */
+    public void init(FilterConfig config) throws ServletException {
+     super.init(config);
+        this.config = config;
+
+        // puts all init-parameters in ServletContext attributes for easier parameterization without code changes
+        this.putAllInitParametersInAttributes();
+
+        // set debug
+        this.debug = "true".equalsIgnoreCase(config.getInitParameter("debug"));
+        if (!debug) {
+            debug = Debug.verboseOn();
+        }
+
+        // check the serverId
+        getServerId();
+        // initialize the delegator
+        getDelegator(config.getServletContext());
+        // initialize security
+        getSecurity();
+        // initialize the services dispatcher
+        getDispatcher(config.getServletContext());
+
+        // this will speed up the initial sessionId generation
+        new java.security.SecureRandom().nextLong();
+    }
+
+    /**
+     * @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 httpRequest = (HttpServletRequest) request;
+        HttpServletResponse httpResponse = (HttpServletResponse) response;
+        
+        // set the ServletContext in the request for future use
+        httpRequest.setAttribute("servletContext", config.getServletContext());
+
+        // set the webSiteId in the session
+        if (UtilValidate.isEmpty(httpRequest.getSession().getAttribute("webSiteId"))){
+            httpRequest.getSession().setAttribute("webSiteId", WebSiteWorker.getWebSiteId(httpRequest));
+        }
+
+        // set the filesystem path of context root.
+        httpRequest.setAttribute("_CONTEXT_ROOT_", config.getServletContext().getRealPath("/"));
+
+        // set the server root url
+        httpRequest.setAttribute("_SERVER_ROOT_URL_", UtilHttp.getServerRootUrl(httpRequest));
+
+        // request attributes from redirect call
+        String reqAttrMapHex = (String) httpRequest.getSession().getAttribute("_REQ_ATTR_MAP_");
+        if (UtilValidate.isNotEmpty(reqAttrMapHex)) {
+            byte[] reqAttrMapBytes = StringUtil.fromHexString(reqAttrMapHex);
+            Map<String, Object> reqAttrMap = checkMap(UtilObject.getObject(reqAttrMapBytes), String.class, Object.class);
+            if (reqAttrMap != null) {
+                for (Map.Entry<String, Object> entry: reqAttrMap.entrySet()) {
+                    httpRequest.setAttribute(entry.getKey(), entry.getValue());
+                }
+            }
+            httpRequest.getSession().removeAttribute("_REQ_ATTR_MAP_");
+        }
+
+        // ----- Context Security -----
+        // check if we are disabled
+        String disableSecurity = config.getInitParameter("disableContextSecurity");
+        if (disableSecurity != null && "Y".equalsIgnoreCase(disableSecurity)) {
+            chain.doFilter(httpRequest, httpResponse);
+            return;
+        }
+
+        // check if we are told to redirect everthing
+        String redirectAllTo = config.getInitParameter("forceRedirectAll");
+        if (UtilValidate.isNotEmpty(redirectAllTo)) {
+            // little trick here so we don't loop on ourself
+            if (httpRequest.getSession().getAttribute("_FORCE_REDIRECT_") == null) {
+                httpRequest.getSession().setAttribute("_FORCE_REDIRECT_", "true");
+                Debug.logWarning("Redirecting user to: " + redirectAllTo, module);
+
+                if (!redirectAllTo.toLowerCase().startsWith("http")) {
+                    redirectAllTo = httpRequest.getContextPath() + redirectAllTo;
+                }
+                httpResponse.sendRedirect(redirectAllTo);
+                return;
+            } else {
+                httpRequest.getSession().removeAttribute("_FORCE_REDIRECT_");
+                chain.doFilter(httpRequest, httpResponse);
+                return;
+            }
+        }
+
+     String servletPath = httpRequest.getServletPath();
+        if (UtilValidate.isNotEmpty(servletPath) && servletPath.equals("/control")) {
+         doControlFilter(request, response, chain);
+            // we're done checking; continue on
+            chain.doFilter(request, response);
+        } else {
+         // check if the request is from an authorized user
+         if (UtilValidate.isNotEmpty(servletPath) && servletPath.startsWith("/admin/")) {
+                HttpSession session = httpRequest.getSession();
+                GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
+                Security security = (Security) request.getAttribute("security");
+                if (security == null) {
+                 security = (Security) httpRequest.getServletContext().getAttribute("security");
+                 if (security != null) {
+                        request.setAttribute("security", security);
+                 }
+                }
+                if (security == null) {
+                 security = getSecurity();
+                 if (security != null) {
+                        request.setAttribute("security", security);
+                 }
+                }
+                if (UtilValidate.isEmpty(userLogin) || !LoginWorker.hasBasePermission(userLogin, httpRequest)) {
+                 response.setContentType("application/x-json");
+                 MapToJSON mapToJson = new MapToJSON();
+                 JSON json;
+ try {
+ json = mapToJson.convert(UtilMisc.toMap("ofbizLogin", (Object) "true"));
+                 OutputStream os = response.getOutputStream();
+                 os.write(json.toString().getBytes());
+                 os.flush();
+ } catch (ConversionException e) {
+ Debug.logError("Error while converting ofbizLogin map to JSON.", module);
+ }
+                 return;
+                }
+         }
+         // NOTE: there's a chain.doFilter in SolrDispatchFilter's doFilter
+         super.doFilter(request, response, chain);
+        }
+    }
+
+    private void doControlFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+        HttpServletRequest httpRequest = (HttpServletRequest) request;
+        HttpServletResponse httpResponse = (HttpServletResponse) response;
+        
+        // test to see if we have come through the control servlet already, if not do the processing
+        String requestPath = null;
+        String contextUri = null;
+        if (httpRequest.getAttribute(FORWARDED_FROM_SERVLET) == null) {
+            // Debug.logInfo("In ContextFilter.doFilter, FORWARDED_FROM_SERVLET is NOT set", module);
+            String allowedPath = config.getInitParameter("allowedPaths");
+            String redirectPath = config.getInitParameter("redirectPath");
+            String errorCode = config.getInitParameter("errorCode");
+
+            List<String> allowList = null;
+            if ((allowList = StringUtil.split(allowedPath, ":")) != null) {
+                allowList.add("/");  // No path is allowed.
+                allowList.add("");   // No path is allowed.
+            }
+
+            if (debug) Debug.logInfo("[Domain]: " + httpRequest.getServerName() + " [Request]: " + httpRequest.getRequestURI(), module);
+
+            requestPath = httpRequest.getServletPath();
+            if (requestPath == null) requestPath = "";
+            if (requestPath.lastIndexOf("/") > 0) {
+                if (requestPath.indexOf("/") == 0) {
+                    requestPath = "/" + requestPath.substring(1, requestPath.indexOf("/", 1));
+                } else {
+                    requestPath = requestPath.substring(1, requestPath.indexOf("/"));
+                }
+            }
+
+            String requestInfo = httpRequest.getServletPath();
+            if (requestInfo == null) requestInfo = "";
+            if (requestInfo.lastIndexOf("/") >= 0) {
+                requestInfo = requestInfo.substring(0, requestInfo.lastIndexOf("/")) + "/*";
+            }
+
+            StringBuilder contextUriBuffer = new StringBuilder();
+            if (httpRequest.getContextPath() != null) {
+                contextUriBuffer.append(httpRequest.getContextPath());
+            }
+            if (httpRequest.getServletPath() != null) {
+                contextUriBuffer.append(httpRequest.getServletPath());
+            }
+            if (httpRequest.getPathInfo() != null) {
+                contextUriBuffer.append(httpRequest.getPathInfo());
+            }
+            contextUri = contextUriBuffer.toString();
+
+            // Verbose Debugging
+            if (Debug.verboseOn()) {
+                if (allowList != null) {
+                    for (String allow: allowList) {
+                        Debug.logVerbose("[Allow]: " + allow, module);
+                    }
+                }
+                Debug.logVerbose("[Request path]: " + requestPath, module);
+                Debug.logVerbose("[Request info]: " + requestInfo, module);
+                Debug.logVerbose("[Servlet path]: " + httpRequest.getServletPath(), module);
+            }
+
+            // check to make sure the requested url is allowed
+            if (allowList != null &&
+                (!allowList.contains(requestPath) && !allowList.contains(requestInfo) && !allowList.contains(httpRequest.getServletPath()))
+                ) {
+                String filterMessage = "[Filtered request]: " + contextUri;
+                
+                if (redirectPath == null) {
+                    int error = 404;
+                    if (UtilValidate.isNotEmpty(errorCode)) {
+                        try {
+                            error = Integer.parseInt(errorCode);
+                        } catch (NumberFormatException nfe) {
+                            Debug.logWarning(nfe, "Error code specified would not parse to Integer : " + errorCode, module);
+                        }
+                    }
+                    filterMessage = filterMessage + " (" + error + ")";
+                    httpResponse.sendError(error, contextUri);
+                    request.setAttribute("filterRequestUriError", contextUri);
+                } else {
+                    filterMessage = filterMessage + " (" + redirectPath + ")";
+                    if (!redirectPath.toLowerCase().startsWith("http")) {
+                        redirectPath = httpRequest.getContextPath() + redirectPath;
+                    }
+                    httpResponse.sendRedirect(redirectPath);
+                }
+                Debug.logWarning(filterMessage, module);
+                return;
+            }
+        }
+
+        setCharacterEncoding(httpRequest);
+        setAttributesFromRequestBody(httpRequest);
+        // check if multi tenant is enabled
+        boolean useMultitenant = EntityUtil.isMultiTenantEnabled();
+        if (useMultitenant) {
+            // get tenant delegator by domain name
+            String serverName = httpRequest.getServerName();
+            try {
+            
+                // if tenant was specified, replace delegator with the new per-tenant delegator and set tenantId to session attribute
+                Delegator delegator = getDelegator(config.getServletContext());
+
+                //Use base delegator for fetching data from entity of entityGroup org.ofbiz.tenant
+                Delegator baseDelegator = DelegatorFactory.getDelegator(delegator.getDelegatorBaseName());
+                GenericValue tenantDomainName = EntityQuery.use(baseDelegator).from("TenantDomainName").where("domainName", serverName).queryOne();
+                String tenantId = null;
+                if(UtilValidate.isNotEmpty(tenantDomainName)) {
+                    tenantId = tenantDomainName.getString("tenantId");
+                }
+                
+                if(UtilValidate.isEmpty(tenantId)) {
+                    tenantId = (String) httpRequest.getAttribute("userTenantId");
+                }
+                if(UtilValidate.isEmpty(tenantId)) {
+                    tenantId = (String) httpRequest.getParameter("userTenantId");
+                }
+                if (UtilValidate.isNotEmpty(tenantId)) {
+                    // if the request path is a root mount then redirect to the initial path
+                    if (UtilValidate.isNotEmpty(requestPath) && requestPath.equals(contextUri)) {
+                        GenericValue tenant = EntityQuery.use(baseDelegator).from("Tenant").where("tenantId", tenantId).queryOne();
+                        String initialPath = tenant.getString("initialPath");
+                        if (UtilValidate.isNotEmpty(initialPath) && !"/".equals(initialPath)) {
+                            ((HttpServletResponse)response).sendRedirect(initialPath);
+                            return;
+                        }
+                    }
+
+                    // make that tenant active, setup a new delegator and a new dispatcher
+                    String tenantDelegatorName = delegator.getDelegatorBaseName() + "#" + tenantId;
+                    httpRequest.getSession().setAttribute("delegatorName", tenantDelegatorName);
+
+                    // after this line the delegator is replaced with the new per-tenant delegator
+                    delegator = DelegatorFactory.getDelegator(tenantDelegatorName);
+                    config.getServletContext().setAttribute("delegator", delegator);
+
+                    // clear web context objects
+                    config.getServletContext().setAttribute("security", null);
+                    config.getServletContext().setAttribute("dispatcher", null);
+
+                    // initialize security
+                    Security security = getSecurity();
+                    // initialize the services dispatcher
+                    LocalDispatcher dispatcher = getDispatcher(config.getServletContext());
+
+                    // set web context objects
+                    request.setAttribute("dispatcher", dispatcher);
+                    request.setAttribute("security", security);
+                    
+                    request.setAttribute("userTenantId", tenantId);
+                }
+
+                // NOTE DEJ20101130: do NOT always put the delegator name in the user's session because the user may
+                // have logged in and specified a tenant, and even if no Tenant record with a matching domainName field
+                // is found this will change the user's delegator back to the base one instead of the one for the
+                // tenant specified on login
+                // httpRequest.getSession().setAttribute("delegatorName", delegator.getDelegatorName());
+            } catch (GenericEntityException e) {
+                Debug.logWarning(e, "Unable to get Tenant", module);
+            }
+        }
+ }
+
+ /**
+     * @see javax.servlet.Filter#destroy()
+     */
+    public void destroy() {
+        super.destroy();
+        getDispatcher(config.getServletContext()).deregister();
+        config = null;
+    }
+
+    protected static LocalDispatcher getDispatcher(ServletContext servletContext) {
+        LocalDispatcher dispatcher = (LocalDispatcher) servletContext.getAttribute("dispatcher");
+        if (dispatcher == null) {
+            Delegator delegator = getDelegator(servletContext);
+            dispatcher = makeWebappDispatcher(servletContext, delegator);
+            servletContext.setAttribute("dispatcher", dispatcher);
+        }
+        return dispatcher;
+    }
+
+    public static void setCharacterEncoding(ServletRequest request) throws UnsupportedEncodingException {
+        String charset = request.getServletContext().getInitParameter("charset");
+        if (UtilValidate.isEmpty(charset)) charset = request.getCharacterEncoding();
+        if (UtilValidate.isEmpty(charset)) charset = "UTF-8";
+        if (Debug.verboseOn()) Debug.logVerbose("The character encoding of the request is: [" + request.getCharacterEncoding() + "]. The character encoding we will use for the request is: [" + charset + "]", module);
+
+        if (!"none".equals(charset)) {
+            request.setCharacterEncoding(charset);
+        }
+    }
+
+    public static void setAttributesFromRequestBody(ServletRequest request) {
+        // read the body (for JSON requests) and set the parameters as attributes:
+        Map<String, Object> requestBodyMap = null;
+        try {
+            requestBodyMap = RequestBodyMapHandlerFactory.extractMapFromRequestBody(request);
+        } catch (IOException ioe) {
+            Debug.logWarning(ioe, module);
+        }
+        if (requestBodyMap != null) {
+            Set<String> parameterNames = requestBodyMap.keySet();
+            for (String parameterName: parameterNames) {
+                request.setAttribute(parameterName, requestBodyMap.get(parameterName));
+            }
+        }
+    }
+
+    /** This method only sets up a dispatcher for the current webapp and passed in delegator, it does not save it to the ServletContext or anywhere else, just returns it */
+    public static LocalDispatcher makeWebappDispatcher(ServletContext servletContext, Delegator delegator) {
+        if (delegator == null) {
+            Debug.logError("[ContextFilter.init] ERROR: delegator not defined.", module);
+            return null;
+        }
+        // get the unique name of this dispatcher
+        String dispatcherName = servletContext.getInitParameter("localDispatcherName");
+
+        if (dispatcherName == null) {
+            Debug.logError("No localDispatcherName specified in the web.xml file", module);
+            dispatcherName = delegator.getDelegatorName();
+        }
+
+        LocalDispatcher dispatcher = ServiceContainer.getLocalDispatcher(dispatcherName, delegator);
+        if (dispatcher == null) {
+            Debug.logError("[ContextFilter.init] ERROR: dispatcher could not be initialized.", module);
+        }
+
+        return dispatcher;
+    }
+
+    protected static Delegator getDelegator(ServletContext servletContext) {
+        Delegator delegator = (Delegator) servletContext.getAttribute("delegator");
+        if (delegator == null) {
+            String delegatorName = servletContext.getInitParameter("entityDelegatorName");
+
+            if (delegatorName == null || delegatorName.length() <= 0) {
+                delegatorName = "default";
+            }
+            if (Debug.verboseOn()) Debug.logVerbose("Setup Entity Engine Delegator with name " + delegatorName, module);
+            delegator = DelegatorFactory.getDelegator(delegatorName);
+            servletContext.setAttribute("delegator", delegator);
+            if (delegator == null) {
+                Debug.logError("[ContextFilter.init] ERROR: delegator factory returned null for delegatorName \"" + delegatorName + "\"", module);
+            }
+        }
+        return delegator;
+    }
+
+    protected Security getSecurity() {
+        Security security = (Security) config.getServletContext().getAttribute("security");
+        if (security == null) {
+            Delegator delegator = (Delegator) config.getServletContext().getAttribute("delegator");
+
+            if (delegator != null) {
+                try {
+                    security = SecurityFactory.getInstance(delegator);
+                } catch (SecurityConfigurationException e) {
+                    Debug.logError(e, "Unable to obtain an instance of the security object.", module);
+                }
+            }
+            config.getServletContext().setAttribute("security", security);
+            if (security == null) {
+                Debug.logError("An invalid (null) Security object has been set in the servlet context.", module);
+            }
+        }
+        return security;
+    }
+
+    protected void putAllInitParametersInAttributes() {
+        Enumeration<String> initParamEnum = UtilGenerics.cast(config.getServletContext().getInitParameterNames());
+        while (initParamEnum.hasMoreElements()) {
+            String initParamName = initParamEnum.nextElement();
+            String initParamValue = config.getServletContext().getInitParameter(initParamName);
+            if (Debug.verboseOn()) Debug.logVerbose("Adding web.xml context-param to application attribute with name [" + initParamName + "] and value [" + initParamValue + "]", module);
+            config.getServletContext().setAttribute(initParamName, initParamValue);
+        }
+    }
+
+    protected String getServerId() {
+        String serverId = (String) config.getServletContext().getAttribute("_serverId");
+        if (serverId == null) {
+            serverId = config.getServletContext().getInitParameter("ofbizServerName");
+            config.getServletContext().setAttribute("_serverId", serverId);
+        }
+        return serverId;
+    }
+
+    /**
+     * Override this to change CoreContainer initialization
+     * @return a CoreContainer to hold this server's cores
+     */
+    protected CoreContainer createCoreContainer() {
+        SolrResourceLoader loader = new SolrResourceLoader("specialpurpose/solr/conf");
+        ConfigSolr config = ConfigSolr.fromSolrHome(loader, loader.getInstanceDir());
+        CoreContainer cores = new CoreContainer(loader, config);
+        cores.load();
+        return cores;
+    }
+}
+

Propchange: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrLoadAdminUiServlet.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrLoadAdminUiServlet.java?rev=1700119&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrLoadAdminUiServlet.java (added)
+++ ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrLoadAdminUiServlet.java Sun Aug 30 13:27:07 2015
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * 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.solr.webapp;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.nio.charset.StandardCharsets;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.core.SolrCore;
+
+/**
+ * A simple servlet to load the Solr Admin UI
+ *
+ */
+public class OFBizSolrLoadAdminUiServlet extends OFBizSolrRedirectServlet {
+
+    private static final long serialVersionUID = 1L;
+    public static final String module = OFBizSolrLoadAdminUiServlet.class.getName();
+
+    @Override
+    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
+     boolean isForwarded = forwardUrl(request, response);
+     if (isForwarded) {
+     return;
+     }
+    
+        // This attribute is set by the SolrDispatchFilter
+        CoreContainer cores = (CoreContainer) request.getAttribute("org.apache.solr.CoreContainer");
+
+        InputStream in = getServletContext().getResourceAsStream("/admin.html");
+        if (in != null && cores != null) {
+            try {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("text/html");
+                Writer out = new OutputStreamWriter(response.getOutputStream(), StandardCharsets.UTF_8);
+
+                String html = IOUtils.toString(in, "UTF-8");
+                Package pack = SolrCore.class.getPackage();
+
+                String[] search = new String[] { "${contextPath}", "${adminPath}", "${version}" };
+                String[] replace = new String[] {
+                        StringEscapeUtils.escapeJavaScript(request.getContextPath()),
+                        StringEscapeUtils.escapeJavaScript(cores.getAdminPath()),
+                        StringEscapeUtils.escapeJavaScript(pack.getSpecificationVersion()) };
+
+                out.write(StringUtils.replaceEach(html, search, replace));
+                out.flush();
+            } finally {
+                IOUtils.closeQuietly(in);
+            }
+        } else {
+            response.sendError(404);
+        }
+    }
+
+}

Propchange: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrLoadAdminUiServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrLoadAdminUiServlet.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrLoadAdminUiServlet.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrRedirectServlet.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrRedirectServlet.java?rev=1700119&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrRedirectServlet.java (added)
+++ ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrRedirectServlet.java Sun Aug 30 13:27:07 2015
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * 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.solr.webapp;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.solr.servlet.RedirectServlet;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.webapp.OfbizUrlBuilder;
+import org.ofbiz.webapp.control.WebAppConfigurationException;
+
+/**
+ * OFBizSolrRedirectServlet.java - Master servlet for the ofbiz-solr application.
+ */
+@SuppressWarnings("serial")
+public class OFBizSolrRedirectServlet extends RedirectServlet {
+
+    public static final String module = OFBizSolrRedirectServlet.class.getName();
+    
+    /**
+     * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
+    @Override
+    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+     boolean isForwarded = forwardUrl(request, response);
+     if (isForwarded) {
+     return;
+     }
+    
+     super.doGet(request, response);
+    }
+
+ protected static boolean forwardUrl(HttpServletRequest request, HttpServletResponse response) throws IOException {
+        HttpSession session = request.getSession();
+        GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
+        boolean forwardToLogin = false;
+        if (UtilValidate.isEmpty(userLogin)) {
+         forwardToLogin = true;
+        }
+
+     // check request schema
+     if (forwardToLogin || !request.getScheme().equals("https")) {
+            StringBuilder newURL = new StringBuilder(250);
+            // Build the scheme and host part
+            try {
+                OfbizUrlBuilder builder = OfbizUrlBuilder.from(request);
+                builder.buildHostPart(newURL, "", true);
+            } catch (GenericEntityException e) {
+                // If the entity engine is throwing exceptions, then there is no point in continuing.
+                Debug.logError(e, "Exception thrown while getting web site properties: ", module);
+                return false;
+            } catch (WebAppConfigurationException e) {
+                // If we can't read the controller.xml file, then there is no point in continuing.
+                Debug.logError(e, "Exception thrown while parsing controller.xml file: ", module);
+                return false;
+            } catch (IOException e) {
+                // If we can't write to StringBuilder, then there is no point in continuing.
+                Debug.logError(e, "Exception thrown while writing to StringBuilder: ", module);
+                return false;
+            }
+            if (forwardToLogin) {
+             String contextPath = request.getContextPath();
+             if (UtilValidate.isNotEmpty(contextPath)) {
+             newURL.append(contextPath);
+             }
+             newURL.append("/control/checkLogin");
+             String uri = request.getRequestURI();
+             if (UtilValidate.isNotEmpty(contextPath) && uri.startsWith(contextPath)) {
+             uri = uri.replaceFirst(request.getContextPath(), "");
+             }
+             String servletPath = request.getServletPath();
+             if (UtilValidate.isNotEmpty(servletPath) && uri.startsWith(servletPath)) {
+             uri = uri.replaceFirst(servletPath, "");
+             }
+                newURL.append(uri);
+            } else {
+                newURL.append(request.getRequestURI());
+            }
+
+            // send the redirect
+            try {            
+                response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
+                response.setHeader("Location", newURL.toString());
+                response.setHeader("Connection", "close");
+            } catch (IllegalStateException ise) {
+                throw new IOException(ise.getMessage(), ise);
+            }
+     return true;
+     }
+ return false;
+ }
+}

Propchange: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrRedirectServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrRedirectServlet.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrRedirectServlet.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/solr/webapp/solr/META-INF/LICENSE.txt
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/solr/webapp/solr/META-INF/LICENSE.txt?rev=1700119&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/solr/webapp/solr/META-INF/LICENSE.txt (added)
+++ ofbiz/trunk/specialpurpose/solr/webapp/solr/META-INF/LICENSE.txt Sun Aug 30 13:27:07 2015
@@ -0,0 +1,226 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
+==========================================================================
+The following license applies to the JQuery JavaScript library
+--------------------------------------------------------------------------
+Copyright (c) 2010 John Resig, http://jquery.com/
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+

Propchange: ofbiz/trunk/specialpurpose/solr/webapp/solr/META-INF/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/solr/webapp/solr/META-INF/LICENSE.txt
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/solr/webapp/solr/META-INF/LICENSE.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/solr/webapp/solr/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/solr/webapp/solr/META-INF/MANIFEST.MF?rev=1700119&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/solr/webapp/solr/META-INF/MANIFEST.MF (added)
+++ ofbiz/trunk/specialpurpose/solr/webapp/solr/META-INF/MANIFEST.MF Sun Aug 30 13:27:07 2015
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Ant-Version: Apache Ant 1.8.2
+Created-By: 1.7.0_55-b13 (Oracle Corporation)
+Extension-Name: org.apache.solr
+Specification-Title: Apache Solr Search Server
+Specification-Version: 4.9.0
+Specification-Vendor: The Apache Software Foundation
+Implementation-Title: org.apache.solr
+Implementation-Version: 4.9.0 1604085 - rmuir - 2014-06-20 06:33:59
+Implementation-Vendor: The Apache Software Foundation
+X-Compile-Source-JDK: 1.7
+X-Compile-Target-JDK: 1.7
+

Propchange: ofbiz/trunk/specialpurpose/solr/webapp/solr/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
    svn:mime-type = text/plain