@@ -0,0 +1,2565 @@
+/*%0A  Copyright 2010-2017 BusinessCode GmbH, Germany%0A%0A  Licensed under the Apache License, Version 2.0 (the %22License%22);%0A  you may not use this file except in compliance with the License.%0A  You may obtain a copy of the License at%0A%0A  http://www.apache.org/licenses/LICENSE-2.0%0A%0A  Unless required by applicable law or agreed to in writing, software%0A  distributed under the License is distributed on an %22AS IS%22 BASIS,%0A  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A  See the License for the specific language governing permissions and%0A  limitations under the License.%0A*/%0Apackage de.businesscode.bcdui.web.wrs;%0A%0Aimport de.businesscode.bcdui.toolbox.ServletUtils;%0Aimport de.businesscode.bcdui.web.errorLogging.ErrorLogEvent;%0Aimport de.businesscode.bcdui.wrs.IRequestOptions;%0Aimport de.businesscode.bcdui.wrs.load.ISqlGenerator;%0Aimport de.businesscode.bcdui.wrs.load.Wrq2Sql;%0Aimport de.businesscode.util.StandardNamespaceContext;%0Aimport org.apache.log4j.Logger;%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.http.HttpServlet;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0Aimport java.io.IOException;%0A%0A/**%0A  Returns the generated SQL statement for a Wrq.%0A  Note, this is a security risk, limit the usage to internal applications%0A */%0Apublic class Wrq2SqlServlet extends HttpServlet %7B%0A%0A  private static final long serialVersionUID = -1447179893615429245L;%0A  private final Logger log = Logger.getLogger(getClass());%0A%0A  /**%0A   * @see HttpServlet#doGet(HttpServletRequest, HttpServletResponse)%0A   */%0A  @Override%0A  protected void doGet(HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException %7B%0A%0A    if (log.isTraceEnabled())%0A      log.trace(String.format(%22processing url: %25s%22, ServletUtils.getInstance().reconstructURL(request)));%0A%0A    response.setContentType(%22text/xml%22);%0A    response.setCharacterEncoding(%22UTF-8%22);%0A%0A    try %7B%0A      IRequestOptions options = new HttpRequestOptions(getServletContext(), request, -1);%0A      ISqlGenerator generator = new Wrq2Sql(options);%0A      response.getWriter()%0A        .append(%22%3CWrs xmlns='%22+StandardNamespaceContext.WRS_NAMESPACE+%22'%3E%3CHeader%3E%3CSql%3E%22)%0A        .append(generator.getSelectStatement().getStatementWithParams())%0A        .append(%22%3C/Sql%3E%3C/Header%3E%3C/Wrs%3E%22);%0A    %7D%0A    catch (Exception e) %7B%0A      log.error(new ErrorLogEvent(%22Exception while processing the request.%22, request), e);%0A      throw new ServletException(e);%0A    %7D%0A%0A    if (log.isTraceEnabled()) %7B%0A      log.trace(%22processed.%22);%0A    %7D%0A  %7D%0A%0A%7D%0A

Add a servlet returning the generated SQL to the client