Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 18e68d20 authored by Jérôme Euzenat's avatar Jérôme Euzenat
Browse files

- Fixed URL decoding/error reporting problem

parent 289891bc
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ The result of these requests are provided in XML.
In the sequel, we describe the various request types.
They can be obtained by:
<div class="terminal">
$ curl -H "Content-Type: text/xml" &lt;URL&gt;
$ curl -H "Content-Type: text/xml" '&lt;URL&gt;'
</div>
</p>
<p>
......@@ -31,6 +31,11 @@ The <tt>msgid</tt> and <tt>in-reply-to</tt> elements are not
compulsory and may not be present in messages.
</p>
<p style="background-color: yellow;">
Beware: URIs within the &lt;URL&gt; above should be URLEncoded.
This is particularly true of '#' that do not pass through Java URL decoding.
</p>
<h3>listalignments<a name="listalignments"></a></h3>
<p>Gets the list of the alignments available on the server.</p>
......
......@@ -362,9 +362,12 @@ public class AServProtocolManager {
String msg = "";
boolean strict = (params.getProperty("strict")!=null);
try {
for ( Cell c : al.getAlignCells1( uri ) ) {
if ( !strict || c.getRelation() instanceof EquivRelation ) {
msg += c.getObject2AsURI( al )+" ";
Set<Cell> cells = al.getAlignCells1( uri );
if ( cells != null ) {
for ( Cell c : cells ) {
if ( !strict || c.getRelation() instanceof EquivRelation ) {
msg += c.getObject2AsURI( al )+" ";
}
}
}
} catch ( AlignmentException alex ) { // should never happen
......
......@@ -152,8 +152,7 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
// The handler deals with the request
// most of its work is to deal with large content sent in specific ways
Handler handler = new AbstractHandler(){
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch)
throws IOException, ServletException {
public void handle( String target, HttpServletRequest request, HttpServletResponse response, int dispatch ) throws IOException, ServletException {
String method = request.getMethod();
//uri = URLDecoder.decode( request.getURI(), "iso-8859-1" );
// Should be decoded?
......@@ -165,7 +164,7 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
// See below how it is done.
Properties header = new Properties();
Enumeration headerNames = request.getHeaderNames();
while(headerNames.hasMoreElements()) {
while( headerNames.hasMoreElements() ) {
String headerName = (String)headerNames.nextElement();
header.setProperty( headerName, request.getHeader(headerName) );
}
......@@ -199,13 +198,17 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
} else if ( mimetype != null && mimetype.startsWith("text/xml") ) {
// Most likely Web service request (REST through POST)
int length = request.getContentLength();
char [] mess = new char[length+1];
try {
new BufferedReader(new InputStreamReader(request.getInputStream())).read( mess, 0, length);
} catch (Exception e) {
e.printStackTrace(); // To clean up
if ( length > 0 ) {
char [] mess = new char[length+1];
try {
System.err.println("!!!!!"+length);
new BufferedReader(new InputStreamReader(request.getInputStream())).read( mess, 0, length);
System.err.println("?????");
} catch (Exception e) {
e.printStackTrace(); // To clean up
}
params.setProperty( "content", new String( mess ) );
}
params.setProperty( "content", new String( mess ) );
// File attached to SOAP messages
} else if ( mimetype != null && mimetype.startsWith("application/octet-stream") ) {
File alignFile = new File(File.separator + "tmp" + File.separator + newId() +"XXX.rdf");
......@@ -292,16 +295,7 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
Enumeration en = header.propertyNames();
while ( en.hasMoreElements()) {
String value = (String)en.nextElement();
//System.err.println( " HDR: '" + value + "' = '" +
// header.getProperty( value ) + "'" );
}
/*
e = parms.propertyNames();
while ( e.hasMoreElements()) {
String value = (String)e.nextElement();
//System.err.println( " PRM: '" + value + "' = '" +parms.getProperty( value ) + "'" );
}
*/
// Convert parms to parameters
Properties params = new Properties();
......@@ -902,6 +896,7 @@ result += "<td><form action=\"metadata\"><input type=\"hidden\" name=\"id\" valu
if ( sep >= 0 ){
try {
p.put( URLDecoder.decode( next.substring( 0, sep ), "iso-8859-1" ).trim(),
// JE: URLDecoder allows for : and / but not #
URLDecoder.decode( next.substring( sep+1 ), "iso-8859-1" ));
} catch (Exception e) {}; //never thrown
}
......
......@@ -338,7 +338,7 @@ public class WSAServProfile implements AlignmentServiceProfile {
} else {
answer = manager.findCorrespondences( new Message(newId(),(Message)null,myId,serverURL,"", newparameters) );
}
msg += " <correspResponse"+svcNS+">\n"+answer.SOAPString()+"</correspResponse>\n";
msg += " <correspResponse"+svcNS+">\n"+answer.SOAPString()+" </correspResponse>\n";
} else if ( method.equals("findRequest") || method.equals("find") ) { // URI * URI -> List of URI
if ( newparameters.getProperty( "onto1" ) == null && newparameters.getProperty( "onto2" ) == null ) {
answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment