web.sequences.source_sequence.jsp Maven / Gradle / Ivy
The newest version!
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%--
~ Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ 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.
--%>
<%@ page import="org.wso2.carbon.mediator.service.builtin.SequenceMediator" %>
<%@ page import="org.wso2.carbon.sequences.ui.SequenceEditorConstants" %>
<%@ page import="org.wso2.carbon.sequences.ui.util.SequenceEditorHelper" %>
<%@ page import="java.util.ResourceBundle" %>
<%@ page import="org.owasp.encoder.Encode" %>
<%@ page import="org.apache.commons.lang.StringEscapeUtils" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ page import="org.apache.commons.lang.StringEscapeUtils"%>
<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
<%
ResourceBundle bundle = ResourceBundle.getBundle("org.wso2.carbon.sequences.ui.i18n.Resources", request.getLocale());
String sequenceName = request.getParameter("sequenceName");
String onErrorKey = request.getParameter("onErrorKey");
String sequenceXML = "";
SequenceMediator sequence = SequenceEditorHelper.getEditingSequence(session);
if (sequence == null) {
session.setAttribute("sequence.error.message", bundle.getString("sequence.source.view.error"));
%>
<%
} else {
if (onErrorKey != null && !"".equals(onErrorKey)) {
SequenceEditorHelper.getEditingSequence(session).setErrorHandler(onErrorKey);
}
try {
if (SequenceEditorConstants.ACTION_PARAM_VALUE_ADD.equals(
SequenceEditorHelper.getEditingSequenceAction(session))) {
if (sequenceName != null) {
SequenceEditorHelper.getEditingSequence(session).setName(sequenceName);
}
sequenceXML = SequenceEditorHelper.parseSequenceToPrettyfiedString(
SequenceEditorHelper.getEditingSequence(session));
} else if (SequenceEditorConstants.ACTION_PARAM_VALUE_ANONIFY.equals(
SequenceEditorHelper.getEditingSequenceAction(session))) {
if((String)session.getAttribute("sequence")!=null){
sequenceXML = SequenceEditorHelper.parseAnonSequenceToPrettyfiedString(
SequenceEditorHelper.getEditingSequence(session), (String)session.getAttribute("sequence"));
} else {
sequenceXML = SequenceEditorHelper.parseAnonSequenceToPrettyfiedString(
SequenceEditorHelper.getEditingSequence(session));
}
} else {
sequenceXML = SequenceEditorHelper.parseSequenceToPrettyfiedString(
SequenceEditorHelper.getEditingSequence(session));
}
sequenceXML = StringEscapeUtils.escapeXml(sequenceXML);
} catch (Exception e) {
session.setAttribute("sequence.error2.message", "" + e.getMessage());
%>
<%
return;
}
%>
<%
if (session.getAttribute("sequence.error.message") != null) {
%>
<%
session.removeAttribute("sequence.error.message");
}
%>
<%
if (session.getAttribute("sequence.warn.message") != null) {
%>
<%
session.removeAttribute("sequence.warn.message");
}
%>