escape xml content

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1395630 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-10-08 15:50:49 +00:00
parent 76fd653c09
commit 535a635cc6
2 changed files with 22 additions and 29 deletions

View File

@ -19,6 +19,7 @@ package org.apache.archiva.web.docs;
*/
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
@ -56,7 +57,8 @@ public class RestDocsServlet
if ( StringUtils.endsWith( path, ".xsd" ) )
{
IOUtils.copy( is, resp.getOutputStream() );
StringEscapeUtils.escapeXml( resp.getWriter(), IOUtils.toString( is ) );
//IOUtils.copy( is, resp.getOutputStream() );
return;
}

View File

@ -25,49 +25,40 @@ define("archiva.docs",["jquery","i18n","jquery.tmpl","bootstrap"], function() {
}
goToArchivaRestDoc=function(target){
var mainContent = $("#main-content");
mainContent.find("#rest_docs_content" ).html(mediumSpinnerImg());
$.ajax({
url:"rest-docs/rest-docs-archiva-rest-api/"+target,
type:"get",
dataType: "html",
success: function(data){
mainContent.html($("#rest_docs").tmpl());
mainContent.find("#rest_docs_content" ).html(data);
prettyPrint();
}
});
goToRestDoc(target,"rest-docs/rest-docs-archiva-rest-api");
}
goToArchivaRestUiDoc=function(target){
goToRestDoc(target,"rest-docs/rest-docs-archiva-ui");
}
goToRedbackRestDoc=function(target){
goToRestDoc(target,"rest-docs/rest-docs-redback-rest-api");
}
goToRestDoc=function(target,rootPath){
var mainContent = $("#main-content");
mainContent.find("#rest_docs_content" ).html(mediumSpinnerImg());
$.ajax({
url:"rest-docs/rest-docs-archiva-ui/"+target,
url:rootPath+"/"+target,
type:"get",
dataType: "html",
success: function(data){
mainContent.html($("#rest_docs").tmpl());
mainContent.find("#rest_docs_content" ).html(data);
if(target.endsWith(".xsd")){
mainContent.find("#rest_docs_content" ).html("<code id='xsd_content'></code>");
mainContent.find("#xsd_content" ).html(data);
} else {
mainContent.find("#rest_docs_content" ).html(data);
}
prettyPrint();
}
});
}
goToRedbackRestDoc=function(target){
var mainContent = $("#main-content");
mainContent.find("#rest_docs_content" ).html(mediumSpinnerImg());
$.ajax({
url:"rest-docs/rest-docs-redback-rest-api/"+target,
type:"get",
dataType: "html",
success: function(data){
mainContent.html($("#rest_docs").tmpl());
mainContent.find("#rest_docs_content" ).html(data);
prettyPrint();
}
});
}
displayRedbackRestDocs=function(){
window.sammyArchivaApplication.setLocation("#rest-docs-redback-rest-api/index.html");
}