![]() Now the input being printed instead of complete byte sequence is just and because I am sending the same in parameter, in my cq servlet I am using below code which is giving me only : String requestStr = request.getParameter("inputstream") byte rawRequestMsg = requestStr.getBytes(someSingleByteEncoding) (""+rawRequestMsg) // prints whats happening I don't know but this is definitely not my byte which I got by converting a. I am now setting it as parameter in the post request like below tDoOutput(true) tRequestMethod("POST") tRequestProperty("fileName", filename) OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()) ("input :"+input) // This prints input writer.write("inputstream="+input) I did a little change in code and now I am getting something which I am not sure is correct or not. I know request.getInputStream() is giving some issue but not sure how to fix it. The problem is you dont keep track of the state of your MediaPlayer instance. 15:17:31.092 *ERROR*. getRequestParameterMapInternal: Error parsing request : Request Data has already been readĪpart from this error I am also getting below error but I think this isn't relevant. 15:19:37.162 *ERROR* POST /bin/services/updateslafile HTTP/1.1] .impl.SlingRequestProcessorImpl service: Uncaught Throwable Now when I run the code in the error log I am getting some error The code in the servlet for reading the byte is like below : String fileName = request.getHeader("fileName") // opens input stream of the request for reading data InputStream inputStream = request.getInputStream() // This line giving error String filePath = "/home/usr/documents/"+fileName // opens an output stream for writing file FileOutputStream fileOuputStream = new FileOutputStream(filePath) byte buffer = new byte int bytesRead = -1 ("Receiving data.") while ((bytesRead = inputStream.read(buffer)) != -1) ("Data received.") fileOuputStream.close() inputStream.close() docx file content as byte OutputStream outs = connection.getOutputStream() outs.write(input) outs.flush() outs.close() //for response reading StringBuffer strBuffer = new StringBuffer() InputStream inputStream = connection.getInputStream() byte b = new byte while ( is.read(b) != -1) strBuffer.append(new String(b)) ("strbuffer : "+strBuffer.toString()) ![]() The code for sending is : URL url = new URL(" HttpURLConnection connection = (HttpURLConnection) url.openConnection() String authStr = "admin:admin" // encode data on your side using BASE64 byte bytesEncoded = Base64.encodeBase64(authStr.getBytes()) String authEncoded = new String(bytesEncoded) tRequestProperty("Authorization", "Basic "+authEncoded) tDoOutput(true) tRequestMethod("POST") tRequestProperty("fileName", "test.docx") byte input //assume input initialized with some. Hittable sc = (Scorpion)getOneIntersectingObject(Scorpion.I have a code in java that sends byte to CQ servlet using POST. Hittable sp = (Spurter)getOneIntersectingObject(Spurter.class) Hittable p = (Poison)getOneIntersectingObject(Poison.class) Hittable m = (Mushroom)getOneIntersectingObject(Mushroom.class) ![]() ![]() Hittable f = (Flea)getOneIntersectingObject(Flea.class) ![]() Hittable c = (Centipede)getOneIntersectingObject(Centipede.class) Score scTxt = k.getObjects(Score.class).get(0) However, when I shoot the laser and it touches a mushroom, an illegal state exception is thrown for the laser class. I'm working on making my actor classes be subclasses of more general superclasses (for example, the subclasses "Centipede" and "Mushroom" would be subclasses of "Hittable"). I'm re-creating the Atari Centipede game. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |