Getting attachment from Github Issues using the kohsuke Github-API - java

I want to download attachments added to Github issue.
I'm using an API kohsuke
Usually an attachment is added to in Issue into the body of the comment.
My problem is the GHIssueComment has a body as a String. So i can not get the attachments.
I could see that the GHRepository has a method getBlob(String blobSha)
But I do not know that this is what i need, also i do not know the blobSha.

Related

Office365 API get content of ReferenceAttachment

I'm trying to process attachments that were added to my event and I have difficulties in loading the attachments that has the following type:
"#odata.type": "#Microsoft.OutlookServices.ReferenceAttachment"
The problem is that for usual attachments:
"#odata.type": "#Microsoft.OutlookServices.FileAttachment"
Office365 sends ContentBytes in the response with the complete content of the file. In case with the ReferenceAttachment there is no ContentBytes field in the response.
I didn't find anything useful about ReferenceAttachment in the doc:
https://msdn.microsoft.com/en-us/office/office365/api/calendar-rest-operations#get-attachments .
However, I did succeed in finding some info in the documentation for beta version.
https://msdn.microsoft.com/en-us/office/office365/api/complex-types-for-mail-contacts-calendar#referenceattachment-preview
There should be SourceUrl, but I don't have it in my response either.
I really appreciate your help in finding a way to get the content of such attachments. Thanks!
I've found the solution. The reason why I wasn't able to get a source URL was the fact that this works only for beta version. I look forward to having it in a stable version, however, I will use beta one by that time.
So, to make it working, we need to change version in the path parameter to beta.
e.g.
https://outlook.office.com/api/beta/me/events/{eventId}/attachments/
Instead of:
https://outlook.office.com/api/v2.0/me/events/{eventId}/attachments/
Having done that, you will be able to see the following in your response:
"SourceUrl": "https://.../guestaccess.aspx?docid=...",
One more interesting poiunt here. If it's an Office document and you want to directly download it instead of just openning it at online editor, you can change guestaccess to download. Thus you will be able to download.

This site can’t be reached error for Send attachments with e-mail using JSP, Servlet and JavaMail

I tried the example below. This is to Send attachments with e-mail using JSP, Servlet and JavaMail. I get This site can’t be reached error. May I know what changes are required to run this example correctly. You can directly download the war and project files from the links provided in the bottom of the page.
http://www.codejava.net/java-ee/jsp/send-attachments-with-e-mail-using-jsp-servlet-and-javamail#Download
Thanks in advance

How to upload a file via multipart/form-data file upload to camel-jetty 2.17.0?

I am working with a piece of web software that uploads files to a camel-jetty server. The uploads happen through BlueImp jQuery FileUpload (https://github.com/blueimp/jQuery-File-Upload) through the browser. The company I work for recently upgraded from Camel 2.3 to Camel 2.17 in our server-side Java project. We never had a problem before, but since we upgraded to the newer version the file uploads no longer work. Digging into it I have discovered a few strange things:
exchange.getIn().getAttachments().size() == 0 (always)
A NullPointerException is ALWAYS thrown in MultiPartFilter inside camel-jetty because it attempts to ALWAYS get the content-type of EVERY form-data part... even though every browser/agent I have tested by default will not set the content-type on every part.
I fixed the NullPointerException in jetty MultiPartFilter by following advice from another post that uses FormData and Blob directly in javascript to force a content-type on every form-data part (Composing multipart/form-data with a different Content-Type on each parts with Javascript (or Angular)). However, the exchange.getIn().getBody() is now always null, and exchange.getIn().getAttachments() is still always an empty list.
Upon closer inspection I noticed binary data on a header sent AS THE FILE from jQuery FileUpload. exchange.getIn().getHeader("files[]") is a binary data stream, but the data appears to be mangled... I assume because it is being converted to UTF8 encoding (or visa-versa) before it is set on the header.
So my question is how does a person upload files via camel-jetty? I can not find a single example that works when used in the real world with camel-jetty 2.17.0. All examples used to work on Camel-Jetty 2.3.
What am I doing wrong? Can someone please post a working example of a file upload processor using camel-jetty 2.17?

java program to check periodically ms outlook for new mail

I need the solution for the below problem in Java -
On arrival of new mail in ms outlook for a particular email id, there should be a web service get executed automatically.
is it possible? please help!
You can do that using java mail. You will need to find the configuration details but a standard code snippet for this would be something like below. I copied the code snipped from here. Thos official javamail link has a pretty decent set of examples (ie. how to read attachments).
For storing the email as a file to a folder, you can apache FileUtils. Write the email to a file and copy it to a folder that you desire.
There is one more interesting resource

Parse a SOAP request and modify data

I am developing an application to send a text message/sms to a user base and receive their responses. I have been given a wsdl which I have used to consume the service to sendsms using netbeans IDE .So far so good.
Now the problem is when I receive a text message a soap request is posted over to a location on our server. The request-response is as follows:
<a>http://www.csoft.co.uk/sms/api/sms_to_soap.htm</a>
I have checked the provider's sample API section but they do not have any material that does something similar.
My question is how do I parse the soap request and send the corresponding response? Also I have to check the messages and filter them for offensive/obscene content. I have the wsdl, xsd, java classes generated by netbeans, but I cant get around how to use them to achieve the goal. Any help or a pointer in the right direction would be greatly appreciated.
Thanks
Kalyan
Please search Stackoverflow and Google, there is plenty of howto around.
Even in this question, just check on the right at "related".

Categories