- From: Denis Tea via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 29 Nov 2007 14:12:00 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/org/w3c/unicorn/request In directory hutz:/tmp/cvs-serv30684/org/w3c/unicorn/request Modified Files: DirectRequestGET.java URIRequest.java Request.java DirectRequestPOST.java UploadRequest.java Log Message: Multithreading Index: DirectRequestPOST.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/request/DirectRequestPOST.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- DirectRequestPOST.java 29 Sep 2006 09:25:12 -0000 1.2 +++ DirectRequestPOST.java 29 Nov 2007 14:11:58 -0000 1.3 @@ -45,6 +45,7 @@ final String sURL, final String sInputParameterName, final InputModule aInputModule) throws IOException { + super(); DirectRequestPOST.logger.trace("Constructor"); if (DirectRequestPOST.logger.isDebugEnabled()) { DirectRequestPOST.logger.debug("URL : " + sURL + "."); @@ -132,7 +133,7 @@ sResponse += new String(tByte); } DirectRequestPOST.logger.debug(sResponse);*/ - return (Observationresponse) DirectRequestPOST.aUnmarshaller.unmarshal(aURLConnection.getInputStream()); + return (Observationresponse) this.aUnmarshaller.unmarshal(aURLConnection.getInputStream()); } @Override Index: DirectRequestGET.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/request/DirectRequestGET.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- DirectRequestGET.java 21 Sep 2006 16:01:21 -0000 1.1 +++ DirectRequestGET.java 29 Nov 2007 14:11:58 -0000 1.2 @@ -30,6 +30,7 @@ final String sURL, final String sInputParameterName, final InputModule aInputModule) throws IOException { + super(); DirectRequestGET.logger.trace("Constructor"); if (DirectRequestGET.logger.isDebugEnabled()) { DirectRequestGET.logger.debug("URL : " + sURL + "."); @@ -71,7 +72,7 @@ } final URLConnection aURLConnection = aURL.openConnection(); aURLConnection.setRequestProperty("Accept-Language", this.sLang); - return (Observationresponse) DirectRequestGET.aUnmarshaller.unmarshal(aURLConnection.getInputStream()); + return (Observationresponse) this.aUnmarshaller.unmarshal(aURLConnection.getInputStream()); } @Override Index: UploadRequest.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/request/UploadRequest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- UploadRequest.java 21 Sep 2006 16:01:22 -0000 1.2 +++ UploadRequest.java 29 Nov 2007 14:11:58 -0000 1.3 @@ -33,6 +33,7 @@ final String sURL, final String sInputParameterName, final InputModule aInputModule) throws MalformedURLException, IOException { + super(); UploadRequest.logger.trace("Constructor"); if (UploadRequest.logger.isDebugEnabled()) { UploadRequest.logger.debug("URL : " + sURL + "."); @@ -84,7 +85,7 @@ this.aClientHttpRequest.setParameter(sName, sValue); } final Observationresponse aObservationResponse; - aObservationResponse = (Observationresponse) UploadRequest.aUnmarshaller.unmarshal(this.aClientHttpRequest.post()); + aObservationResponse = (Observationresponse) this.aUnmarshaller.unmarshal(this.aClientHttpRequest.post()); return aObservationResponse; } Index: Request.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/request/Request.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Request.java 21 Sep 2006 16:01:18 -0000 1.2 +++ Request.java 29 Nov 2007 14:11:58 -0000 1.3 @@ -24,13 +24,13 @@ protected static final Log logger = LogFactory.getLog("org.w3c.unicorn.request"); - public static Unmarshaller aUnmarshaller = null; + public Unmarshaller aUnmarshaller = null; protected static JAXBContext aJAXBContext = null; static { try { Request.aJAXBContext = JAXBContext.newInstance("org.w3c.unicorn.generated.observationresponse"); - Request.aUnmarshaller = Request.aJAXBContext.createUnmarshaller(); + } catch (final JAXBException e) { Request.logger.error("JAXBException : " + e.getMessage(), e); @@ -39,6 +39,15 @@ } protected String sLang = null; + + public Request(){ + try { + this.aUnmarshaller = Request.aJAXBContext.createUnmarshaller(); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } public void setLang (final String sLang) throws IOException { Request.logger.debug("setLang("+sLang+")"); @@ -47,7 +56,7 @@ public abstract void addParameter (final String sName, final String sValue) throws IOException; - public abstract Observationresponse doRequest () throws JAXBException, IOException; + public abstract Observationresponse doRequest () throws JAXBException, IOException; public abstract EnumInputMethod getInputMethod (); @@ -56,6 +65,8 @@ final String sURL, final String sInputParameterName, final boolean bIsPost) throws IOException { + + Request.logger.trace("createRequest"); if (Request.logger.isDebugEnabled()) { Request.logger.debug("InputModule : " + aInputModule + "."); Index: URIRequest.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/request/URIRequest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- URIRequest.java 8 Sep 2006 15:35:53 -0000 1.2 +++ URIRequest.java 29 Nov 2007 14:11:58 -0000 1.3 @@ -5,6 +5,7 @@ package org.w3c.unicorn.request; import java.io.IOException; +import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLConnection; @@ -30,6 +31,7 @@ final String sURL, final String sInputParameterName, final InputModule aInputModule) throws IOException { + super(); URIRequest.logger.trace("Constructor"); if (URIRequest.logger.isDebugEnabled()) { URIRequest.logger.debug("URL : " + sURL + "."); @@ -76,8 +78,11 @@ } URIRequest.logger.debug("URL : " + aURL + " ."); final URLConnection aURLConnection = aURL.openConnection(); + aURLConnection.setRequestProperty("Accept-Language", this.sLang); - return (Observationresponse) URIRequest.aUnmarshaller.unmarshal(aURLConnection.getInputStream()); + InputStream is = aURLConnection.getInputStream(); + Observationresponse res = (Observationresponse) this.aUnmarshaller.unmarshal(is); + return res; } @Override
Received on Thursday, 29 November 2007 14:12:08 UTC