Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ObjectOutputStream.writeObject(objaBasicFileAction);
- package com.mypackage.actions;
- import java.io.Serializable;
- public abstract class BasicFileAction implements Serializable{
- private int[] objcFileBytes;
- private String scFileName;
- public int[] getFileBytes(){
- return objcFileBytes;
- }
- public void setFileBytes( int[] objaFileBytes ){
- objcFileBytes = objaFileBytes;
- }
- public String getFileName(){
- return scFileName;
- }
- public void setFileName(String saFileName){
- scFileName = saFileName ;
- }
- public abstract Object execute() throws Exception;
- }
- public Object executeService(BasicFileAction objaBasicFileAction)
- throws Exception {
- URL objlURLServer = null;
- ObjectInputStream objlResponse = null;
- Object objlObjectResult = null;
- URLConnection objlURLConnection = null;
- ObjectOutputStream objlRequest = null;
- TunnelException exclTunnelException = null;
- try {
- objlURLServer = new URL((String) objcProperties.get(
- FileRemoteHandler.SERVICE_NAME));
- } catch (MalformedURLException e) {
- throw new Exception(
- "No se puede efectuar la conexion al servidor de fotografias '" +
- (String) objcProperties.get(FileRemoteHandler.SERVICE_NAME) +
- "' : " + e.getMessage());
- }
- try {
- objlURLConnection = objlURLServer.openConnection();
- objlURLConnection.setDoOutput(true);
- objlURLConnection.setUseCaches(false);
- objlURLConnection.setRequestProperty("Content-Type",
- "application/octet-stream");
- System.out.println("terminando1");
- objlRequest = new ObjectOutputStream(new BufferedOutputStream(
- objlURLConnection.getOutputStream()));
- try{
- objlRequest.writeObject(objaBasicFileAction); //De aquí no pasa con las imágenes mayores a 3.68MB
- objlRequest.flush();
- objlRequest.close();
- }catch(NotSerializableException r){
- System.out.println("1 "+r.getMessage());
- } catch(InvalidClassException t){
- System.out.println("2 "+t.getMessage());
- } catch(IOException w){
- System.out.println("3 "+w.getMessage());
- }
- // get the result input stream
- objlResponse = new ObjectInputStream(new BufferedInputStream(
- objlURLConnection.getInputStream()));
- // read response back from the server
- objlObjectResult = objlResponse.readObject();
- if (objlObjectResult instanceof TunnelException) {
- exclTunnelException = (TunnelException) objlObjectResult;
- throw new Exception(exclTunnelException.getMessage());
- }
- } catch (Exception exclException) {
- System.out.println("here: "+exclException.getMessage());
- throw new Exception("Error al Ejecutar la Peticion : " +
- exclException.getMessage());
- }
- return objlObjectResult;
- }
- 3.68MB (3867314)
- 3.19MB (3355578)
- 3.05MB (3204054)
- 4.09MB (4293306)
- 4.36MB (4572533)
- 3.81MB (3997079)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement