Glassfish seems to be adding extra to the path I want to save my image file too, is there some way to use only the absolute path my servlet gets with
String ap
You should not save uploaded files in the deploy folder. I have explained this so many times before. One of those explanations can be found in this answer: Uploaded image only available after refreshing the page.
Any JSP/Servlet code snippet found on some blog/article which ever uses the getRealPath()
method should be taken with a huge bag of salt. Its quality and the knowledge of the author should strongly be questioned. There is namely no sensible real world use case for that method.
Save uploaded files in a fixed path outside the deploy folder. See also How do I set the folder for storing file uploads using Commons FileUpload.