Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

.

  • Loading branch information...
commit b301ed534ffb80008361de55def5d05928de1b7b 1 parent d3ad555
attdevsupport authored
Showing with 2,116 additions and 1,419 deletions.
  1. +1 −1  MMS/Csharp/app1/README.txt
  2. +1 −1  MMS/Csharp/app2/README.txt
  3. +1 −1  MMS/Csharp/app3/README.txt
  4. +410 −346 MMS/Java/app1/MMS.jsp
  5. +6 −6 MMS/Java/app1/OauthStorage.jsp
  6. +8 −13 MMS/Java/app1/README.txt
  7. BIN  MMS/Java/app1/WEB-INF/classes/com/att/rest/RestClient.class
  8. +7 −7 MMS/Java/app1/config.jsp
  9. +7 −2 MMS/Java/app1/getToken.jsp
  10. +242 −212 MMS/Java/app2/MMS2.jsp
  11. +7 −0 MMS/Java/app2/OauthStorage.jsp
  12. +13 −13 MMS/Java/app2/README.txt
  13. BIN  MMS/Java/app2/WEB-INF/classes/com/att/rest/RestClient.class
  14. +8 −1 MMS/Java/app2/config.jsp
  15. +8 −3 MMS/Java/app2/getToken.jsp
  16. +16 −6 MMS/Java/app3/MMS3.jsp
  17. +9 −2 MMS/Java/app3/OauthStorage.jsp
  18. +16 −9 MMS/Java/app3/README.txt
  19. +7 −1 MMS/Java/app3/config.jsp
  20. +7 −0 MMS/Java/app3/getImageData.jsp
  21. +11 −6 MMS/Java/app3/mmslistener.jsp
  22. +1 −2  MMS/PHP/app1/config.php
  23. +15 −8 MMS/PHP/app1/index.php
  24. +3 −4 MMS/PHP/app2/README.txt
  25. +1 −2  MMS/PHP/app2/config.php
  26. +3 −3 MMS/PHP/app2/index.php
  27. +2 −2 MMS/PHP/app3/index.php
  28. +10 −4 MMS/Ruby/app1/README
  29. +7 −1 MMS/Ruby/app1/common.rb
  30. +2 −2 MMS/Ruby/app1/config.yml
  31. +7 −1 MMS/Ruby/app2/README
  32. +5 −0 MMS/Ruby/app2/common.rb
  33. +5 −8 MMS/Ruby/app2/mms2.rb
  34. +8 −2 MMS/Ruby/app3/README
  35. +2 −2 MMS/Ruby/app3/config.yml
  36. +1 −1  MMS/Vb/app1/README.txt
  37. +1 −1  MMS/Vb/app2/README.txt
  38. +1 −1  MMS/Vb/app3/README.txt
  39. +1 −1  Notary/Csharp/app1/README.txt
  40. +1 −1  Notary/PHP/app1/config.php
  41. +1 −1  Notary/PHP/app1/index.php
  42. +10 −4 Notary/Ruby/app1/README
  43. +5 −0 Notary/Ruby/app1/common.rb
  44. +1 −1  Notary/Ruby/app1/views/notary.erb
  45. +1 −1  Notary/Vb/app1/README.txt
  46. +1 −1  Payment/Csharp/app1/README.txt
  47. +1 −1  Payment/Csharp/app2/README.txt
  48. +3 −3 Payment/Java/app1/OauthStorage.jsp
  49. +4 −4 Payment/Java/app1/README.txt
  50. +2 −2 Payment/Java/app1/config.jsp
  51. +22 −43 Payment/Java/app1/getLatestNotifications.jsp
  52. +0 −7 Payment/Java/app1/getToken.jsp
  53. +10 −30 Payment/Java/app1/listener.jsp
  54. +9 −3 Payment/Java/app1/notary.jsp
  55. +115 −61 Payment/Java/app1/singlepay.jsp
  56. +7 −0 Payment/Java/app2/OauthStorage.jsp
  57. +10 −4 Payment/Java/app2/README.txt
  58. +7 −0 Payment/Java/app2/config.jsp
  59. +7 −0 Payment/Java/app2/getLatestNotifications.jsp
  60. +25 −5 Payment/Java/app2/getLatestTransactions.jsp
  61. +7 −0 Payment/Java/app2/getToken.jsp
  62. +7 −0 Payment/Java/app2/notary.jsp
  63. +3 −3 Payment/Java/app2/paymentlistener.jsp
  64. +7 −0 Payment/Java/app2/subscription.jsp
  65. +30 −46 Payment/PHP/app1/README.txt
  66. +1 −1  Payment/PHP/app1/config.php
  67. +104 −57 Payment/PHP/app1/singlepay.php
  68. +4 −29 Payment/PHP/app1/singlepaylistener.php
  69. +30 −45 Payment/PHP/app2/README.txt
  70. +1 −1  Payment/PHP/app2/config.php
  71. +98 −55 Payment/PHP/app2/subscription.php
  72. +5 −34 Payment/PHP/app2/subscriptionlistener.php
  73. +61 −18 Payment/Ruby/app1/README
  74. +87 −5 Payment/Ruby/app1/app1.rb
  75. +5 −0 Payment/Ruby/app1/common.rb
  76. +10 −3 Payment/Ruby/app1/config.yml
  77. +18 −7 Payment/Ruby/app1/views/app1.erb
  78. +61 −20 Payment/Ruby/app2/README
  79. +91 −5 Payment/Ruby/app2/app2.rb
  80. +5 −0 Payment/Ruby/app2/common.rb
  81. +9 −4 Payment/Ruby/app2/config.yml
  82. +0 −1  Payment/Ruby/app2/configNotary.yml
  83. +13 −3 Payment/Ruby/app2/views/app2.erb
  84. +1 −1  Payment/Vb/app1/README.txt
  85. +1 −1  Payment/Vb/app2/README.txt
  86. +1 −1  SMS/Csharp/app1/README.txt
  87. +1 −1  SMS/Csharp/app2/README.txt
  88. +6 −6 SMS/Java/app1/OauthStorage.jsp
  89. +8 −14 SMS/Java/app1/README.txt
  90. +9 −5 SMS/Java/app1/SMS.jsp
  91. +6 −6 SMS/Java/app1/config.jsp
  92. +8 −3 SMS/Java/app1/getToken.jsp
  93. +8 −0 SMS/Java/app2/OauthStorage.jsp
  94. +6 −0 SMS/Java/app2/README.txt
  95. +7 −0 SMS/Java/app2/SMS2.jsp
  96. +7 −0 SMS/Java/app2/config.jsp
  97. +8 −1 SMS/Java/app2/getToken.jsp
  98. +15 −2 SMS/Java/app2/getVotes.jsp
  99. +9 −4 SMS/PHP/app1/README.txt
  100. +1 −1  SMS/PHP/app1/config.php
  101. +1 −1  SMS/PHP/app1/index.php
  102. +14 −4 SMS/PHP/app2/README.txt
  103. +1 −1  SMS/PHP/app2/config.php
  104. +1 −1  SMS/PHP/app2/index.php
  105. +10 −4 SMS/Ruby/app1/README
  106. +5 −0 SMS/Ruby/app1/common.rb
  107. +3 −3 SMS/Ruby/app1/config.yml
  108. +10 −4 SMS/Ruby/app2/README
  109. +5 −0 SMS/Ruby/app2/common.rb
  110. +1 −1  SMS/Ruby/app2/config.yml
  111. +1 −1  SMS/Vb/app1/README.txt
  112. +1 −1  SMS/Vb/app2/README.txt
  113. +1 −1  Speech/Csharp/app1/README.txt
  114. +0 −7 Speech/Java/app1/OauthStorage.jsp
  115. +49 −69 Speech/Java/app1/README.txt
  116. +1 −8 Speech/Java/app1/Speech.jsp
  117. +0 −7 Speech/Java/app1/config.jsp
  118. +10 −8 Speech/PHP/app1/README.txt
  119. +10 −3 Speech/Ruby/app1/README.txt
  120. +1 −1  Speech/Vb/app1/README.txt
  121. +1 −1  TL/Csharp/app1/README.txt
  122. +9 −9 TL/Java/app1/README.txt
  123. +7 −0 TL/Java/app1/TL.jsp
  124. +6 −6 TL/Java/app1/config.jsp
  125. +8 −1 TL/Java/app1/oauth.jsp
  126. +13 −12 TL/PHP/app1/README.txt
  127. +1 −1  TL/PHP/app1/config.php
  128. +1 −1  TL/PHP/app1/index.php
  129. +5 −0 TL/Ruby/app1/common.rb
  130. +1 −1  TL/Ruby/app1/config.yml
  131. +1 −1  TL/Vb/app1/README.txt
  132. +1 −1  WAP/Csharp/app1/README.txt
  133. +7 −0 WAP/Java/app1/OauthStorage.jsp
  134. +5 −11 WAP/Java/app1/README.txt
  135. +7 −0 WAP/Java/app1/WAP.jsp
  136. +7 −0 WAP/Java/app1/config.jsp
  137. +7 −2 WAP/Java/app1/getToken.jsp
  138. +9 −4 WAP/PHP/app1/README.txt
  139. +1 −1  WAP/PHP/app1/config.php
  140. +17 −7 WAP/PHP/app1/index.php
  141. +10 −4 WAP/Ruby/app1/README
  142. +5 −0 WAP/Ruby/app1/common.rb
  143. +1 −1  WAP/Vb/app1/README.txt
View
2  MMS/Csharp/app1/README.txt
@@ -5,7 +5,7 @@
* For more information contact developer.support@att.com<mailto:developer.support@att.com>
******************************************************************************************
- AT&T API Samples - MMS app 1
+ AT&T API Platform Samples - MMS app 1
------------------------------
This application allows the user to
View
2  MMS/Csharp/app2/README.txt
@@ -5,7 +5,7 @@
* For more information contact developer.support@att.com<mailto:developer.support@att.com>
******************************************************************************************
- AT&T API Samples - MMS app 2
+ AT&T API Platform Samples - MMS app 2
------------------------------
This is a server side application which also has a web interface. The application
View
2  MMS/Csharp/app3/README.txt
@@ -5,7 +5,7 @@
* For more information contact developer.support@att.com<mailto:developer.support@att.com>
******************************************************************************************
- AT&T API Samples - MMS app 3
+ AT&T API Platform Samples - MMS app 3
------------------------------
This file describes how to set up, configure and run the C# Applications of the
View
756 MMS/Java/app1/MMS.jsp
@@ -1,346 +1,410 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en"><head>
- <title>AT&amp;T Sample MMS Application 1 - Basic SMS Service Application</title>
- <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
- <link rel="stylesheet" type="text/css" href="style/common.css"/ >
- <script type="text/javascript" src="js/helper.js">
-</script>
-<body>
-
-<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
-<%@ page import="com.sun.jersey.multipart.file.*" %>
-<%@ page import="com.sun.jersey.multipart.BodyPart" %>
-<%@ page import="com.sun.jersey.multipart.MultiPart" %>
-<%@ page import="java.io.*" %>
-<%@ page import="java.util.List" %>
-<%@ page import="com.att.rest.*" %>
-<%@ page import="java.net.*" %>
-<%@ page import="javax.ws.rs.core.*" %>
-<%@ page import="org.apache.commons.fileupload.*"%>
-<%@ page import="java.util.List,java.util.Iterator"%>
-<%@ page import="org.json.*"%>
-<%@ page import="org.w3c.dom.*" %>
-<%@ page import="javax.xml.parsers.*" %>
-<%@ page import="javax.xml.transform.*" %>
-<%@ page import="javax.xml.transform.stream.*" %>
-<%@ page import="javax.xml.transform.dom.*" %>
-<%@ page import="org.apache.commons.httpclient.*"%>
-<%@ page import="org.apache.commons.httpclient.methods.*"%>
-<%@ include file="getToken.jsp" %>
-<%
-
-String redirectUri = "";
-String getMmsDeliveryStatus = request.getParameter("getMmsDeliveryStatus");
-String mmsId = request.getParameter("mmsId");
-if (mmsId==null) mmsId = (String) session.getAttribute("mmsId");
-if (mmsId==null) mmsId = "";
-String sendMms = request.getParameter("sendMms");
-String contentBodyFormat = "FORM-ENCODED";
-String address = request.getParameter("address");
-if(address==null || address.equalsIgnoreCase("null"))
- address = (String) session.getAttribute("addressSms2");
-if(address==null || address.equalsIgnoreCase("null"))
- address = "";
-String fileName = "";
-String subject = (String) session.getAttribute("subject");
-if(subject==null || subject.equalsIgnoreCase("null"))
-subject = "simple message to myself";
-String priority = "High";
-String responseFormat = "json";
-String requestFormat = "json";
-String endpoint = FQDN + "/rest/mms/2/messaging/outbox";
-String senderAddress = shortCode1;
-
-//If Send MMS button was clicked, do this to get some parameters from the form.
-if(request.getParameter("sendMms")!=null) {
-try{
- DiskFileUpload fu = new DiskFileUpload();
- List fileItems = fu.parseRequest(request);
- Iterator itr = fileItems.iterator();
- while(itr.hasNext()) {
- FileItem fi = (FileItem)itr.next();
- if(!fi.isFormField()) {
- File fNew= new File(application.getRealPath("/"), fi.getName());
- fileName = fileName + "," + fi.getName();
- if(!(fi.getName().equalsIgnoreCase(""))){
- fi.write(fNew);
- }
- } else if(fi.getFieldName().equalsIgnoreCase("address")) {
- address = fi.getString();
- session.setAttribute("addressSms2",address);
- } else if(fi.getFieldName().equalsIgnoreCase("subject")) {
- subject = fi.getString();
- session.setAttribute("subject",subject);
- }
- }
-} catch(Exception e){};
-}
-%>
-
-
-<div id="container">
-<!-- open HEADER --><div id="header">
-
-<div>
- <div id="hcRight">
- <%=new java.util.Date()%>
-
- </div>
- <div id="hcLeft">Server Time:</div>
-</div>
-<div>
- <div id="hcRight"><script language="JavaScript" type="text/javascript">
-var myDate = new Date();
-document.write(myDate);
-</script></div>
- <div id="hcLeft">Client Time:</div>
-</div>
-<div>
- <div id="hcRight"><script language="JavaScript" type="text/javascript">
-document.write("" + navigator.userAgent);
-</script></div>
- <div id="hcLeft">User Agent:</div>
-</div>
-<br clear="all" />
-</div><!-- close HEADER -->
-
-<div id="wrapper">
-<div id="content">
-
-<h1>AT&amp;T Sample MMS Application 1 - Basic MMS Service Application</h1>
-<h2>Feature 1: Send MMS Message</h2>
-
-</div>
-</div>
-<form method="post" name="sendMms" enctype="multipart/form-data" action="MMS.jsp?sendMms=true">
-<div id="navigation">
-
-<table border="0" width="100%">
- <tbody>
- <tr>
- <td width="20%" valign="top" class="label">Phone:</td>
- <td class="cell"><input maxlength="16" size="12" name="address" value="<%=address%>" style="width: 90%">
- </td>
- </tr>
- <tr>
- <td valign="top" class="label">Message:</td>
- <td class="cell"><textarea rows="4" name="subject" style="width: 90%"><%=subject%></textarea>
- </td>
- </tr>
- </tbody>
-</table>
-
-</div>
-<div id="extra">
-
-<div class="warning">
-<strong>WARNING:</strong><br />
-total size of all attachments cannot exceed 600 KB.
-</div>
-
-<table border="0" width="100%">
- <tbody>
- <tr>
- <td valign="top" class="label">Attachment 1:</td>
- <td class="cell"><input name="f1" type="file">
- </td>
- </tr>
- <tr>
- <td valign="top" class="label">Attachment 2:</td>
- <td class="cell"><input name="f2" type="file">
- </td>
- </tr>
- <tr>
- <td valign="top" class="label">Attachment 3:</td>
- <td class="cell"><input name="f3" type="file">
- </td>
- </tr>
- </tbody></table>
- <table>
- <tbody>
- <tr>
- <td><button type="submit" name="sendMms">Send MMS Message</button></td>
- </tr>
- </tbody></table>
-
-
-</div>
-<br clear="all" />
-<div align="center"></div>
-</form>
-
-<%
-//If Send MMS button was clicked, do this.
-if(request.getParameter("sendMms")!=null) {
- //Check for a few known formats the user could have entered the address, adjust accordingly
- String invalidAddress = null;
- if((address.indexOf("-")==3) && (address.length()==12))
- address = "tel:" + address.substring(0,3) + address.substring(4,7) + address.substring(8,12);
- else if((address.indexOf(":")==3) && (address.length()==14))
- address = address;
- else if((address.indexOf("-")==-1) && (address.length()==10))
- address = "tel:" + address;
- else if((address.indexOf("-")==-1) && (address.length()==11))
- address = "tel:" + address.substring(1);
- else if((address.indexOf("-")==-1) && (address.indexOf("+")==0) && (address.length()==12))
- address = "tel:" + address.substring(2);
- else
- invalidAddress = "yes";
-if(invalidAddress==null) {
- if(fileName.equalsIgnoreCase(""))
- fileName = (String) session.getAttribute("fileName");
-
- String attachmentsStr = fileName;
- String[] attachments = attachmentsStr.split(",");
-
- MediaType contentBodyType = null;
- String requestBody = "";
- MultiPart mPart;
- contentBodyType = MediaType.MULTIPART_FORM_DATA_TYPE;
- JSONObject requestObject = new JSONObject();
- requestObject.put("Priority", priority);
- requestObject.put("Address", address);
- requestObject.put("Subject", subject);
- requestObject.put("content-type", "image/jpeg");
- requestBody += requestObject.toString();
- mPart = new MultiPart().bodyPart(new BodyPart(requestBody,MediaType.APPLICATION_JSON_TYPE));
- mPart.getBodyParts().get(0).getHeaders().add("Content-Transfer-Encoding", "8bit");
- mPart.getBodyParts().get(0).getHeaders().add("Content-Disposition","form-data; name=\"root-fields\"");
- mPart.getBodyParts().get(0).getHeaders().add("Content-ID", "<startpart>");
- MediaType[] medTyp = new MediaType[4];
- for(int i=1;i<attachments.length; i++) {
- FileDataBodyPart fIlE = new FileDataBodyPart();
- medTyp[i] = fIlE.getPredictor().getMediaTypeFromFileName("/" + attachments[i]);
- }
-
- ServletContext context = getServletContext();
- if(attachments.length == 2){
- mPart.bodyPart(new BodyPart(context.getResourceAsStream("/" + attachments[1]), medTyp[1]));
- } else if(attachments.length == 3) {
- mPart.bodyPart(new BodyPart(context.getResourceAsStream("/" + attachments[1]), medTyp[1])).bodyPart(new BodyPart(context.getResourceAsStream("/" + attachments[2]), medTyp[2]));
- } else if(attachments.length == 4) {
- mPart.bodyPart(new BodyPart(context.getResourceAsStream("/" + attachments[1]), medTyp[1])).bodyPart(new BodyPart(context.getResourceAsStream("/" + attachments[2]), medTyp[2])).bodyPart(new BodyPart(context.getResourceAsStream("/" + attachments[3]), medTyp[3]));
- }
-
- // This currently uses a proprietary rest client to assemble the request body that does not follow SMIL standards. It is recommended to follow SMIL standards to ensure attachment delivery.
- RestClient client;
- client = new RestClient(endpoint, contentBodyType, MediaType.APPLICATION_JSON_TYPE);
- client.addParameter("access_token", accessToken);
- client.addRequestBody(mPart);
- String responze = client.invoke(com.att.rest.HttpMethod.POST, true);
-
- if (client.getHttpResponseCode() == 201) {
- JSONObject rpcObject = new JSONObject(responze);
- mmsId = rpcObject.getString("Id");
- session.setAttribute("mmsId", mmsId);
- %>
- <div class="successWide">
- <strong>SUCCESS:</strong><br />
- <strong>Message ID:</strong> <%=mmsId%>
- </div><br/>
- <%
- } else {
- %>
- <div class="errorWide">
- <strong>ERROR:</strong><br />
- <%=responze%>
- </div><br/>
- <%
- }
- } else { %>
- <div class="errorWide">
- <strong>ERROR:</strong><br />
- Invalid Address Entered
- </div><br/>
-<% }
-}
-%>
-
-<div id="wrapper">
-<div id="content">
-
-<h2><br />
-Feature 2: Get Delivery Status</h2>
-
-</div>
-</div>
-
-<form method="post" name="getMmsDeliveryStatus" action="MMS.jsp">
-<div id="navigation">
-
-<table border="0" width="100%">
- <tbody>
- <tr>
- <td width="20%" valign="top" class="label">Message ID:</td>
- <td class="cell"><input size="12" name="mmsId" value="<%=mmsId%>" style="width: 90%">
- </td>
- </tr>
- </tbody></table>
-
-</div>
-<div id="extra">
-
-<table border="0" width="100%">
- <tbody>
- <tr>
- <td class="cell"><button type="submit" name="getMmsDeliveryStatus">Get Status</button>
- </td>
- </tr>
- </tbody></table>
-
-</div>
-<br clear="all" />
-</form>
-
- <%
- //If Check Delivery Status button was clicked, do this.
- if(getMmsDeliveryStatus!=null) {
-
- String url = FQDN + "/rest/mms/2/messaging/outbox/" + mmsId;
- HttpClient client = new HttpClient();
- GetMethod method = new GetMethod(url);
- method.setQueryString("access_token=" + accessToken + "&id=" + mmsId);
- method.addRequestHeader("Accept","application/" + responseFormat);
- method.addRequestHeader("Authorization","Bearer " + accessToken);
-
- int statusCode = client.executeMethod(method);
- if(statusCode==200) {
- JSONObject jsonResponse = new JSONObject(method.getResponseBodyAsString());
- JSONObject deliveryInfoList = new JSONObject(jsonResponse.getString("DeliveryInfoList"));
- JSONArray deliveryInfoArray = new JSONArray(deliveryInfoList.getString("DeliveryInfo"));
- JSONObject deliveryInfo = new JSONObject(deliveryInfoArray.getString(0));
- %>
- <div class="successWide">
- <strong>SUCCESS:</strong><br />
- <strong>Status:</strong> <%=deliveryInfo.getString("DeliveryStatus")%><br />
- <strong>Resource URL:</strong> <%=deliveryInfoList.getString("ResourceUrl")%><br />
- </div><br/>
- <%
- } else {
- %>
- <div class="errorWide">
- <strong>ERROR:</strong><br />
- <%=method.getResponseBodyAsString()%>
- </div><br/>
- <%
- }
- method.releaseConnection();
- }
- %>
-
-<div id="footer">
-
- <div style="float: right; width: 20%; font-size: 9px; text-align: right">Powered by AT&amp;T Cloud Architecture</div>
- <p>&#169; 2012 AT&amp;T Intellectual Property. All rights reserved. <a href="http://developer.att.com/" target="_blank">http://developer.att.com</a>
-<br>
-The Application hosted on this site are working examples intended to be used for reference in creating products to consume AT&amp;T Services and not meant to be used as part of your product. The data in these pages is for test purposes only and intended only for use as a reference in how the services perform.
-<br>
-For download of tools and documentation, please go to <a href="https://devconnect-api.att.com/" target="_blank">https://devconnect-api.att.com</a>
-<br>
-For more information contact <a href="mailto:developer.support@att.com">developer.support@att.com</a>
-
-</div>
-</div>
-
-</body></html>
-
+<%
+//Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
+//TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
+//Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
+//For more information contact developer.support@att.com
+%>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
+<head>
+<title>AT&amp;T Sample MMS Application 1 - Basic SMS Service
+ Application</title>
+<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
+<link rel="stylesheet" type="text/css" href="style/common.css"/ >
+<script type="text/javascript" src="js/helper.js">
+
+</script>
+<body>
+
+ <%@ page contentType="text/html; charset=iso-8859-1" language="java"%>
+ <%@ page import="com.sun.jersey.multipart.file.*"%>
+ <%@ page import="com.sun.jersey.multipart.BodyPart"%>
+ <%@ page import="com.sun.jersey.multipart.MultiPart"%>
+ <%@ page import="java.io.*"%>
+ <%@ page import="java.util.List"%>
+ <%@ page import="com.att.rest.*"%>
+ <%@ page import="java.net.*"%>
+ <%@ page import="javax.ws.rs.core.*"%>
+ <%@ page import="org.apache.commons.fileupload.*"%>
+ <%@ page import="java.util.List,java.util.Iterator"%>
+ <%@ page import="org.json.*"%>
+ <%@ page import="org.w3c.dom.*"%>
+ <%@ page import="javax.xml.parsers.*"%>
+ <%@ page import="javax.xml.transform.*"%>
+ <%@ page import="javax.xml.transform.stream.*"%>
+ <%@ page import="javax.xml.transform.dom.*"%>
+ <%@ page import="org.apache.commons.httpclient.*"%>
+ <%@ page import="org.apache.commons.httpclient.methods.*"%>
+ <%@ include file="getToken.jsp"%>
+ <%
+
+String redirectUri = "";
+String getMmsDeliveryStatus = request.getParameter("getMmsDeliveryStatus");
+String mmsId = request.getParameter("mmsId");
+if (mmsId==null) mmsId = (String) session.getAttribute("mmsId");
+if (mmsId==null) mmsId = "";
+String sendMms = request.getParameter("sendMms");
+String contentBodyFormat = "FORM-ENCODED";
+String address = request.getParameter("address");
+if(address==null || address.equalsIgnoreCase("null"))
+ address = (String) session.getAttribute("addressSms2");
+if(address==null || address.equalsIgnoreCase("null"))
+ address = "";
+String fileName = "";
+String subject = (String) session.getAttribute("subject");
+if(subject==null || subject.equalsIgnoreCase("null"))
+subject = "simple message to myself";
+String priority = "High";
+String responseFormat = "json";
+String requestFormat = "json";
+String endpoint = FQDN + "/rest/mms/2/messaging/outbox";
+String senderAddress = shortCode1;
+
+//If Send MMS button was clicked, do this to get some parameters from the form.
+if(request.getParameter("sendMms")!=null) {
+try{
+ DiskFileUpload fu = new DiskFileUpload();
+ List fileItems = fu.parseRequest(request);
+ Iterator itr = fileItems.iterator();
+ while(itr.hasNext()) {
+ FileItem fi = (FileItem)itr.next();
+ if(!fi.isFormField()) {
+ File fNew= new File(application.getRealPath("/"), fi.getName());
+ fileName = fileName + "," + fi.getName();
+ if(!(fi.getName().equalsIgnoreCase(""))){
+ fi.write(fNew);
+ }
+ } else if(fi.getFieldName().equalsIgnoreCase("address")) {
+ address = fi.getString();
+ session.setAttribute("addressSms2",address);
+ } else if(fi.getFieldName().equalsIgnoreCase("subject")) {
+ subject = fi.getString();
+ session.setAttribute("subject",subject);
+ }
+ }
+} catch(Exception e){};
+}
+%>
+
+
+ <div id="container">
+ <!-- open HEADER -->
+ <div id="header">
+
+ <div>
+ <div id="hcRight">
+ <%=new java.util.Date()%>
+
+ </div>
+ <div id="hcLeft">Server Time:</div>
+ </div>
+ <div>
+ <div id="hcRight">
+ <script language="JavaScript" type="text/javascript">
+ var myDate = new Date();
+ document.write(myDate);
+ </script>
+ </div>
+ <div id="hcLeft">Client Time:</div>
+ </div>
+ <div>
+ <div id="hcRight">
+ <script language="JavaScript" type="text/javascript">
+ document.write("" + navigator.userAgent);
+ </script>
+ </div>
+ <div id="hcLeft">User Agent:</div>
+ </div>
+ <br clear="all" />
+ </div>
+ <!-- close HEADER -->
+
+ <div id="wrapper">
+ <div id="content">
+
+ <h1>AT&amp;T Sample MMS Application 1 - Basic MMS Service
+ Application</h1>
+ <h2>Feature 1: Send MMS Message</h2>
+
+ </div>
+ </div>
+ <form method="post" name="sendMms" enctype="multipart/form-data"
+ action="MMS.jsp?sendMms=true">
+ <div id="navigation">
+
+ <table border="0" width="100%">
+ <tbody>
+ <tr>
+ <td width="20%" valign="top" class="label">Phone:</td>
+ <td class="cell"><input maxlength="16" size="12"
+ name="address" value="<%=address%>" style="width: 90%">
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="label">Message:</td>
+ <td class="cell"><textarea rows="4" name="subject"
+ style="width: 90%"><%=subject%></textarea>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ </div>
+ <div id="extra">
+
+ <div class="warning">
+ <strong>WARNING:</strong><br /> total size of all attachments
+ cannot exceed 600 KB.
+ </div>
+
+ <table border="0" width="100%">
+ <tbody>
+ <tr>
+ <td valign="top" class="label">Attachment 1:</td>
+ <td class="cell"><input name="f1" type="file">
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="label">Attachment 2:</td>
+ <td class="cell"><input name="f2" type="file">
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="label">Attachment 3:</td>
+ <td class="cell"><input name="f3" type="file">
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <table>
+ <tbody>
+ <tr>
+ <td><button type="submit" name="sendMms">Send MMS
+ Message</button></td>
+ </tr>
+ </tbody>
+ </table>
+
+
+ </div>
+ <br clear="all" />
+ <div align="center"></div>
+ </form>
+
+ <%
+//If Send MMS button was clicked, do this.
+if(request.getParameter("sendMms")!=null) {
+ //Check for a few known formats the user could have entered the address, adjust accordingly
+ String invalidAddress = null;
+ if((address.indexOf("-")==3) && (address.length()==12))
+ address = "tel:" + address.substring(0,3) + address.substring(4,7) + address.substring(8,12);
+ else if((address.indexOf(":")==3) && (address.length()==14))
+ address = address;
+ else if((address.indexOf("-")==-1) && (address.length()==10))
+ address = "tel:" + address;
+ else if((address.indexOf("-")==-1) && (address.length()==11))
+ address = "tel:" + address.substring(1);
+ else if((address.indexOf("-")==-1) && (address.indexOf("+")==0) && (address.length()==12))
+ address = "tel:" + address.substring(2);
+ else
+ invalidAddress = "yes";
+if(invalidAddress==null) {
+ if(fileName.equalsIgnoreCase(""))
+ fileName = (String) session.getAttribute("fileName");
+
+ String attachmentsStr = fileName;
+ String[] attachments = attachmentsStr.split(",");
+
+ MediaType contentBodyType = null;
+ String requestBody = "";
+ MultiPart mPart;
+ contentBodyType = new MediaType ("multipart","related");
+
+ JSONObject requestObject = new JSONObject();
+ requestObject.put("Priority", priority);
+ requestObject.put("Address", address);
+ requestObject.put("Subject", subject);
+ requestBody += requestObject.toString();
+ mPart = new MultiPart().bodyPart(new BodyPart(requestBody,MediaType.APPLICATION_JSON_TYPE));
+ mPart.getBodyParts().get(0).getHeaders().add("Content-Transfer-Encoding", "8bit");
+ mPart.getBodyParts().get(0).getHeaders().add("Content-Disposition","form-data; name=\"root-fields\"");
+ mPart.getBodyParts().get(0).getHeaders().add("Content-ID", "<startpart>");
+ MediaType[] medTyp = new MediaType[4];
+ MediaType media = new MediaType();
+ for(int i=1;i<attachments.length; i++) {
+ java.util.Map<String, String> conttypeattr = new java.util.HashMap<String, String>();
+ conttypeattr.put("name",attachments[i]);
+ FileDataBodyPart fIlE = new FileDataBodyPart();
+ media = fIlE.getPredictor().getMediaTypeFromFileName("/" + attachments[i]);
+ medTyp[i] = new MediaType(media.getType(),media.getSubtype(),conttypeattr);
+ }
+
+ ServletContext context = getServletContext();
+ if(attachments.length == 2){
+ mPart.bodyPart(new BodyPart(context.getResourceAsStream("/" + attachments[1]), medTyp[1]));
+ mPart.getBodyParts().get(1).getHeaders().add("Content-Disposition","attachment; filename="+attachments[1]);
+ mPart.getBodyParts().get(1).getHeaders().add("Content-Transfer-Encoding","Binary");
+ mPart.getBodyParts().get(1).getHeaders().add("Content-ID",attachments[1]);
+
+ } else if(attachments.length == 3) {
+ mPart.bodyPart(new BodyPart(context.getResourceAsStream("/" + attachments[1]), medTyp[1])).bodyPart(new BodyPart(context.getResourceAsStream("/" + attachments[2]), medTyp[2]));
+ mPart.getBodyParts().get(1).getHeaders().add("Content-Disposition","attachment; filename="+attachments[1]);
+ mPart.getBodyParts().get(1).getHeaders().add("Content-Transfer-Encoding","Binary");
+ mPart.getBodyParts().get(1).getHeaders().add("Content-ID",attachments[1]);
+ mPart.getBodyParts().get(2).getHeaders().add("Content-Disposition","attachment; filename="+attachments[2]);
+ mPart.getBodyParts().get(2).getHeaders().add("Content-Transfer-Encoding","Binary");
+ mPart.getBodyParts().get(2).getHeaders().add("Content-ID",attachments[2]);
+
+
+ } else if(attachments.length == 4) {
+ mPart.bodyPart(new BodyPart(context.getResourceAsStream("/" + attachments[1]), medTyp[1])).bodyPart(new BodyPart(context.getResourceAsStream("/" + attachments[2]), medTyp[2])).bodyPart(new BodyPart(context.getResourceAsStream("/" + attachments[3]), medTyp[3]));
+ mPart.getBodyParts().get(1).getHeaders().add("Content-Disposition","attachment; filename="+attachments[1]);
+ mPart.getBodyParts().get(1).getHeaders().add("Content-Transfer-Encoding","Binary");
+ mPart.getBodyParts().get(1).getHeaders().add("Content-ID",attachments[1]);
+ mPart.getBodyParts().get(2).getHeaders().add("Content-Disposition","attachment; filename="+attachments[2]);
+ mPart.getBodyParts().get(2).getHeaders().add("Content-Transfer-Encoding","Binary");
+ mPart.getBodyParts().get(2).getHeaders().add("Content-ID",attachments[2]);
+ mPart.getBodyParts().get(3).getHeaders().add("Content-Disposition","attachment; filename="+attachments[3]);
+ mPart.getBodyParts().get(3).getHeaders().add("Content-Transfer-Encoding","Binary");
+ mPart.getBodyParts().get(3).getHeaders().add("Content-ID",attachments[3]);
+
+ }
+
+ // This currently uses a proprietary rest client to assemble the request body that does not follow SMIL standards. It is recommended to follow SMIL standards to ensure attachment delivery.
+ RestClient client;
+ client = new RestClient(endpoint, contentBodyType, MediaType.APPLICATION_JSON_TYPE);
+ client.addRequestBody(mPart);
+ String responze = client.invoke(com.att.rest.HttpMethod.POST, accessToken);
+
+ if (client.getHttpResponseCode() == 201) {
+ JSONObject rpcObject = new JSONObject(responze);
+ mmsId = rpcObject.getString("Id");
+ session.setAttribute("mmsId", mmsId);
+ %>
+ <div class="successWide">
+ <strong>SUCCESS:</strong><br /> <strong>Message ID:</strong>
+ <%=mmsId%>
+ </div>
+ <br />
+ <%
+ } else {
+ %>
+ <div class="errorWide">
+ <strong>ERROR:</strong><br />
+ <%=responze%>
+ </div>
+ <br />
+ <%
+ }
+ } else { %>
+ <div class="errorWide">
+ <strong>ERROR:</strong><br /> Invalid Address Entered
+ </div>
+ <br />
+ <% }
+}
+%>
+
+ <div id="wrapper">
+ <div id="content">
+
+ <h2>
+ <br /> Feature 2: Get Delivery Status
+ </h2>
+
+ </div>
+ </div>
+
+ <form method="post" name="getMmsDeliveryStatus" action="MMS.jsp">
+ <div id="navigation">
+
+ <table border="0" width="100%">
+ <tbody>
+ <tr>
+ <td width="20%" valign="top" class="label">Message ID:</td>
+ <td class="cell"><input size="12" name="mmsId"
+ value="<%=mmsId%>" style="width: 90%">
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ </div>
+ <div id="extra">
+
+ <table border="0" width="100%">
+ <tbody>
+ <tr>
+ <td class="cell"><button type="submit"
+ name="getMmsDeliveryStatus">Get Status</button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ </div>
+ <br clear="all" />
+ </form>
+
+ <%
+ //If Check Delivery Status button was clicked, do this.
+ if(getMmsDeliveryStatus!=null) {
+
+ String url = FQDN + "/rest/mms/2/messaging/outbox/" + mmsId;
+ HttpClient client = new HttpClient();
+ GetMethod method = new GetMethod(url);
+ method.setQueryString("access_token=" + accessToken + "&id=" + mmsId);
+ method.addRequestHeader("Accept","application/" + responseFormat);
+ method.addRequestHeader("Authorization","Bearer " + accessToken);
+
+ int statusCode = client.executeMethod(method);
+ if(statusCode==200) {
+ JSONObject jsonResponse = new JSONObject(method.getResponseBodyAsString());
+ JSONObject deliveryInfoList = new JSONObject(jsonResponse.getString("DeliveryInfoList"));
+ JSONArray deliveryInfoArray = new JSONArray(deliveryInfoList.getString("DeliveryInfo"));
+ JSONObject deliveryInfo = new JSONObject(deliveryInfoArray.getString(0));
+ %>
+ <div class="successWide">
+ <strong>SUCCESS:</strong><br /> <strong>Status:</strong>
+ <%=deliveryInfo.getString("DeliveryStatus")%><br /> <strong>Resource
+ URL:</strong>
+ <%=deliveryInfoList.getString("ResourceUrl")%><br />
+ </div>
+ <br />
+ <%
+ } else {
+ %>
+ <div class="errorWide">
+ <strong>ERROR:</strong><br />
+ <%=method.getResponseBodyAsString()%>
+ </div>
+ <br />
+ <%
+ }
+ method.releaseConnection();
+ }
+ %>
+
+ <div id="footer">
+
+ <div
+ style="float: right; width: 20%; font-size: 9px; text-align: right">Powered
+ by AT&amp;T Cloud Architecture</div>
+ <p>
+ &#169; 2012 AT&amp;T Intellectual Property. All rights reserved. <a
+ href="http://developer.att.com/" target="_blank">http://developer.att.com</a>
+ <br> The Application hosted on this site are working examples
+ intended to be used for reference in creating products to consume
+ AT&amp;T Services and not meant to be used as part of your product.
+ The data in these pages is for test purposes only and intended only
+ for use as a reference in how the services perform. <br> For
+ download of tools and documentation, please go to <a
+ href="https://devconnect-api.att.com/" target="_blank">https://devconnect-api.att.com</a>
+ <br> For more information contact <a
+ href="mailto:developer.support@att.com">developer.support@att.com</a>
+ </div>
+ </div>
+
+</body>
+</html>
View
12 MMS/Java/app1/OauthStorage.jsp
@@ -1,9 +1,9 @@
-<!--
-Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
-Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
-For more information contact developer.support@att.com
--->
+<%
+//Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
+//TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
+//Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
+//For more information contact developer.support@att.com
+%>
<%
String savedAccessToken = "";
View
21 MMS/Java/app1/README.txt
@@ -1,15 +1,16 @@
-<!--
+<%--
Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
For more information contact developer.support@att.com
--->
+--%>
- AT&T API Samples - MMS app 1
+
+ AT&T API Platform Samples - MMS app 1
------------------------------
-This file describes how to set up, configure and run the Java Applications of the AT&T HTML5 Program sample applications.
-It covers all steps required to register the application on DevConnect and, based on the generated API keys and secrets,
+This file describes how to set-up, configure and run the Java Applications using AT&T API Platform services.
+It covers all steps required to register the application, based on the generated API keys and secrets,
create and run one's own full-fledged sample applications.
1. Configuration
@@ -28,15 +29,10 @@ create and run one's own full-fledged sample applications.
Fill in the form, in particular all fields marked as "required".
- Be careful while filling in the "OAuth Redirect URL" field. It should contain the URL that the oAuth provider will redirect
- users to when he/she successfully authenticates and authorizes your application. For this application, it should point to
- the oauth.jsp file inside this application folder. For example, if running on a local machine in a default Tomcat installation,
- your OAuth Redirect URL might be http://localhost:8080/SampleApp/oauth.jsp
-
NOTE: You MUST select MMS in the list of services under field 'Services' in order to use this sample application code.
Having your application registered, you will get back an important pair of data: an API key and Secret key. They are
- necessary to get your applications working with the AT&T HTML5 APIs. See 'Adjusting parameters' below to learn how to use
+ necessary to get your applications working with the AT&T APIs. See 'Adjusting parameters' below to learn how to use
these keys.
Initially your newly registered application is restricted to the "Sandbox" environment only. To move it to production,
@@ -56,8 +52,7 @@ NOTE: You MUST select MMS in the list of services under field 'Services' in orde
** Setting up multiple sample applications simultaneously
- In case multiple applications need to be run at the same time, make sure to put each app in a separate folder and
- adjust your OAuth Redirect URL accordingly.
+ In case multiple applications need to be run at the same time, make sure to put each app in a separate folders.
3. Parameters
View
BIN  MMS/Java/app1/WEB-INF/classes/com/att/rest/RestClient.class
Binary file not shown
View
14 MMS/Java/app1/config.jsp
@@ -1,13 +1,13 @@
-<!--
-Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
-Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
-For more information contact developer.support@att.com
--->
+<%
+//Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
+//TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
+//Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
+//For more information contact developer.support@att.com
+%>
<%
String clientIdAut = "";
String clientSecretAut = "";
String shortCode1 = "";
-String FQDN = "https://api.att.com";
+String FQDN = "";
%>
View
9 MMS/Java/app1/getToken.jsp
@@ -1,3 +1,10 @@
+<%
+//Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
+//TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
+//Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
+//For more information contact developer.support@att.com
+%>
+
<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
<%@ page import="org.apache.commons.httpclient.*"%>
<%@ page import="org.apache.commons.httpclient.methods.*"%>
@@ -37,7 +44,6 @@ Long date = System.currentTimeMillis();
{
savedAccessTokenExpiry = date + (Long.parseLong("3155692597470")); //100 years
}
- //savedAccessTokenExpiry = date + (Long.parseLong(expires_in)*1000);
savedRefreshTokenExpiry = date + Long.parseLong("86400000");
method.releaseConnection();
PrintWriter outWrite = new PrintWriter(new BufferedWriter(new FileWriter(application.getRealPath("/OauthStorage.jsp"))), false);
@@ -62,7 +68,6 @@ Long date = System.currentTimeMillis();
savedRefreshTokenExpiry = date + (Long.parseLong("86400000")); //24 hours
}
savedAccessTokenExpiry = date + (Long.parseLong(expires_in)*1000);
- //savedRefreshTokenExpiry = date + Long.parseLong("86400000");
method.releaseConnection();
PrintWriter outWrite = new PrintWriter(new BufferedWriter(new FileWriter(application.getRealPath("/OauthStorage.jsp"))), false);
String toSave = "\u003C\u0025\nString savedAccessToken = \"" + accessToken + "\";\nLong savedAccessTokenExpiry = Long.parseLong(\"" + savedAccessTokenExpiry + "\");\nString savedRefreshToken = \"" + refreshToken + "\";\nLong savedRefreshTokenExpiry = Long.parseLong(\"" + savedRefreshTokenExpiry + "\");\n\u0025\u003E";
View
454 MMS/Java/app2/MMS2.jsp
@@ -1,34 +1,44 @@
+<%
+//Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
+//TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
+//Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
+//For more information contact developer.support@att.com
+%>
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en"><head>
- <title>AT&amp;T Sample MMS Application 2 - MMS Coupon Application</title>
- <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
- <link rel="stylesheet" type="text/css" href="style/common.css"/ >
- <script type="text/javascript" src="js/helper.js">
+<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
+<head>
+<title>AT&amp;T Sample MMS Application 2 - MMS Coupon
+ Application</title>
+<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
+<link rel="stylesheet" type="text/css" href="style/common.css"/ >
+<script type="text/javascript" src="js/helper.js">
+
</script>
<body>
-<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
-<%@ page import="com.sun.jersey.multipart.file.*" %>
-<%@ page import="com.sun.jersey.multipart.BodyPart" %>
-<%@ page import="com.sun.jersey.multipart.MultiPart" %>
-<%@ page import="java.io.*" %>
-<%@ page import="java.util.List" %>
-<%@ page import="com.att.rest.*" %>
-<%@ page import="java.net.*" %>
-<%@ page import="javax.ws.rs.core.*" %>
-<%@ page import="org.apache.commons.fileupload.*"%>
-<%@ page import="java.util.List,java.util.Iterator"%>
-<%@ page import="org.apache.commons.httpclient.*"%>
-<%@ page import="org.apache.commons.httpclient.methods.*"%>
-<%@ page import="org.json.*"%>
-<%@ page import="org.w3c.dom.*" %>
-<%@ page import="javax.xml.parsers.*" %>
-<%@ page import="javax.xml.transform.*" %>
-<%@ page import="javax.xml.transform.stream.*" %>
-<%@ page import="javax.xml.transform.dom.*" %>
-<%@ include file="getToken.jsp" %>
-
-<%
+ <%@ page contentType="text/html; charset=iso-8859-1" language="java"%>
+ <%@ page import="com.sun.jersey.multipart.file.*"%>
+ <%@ page import="com.sun.jersey.multipart.BodyPart"%>
+ <%@ page import="com.sun.jersey.multipart.MultiPart"%>
+ <%@ page import="java.io.*"%>
+ <%@ page import="java.util.List"%>
+ <%@ page import="com.att.rest.*"%>
+ <%@ page import="java.net.*"%>
+ <%@ page import="javax.ws.rs.core.*"%>
+ <%@ page import="org.apache.commons.fileupload.*"%>
+ <%@ page import="java.util.List,java.util.Iterator"%>
+ <%@ page import="org.apache.commons.httpclient.*"%>
+ <%@ page import="org.apache.commons.httpclient.methods.*"%>
+ <%@ page import="org.json.*"%>
+ <%@ page import="org.w3c.dom.*"%>
+ <%@ page import="javax.xml.parsers.*"%>
+ <%@ page import="javax.xml.transform.*"%>
+ <%@ page import="javax.xml.transform.stream.*"%>
+ <%@ page import="javax.xml.transform.dom.*"%>
+ <%@ include file="getToken.jsp"%>
+
+ <%
String sendMms = request.getParameter("sendMms");
String getMmsDeliveryStatus = request.getParameter("getMmsDeliveryStatus");
@@ -40,105 +50,113 @@ String endpoint = FQDN + "/rest/mms/2/messaging/outbox";
RandomAccessFile inFile1 = new RandomAccessFile(application.getRealPath("message.txt"),"rw");
String subject = inFile1.readLine();
inFile1.close();
-String readAddresses = request.getParameter("address");
+String readAddresses = "";
+if (request.getParameter("address")!=null)
+ readAddresses= request.getParameter("address");
String[] address = new String[10];
-//https://api-uat.san2.attcompute.com/rest/mms/2/messaging/outbox?format=xml&
-//Address=tel:4089818261&Priority=High&Subject=Attachment is being sent
-
-if(readAddresses!=null && !readAddresses.equalsIgnoreCase("null")){
+if (!readAddresses.isEmpty()) {
address = readAddresses.split(",");
}
-if(readAddresses==null) {
- readAddresses = "";
- }
-
+
String mmsId = (String) session.getAttribute("mmsId");
%>
-<div id="container">
-<!-- open HEADER --><div id="header">
-
-<div>
- <div id="hcRight">
- <%=new java.util.Date()%>
- </div>
- <div id="hcLeft">Server Time:</div>
-</div>
-<div>
- <div id="hcRight"><script language="JavaScript" type="text/javascript">
-var myDate = new Date();
-document.write(myDate);
-</script></div>
- <div id="hcLeft">Client Time:</div>
-</div>
-<div>
- <div id="hcRight"><script language="JavaScript" type="text/javascript">
-document.write("" + navigator.userAgent);
-</script></div>
- <div id="hcLeft">User Agent:</div>
-</div>
-<br clear="all" />
-</div><!-- close HEADER -->
-
-<div id="wrapper">
-<div id="content">
-
-<h1>AT&amp;T Sample MMS Application 2 - MMS Coupon Application</h1>
-<h2>Feature 1: Send coupon image to list of subscribers</h2>
-
-</div>
-</div>
-<form method="post" name="sendMms">
-<div id="navigation">
-
-<table border="0" width="100%">
- <tbody>
- <tr>
- <td width="20%" valign="top" class="label">Phone:</td>
- <td class="cell"><input size="20" name="address" value="<%=readAddresses%>" style="width: 90%">
- </td>
- </tr>
- <tr>
- <td valign="top" class="label">Subject:</td>
- <td class="cell"><%=subject%></td>
- </tr>
- </tbody></table>
-
-<div class="warning">
-<strong>WARNING:</strong><br />
-total size of all attachments cannot exceed 600 KB.
-</div>
-
-</div>
-<div id="extra">
-
-<table border="0" width="100%">
- <tbody>
- <tr>
- <td valign="top" class="label">Attachment:</td>
- <td class="cell"><div style="width: 250px; background: #fc9; border: 3px double #006; text-align: center; padding: 25px"><em><img width="250px" src="coupon.jpg" /></em></div>
- </td>
- </tr>
- </tbody></table>
- <table>
- <tbody>
- <tr>
- <td><br /><button type="submit" name="sendMms">Send Coupon</button></td>
- </tr>
- </tbody></table>
-
-
-</div>
-<br clear="all" />
-<div align="center"></div>
-</form>
-
-<%
+ <div id="container">
+ <!-- open HEADER -->
+ <div id="header">
+
+ <div>
+ <div id="hcRight">
+ <%=new java.util.Date()%>
+ </div>
+ <div id="hcLeft">Server Time:</div>
+ </div>
+ <div>
+ <div id="hcRight">
+ <script language="JavaScript" type="text/javascript">
+ var myDate = new Date();
+ document.write(myDate);
+ </script>
+ </div>
+ <div id="hcLeft">Client Time:</div>
+ </div>
+ <div>
+ <div id="hcRight">
+ <script language="JavaScript" type="text/javascript">
+ document.write("" + navigator.userAgent);
+ </script>
+ </div>
+ <div id="hcLeft">User Agent:</div>
+ </div>
+ <br clear="all" />
+ </div>
+ <!-- close HEADER -->
+
+ <div id="wrapper">
+ <div id="content">
+
+ <h1>AT&amp;T Sample MMS Application 2 - MMS Coupon Application</h1>
+ <h2>Feature 1: Send coupon image to list of subscribers</h2>
+
+ </div>
+ </div>
+ <form method="post" name="sendMms">
+ <div id="navigation">
+
+ <table border="0" width="100%">
+ <tbody>
+ <tr>
+ <td width="20%" valign="top" class="label">Phone:</td>
+ <td class="cell"><input size="20" name="address"
+ value="<%=readAddresses%>" style="width: 90%">
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="label">Subject:</td>
+ <td class="cell"><%=subject%></td>
+ </tr>
+ </tbody>
+ </table>
+
+ <div class="warning">
+ <strong>WARNING:</strong><br /> total size of all attachments
+ cannot exceed 600 KB.
+ </div>
+
+ </div>
+ <div id="extra">
+
+ <table border="0" width="100%">
+ <tbody>
+ <tr>
+ <td valign="top" class="label">Attachment:</td>
+ <td class="cell"><div
+ style="width: 250px; background: #fc9; border: 3px double #006; text-align: center; padding: 25px">
+ <em><img width="250px" src="coupon.jpg" /> </em>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <table>
+ <tbody>
+ <tr>
+ <td><br />
+ <button type="submit" name="sendMms">Send Coupon</button></td>
+ </tr>
+ </tbody>
+ </table>
+
+
+ </div>
+ <br clear="all" />
+ <div align="center"></div>
+ </form>
+
+ <%
//If Send MMS button was clicked, do this.
-//https://api-uat.san2.attcompute.com/rest/mms/2/messaging/outbox?format=xml&
-//Address=tel:4089818261&Priority=High&Subject=Attachment is being sent
if(request.getParameter("sendMms")!=null) {
@@ -146,18 +164,22 @@ if(request.getParameter("sendMms")!=null) {
MediaType contentBodyType = null;
String requestBody = "";
- contentBodyType = MediaType.MULTIPART_FORM_DATA_TYPE;
+ contentBodyType = new MediaType("multipart","related");
FileDataBodyPart fIlE = new FileDataBodyPart();
- MediaType medTyp = fIlE.getPredictor().getMediaTypeFromFileName("/" + attachment);
-
+
+ java.util.Map<String, String> conttypeattr = new java.util.HashMap<String, String>();
+ conttypeattr.put("name",attachment);
+ MediaType media = fIlE.getPredictor().getMediaTypeFromFileName("/" + attachment);
+ MediaType medTyp = new MediaType(media.getType(),media.getSubtype(),conttypeattr);
+
+
ServletContext context = getServletContext();
// This currently uses a proprietary rest client to assemble the request body that does not follow SMIL standards. It is recommended to follow SMIL standards to ensure attachment delivery.
RestClient client = new RestClient(endpoint, contentBodyType, MediaType.APPLICATION_JSON_TYPE);
- client.addParameter("access_token", accessToken);
JSONObject requestObject = new JSONObject();
String responze ="";
@@ -172,7 +194,6 @@ if(request.getParameter("sendMms")!=null) {
}
requestObject.put("Priority", priority);
requestObject.put("Subject", subject);
- requestObject.put("content-type", "image/jpeg");
requestBody += requestObject.toString();
MultiPart mPart = new MultiPart().bodyPart(new BodyPart(requestBody,MediaType.APPLICATION_JSON_TYPE));
mPart.bodyPart(new BodyPart(context.getResourceAsStream(attachment), medTyp));
@@ -180,63 +201,66 @@ if(request.getParameter("sendMms")!=null) {
mPart.getBodyParts().get(0).getHeaders().add("Content-Transfer-Encoding", "8bit");
mPart.getBodyParts().get(0).getHeaders().add("Content-Disposition","form-data; name=\"root-fields\"");
mPart.getBodyParts().get(0).getHeaders().add("Content-ID", "<startpart>");
-
+ mPart.getBodyParts().get(1).getHeaders().add("Content-Disposition","attachment; filename="+attachment);
+ mPart.getBodyParts().get(1).getHeaders().add("Content-Transfer-Encoding","Binary");
+ mPart.getBodyParts().get(1).getHeaders().add("Content-ID",attachment);
+
client.addRequestBody(mPart);
- responze = client.invoke(com.att.rest.HttpMethod.POST, true);
+ responze = client.invoke(com.att.rest.HttpMethod.POST, accessToken);
if (client.getHttpResponseCode() == 201) {
JSONObject rpcObject = new JSONObject(responze);
mmsId = rpcObject.getString("Id");
session.setAttribute("mmsId", mmsId);
%>
- <div class="successWide">
- <strong>SUCCESS:</strong><br />
- <strong>Message ID:</strong> <%=mmsId%>
- </div>
- <br />
- <%
+ <div class="successWide">
+ <strong>SUCCESS:</strong><br /> <strong>Message ID:</strong>
+ <%=mmsId%>
+ </div>
+ <br />
+ <%
} else {
%>
- <div class="errorWide">
- <strong>ERROR:</strong><br />
- <%=responze%>
- </div>
- <br />
- <%
+ <div class="errorWide">
+ <strong>ERROR:</strong><br />
+ <%=responze%>
+ </div>
+ <br />
+ <%
}
%>
- </table>
- <%
+ </table>
+ <%
}
%>
-<div id="wrapper">
-<div id="content">
-
-<h2><br />
-Feature 2: Check Delivery Status for each Recipient</h2>
-
-</div>
-</div>
-<div id="navigation">
-<form method="post">
-<table border="0" width="100%">
- <tbody>
- <tr>
- <td class="cell"><button type="submit" name="getMmsDeliveryStatus">Check Status</button>
- </td>
- </tr>
- </tbody></table>
-
-</div>
-<div id="extra">
-
-</div>
-<br clear="all" />
-</form>
-
- <%
+ <div id="wrapper">
+ <div id="content">
+
+ <h2>
+ <br /> Feature 2: Check Delivery Status for each Recipient
+ </h2>
+
+ </div>
+ </div>
+ <div id="navigation">
+ <form method="post">
+ <table border="0" width="100%">
+ <tbody>
+ <tr>
+ <td class="cell"><button type="submit"
+ name="getMmsDeliveryStatus">Check Status</button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div id="extra"></div>
+ <br clear="all" />
+ </form>
+
+ <%
//If Check Delivery Status button was clicked, do this.
if(getMmsDeliveryStatus!=null) {
@@ -252,61 +276,67 @@ Feature 2: Check Delivery Status for each Recipient</h2>
JSONArray deliveryInfoArray = new JSONArray(deliveryInfoList.getString("DeliveryInfo"));
JSONObject deliveryInfo = new JSONObject(deliveryInfoArray.getString(0));
%>
- <div class="successWide">
- <strong>SUCCESS:</strong><br />
- Messages Delivered
- </div>
- <br />
-
- <div align="center">
- <table width="500" cellpadding="1" cellspacing="1" border="0">
- <thead>
- <tr>
- <th width="50%" class="label">Recipient</th>
- <th width="50%" class="label">Status</th>
- </tr>
- </thead>
- <tbody>
- <%
+ <div class="successWide">
+ <strong>SUCCESS:</strong><br /> Messages Delivered
+ </div>
+ <br />
+
+ <div align="center">
+ <table width="500" cellpadding="1" cellspacing="1" border="0">
+ <thead>
+ <tr>
+ <th width="50%" class="label">Recipient</th>
+ <th width="50%" class="label">Status</th>
+ </tr>
+ </thead>
+ <tbody>
+ <%
for(int j=0; j<deliveryInfoArray.length(); j++) {
deliveryInfo = new JSONObject(deliveryInfoArray.getString(j));
%>
- <tr>
- <td class="cell" align="center"><%=deliveryInfo.getString("Address")%></td>
- <td class="cell" align="center"><%=deliveryInfo.getString("DeliveryStatus")%></td>
- </tr>
- <%
+ <tr>
+ <td class="cell" align="center"><%=deliveryInfo.getString("Address")%></td>
+ <td class="cell" align="center"><%=deliveryInfo.getString("DeliveryStatus")%></td>
+ </tr>
+ <%
}
%>
- </tbody>
- </table>
- </div></form>
- <%
+ </tbody>
+ </table>
+ </div>
+ </form>
+ <%
} else {
%>
- <div class="errorWide">
- <strong>ERROR:</strong><br />
- <%=method.getResponseBodyAsString()%>
- </div>
- <%
+ <div class="errorWide">
+ <strong>ERROR:</strong><br />
+ <%=method.getResponseBodyAsString()%>
+ </div>
+ <%
}
method.releaseConnection();
}
- %>
-
-<div id="footer">
-
- <div style="float: right; width: 20%; font-size: 9px; text-align: right">Powered by AT&amp;T Cloud Architecture</div>
- <p>&#169; 2012 AT&amp;T Intellectual Property. All rights reserved. <a href="http://developer.att.com/" target="_blank">http://developer.att.com</a>
-<br>
-The Application hosted on this site are working examples intended to be used for reference in creating products to consume AT&amp;T Services and not meant to be used as part of your product. The data in these pages is for test purposes only and intended only for use as a reference in how the services perform.
-<br>
-For download of tools and documentation, please go to <a href="https://devconnect-api.att.com/" target="_blank">https://devconnect-api.att.com</a>
-<br>
-For more information contact <a href="mailto:developer.support@att.com">developer.support@att.com</a>
-
-</div>
-</div>
-
-</body></html>
-
+ %>
+
+ <div id="footer">
+
+ <div
+ style="float: right; width: 20%; font-size: 9px; text-align: right">Powered
+ by AT&amp;T Cloud Architecture</div>
+ <p>
+ &#169; 2012 AT&amp;T Intellectual Property. All rights reserved. <a
+ href="http://developer.att.com/" target="_blank">http://developer.att.com</a>
+ <br> The Application hosted on this site are working examples
+ intended to be used for reference in creating products to consume
+ AT&amp;T Services and not meant to be used as part of your product.
+ The data in these pages is for test purposes only and intended only
+ for use as a reference in how the services perform. <br> For
+ download of tools and documentation, please go to <a
+ href="https://devconnect-api.att.com/" target="_blank">https://devconnect-api.att.com</a>
+ <br> For more information contact <a
+ href="mailto:developer.support@att.com">developer.support@att.com</a>
+ </div>
+ </div>
+
+</body>
+</html>
View
7 MMS/Java/app2/OauthStorage.jsp
@@ -1,3 +1,10 @@
+<%
+//Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
+//TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
+//Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
+//For more information contact developer.support@att.com
+%>
+
<%
String savedAccessToken = "";
Long savedAccessTokenExpiry = Long.parseLong("1");
View
26 MMS/Java/app2/README.txt
@@ -1,9 +1,15 @@
-
- AT&T API Samples - MMS app 2
+<%--
+Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
+Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
+For more information contact developer.support@att.com
+--%>
+
+ AT&T API Platform Samples - MMS app 2
------------------------------
-This file describes how to set up, configure and run the Java Applications of the AT&T HTML5 Program sample applications.
-It covers all steps required to register the application on DevConnect and, based on the generated API keys and secrets,
+This file describes how to set-up, configure and run the Java Applications using AT&T API Platform services.
+It covers all steps required to register the application, based on the generated API keys and secrets,
create and run one's own full-fledged sample applications.
1. Configuration
@@ -22,15 +28,10 @@ create and run one's own full-fledged sample applications.
Fill in the form, in particular all fields marked as "required".
- Be careful while filling in the "OAuth Redirect URL" field. It should contain the URL that the oAuth provider will redirect
- users to when he/she successfully authenticates and authorizes your application. For this application, it should point to
- the oauth.jsp file inside this application folder. For example, if running on a local machine in a default Tomcat installation,
- your OAuth Redirect URL might be http://localhost:8080/SampleApp/oauth.jsp
-
NOTE: You MUST select MMS in the list of services under field 'Services' in order to use this sample application code.
Having your application registered, you will get back an important pair of data: an API key and Secret key. They are
- necessary to get your applications working with the AT&T HTML5 APIs. See 'Adjusting parameters' below to learn how to use
+ necessary to get your applications working with the AT&T APIs. See 'Adjusting parameters' below to learn how to use
these keys.
Initially your newly registered application is restricted to the "Sandbox" environment only. To move it to production,
@@ -50,8 +51,7 @@ NOTE: You MUST select MMS in the list of services under field 'Services' in orde
** Setting up multiple sample applications simultaneously
- In case multiple applications need to be run at the same time, make sure to put each app in a separate folder and
- adjust your OAuth Redirect URL accordingly.
+ In case multiple applications need to be run at the same time, make sure to put each app in a separate folders.
3. Parameters
@@ -62,7 +62,7 @@ Please populate the following parameters in config.jsp as specified below:
2) clientSecretAut : {set the value as per your registered appliaction 'Secret key' field value}
-3) FQDN : https://api.att.com
+3) FQDN : https://api.att.com
4) shortCode1 : short-code 1
View
BIN  MMS/Java/app2/WEB-INF/classes/com/att/rest/RestClient.class
Binary file not shown
View
9 MMS/Java/app2/config.jsp
@@ -1,6 +1,13 @@
+<%
+//Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
+//TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
+//Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
+//For more information contact developer.support@att.com
+%>
+
<%
String clientIdAut = "";
String clientSecretAut = "";
String shortCode1 = "";
-String FQDN = "https://api.att.com";
+String FQDN = "";
%>
View
11 MMS/Java/app2/getToken.jsp
@@ -1,3 +1,10 @@
+<%
+//Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
+//TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
+//Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
+//For more information contact developer.support@att.com
+%>
+
<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
<%@ page import="org.apache.commons.httpclient.*"%>
<%@ page import="org.apache.commons.httpclient.methods.*"%>
@@ -32,12 +39,11 @@ Long date = System.currentTimeMillis();
accessToken = rpcObject.getString("access_token");
refreshToken = rpcObject.getString("refresh_token");
expires_in = rpcObject.getString("expires_in");
-
+
if (expires_in.equals("0"))
{
savedAccessTokenExpiry = date + (Long.parseLong("3155692597470")); //100 years
}
- //savedAccessTokenExpiry = date + (Long.parseLong(expires_in)*1000);
savedRefreshTokenExpiry = date + Long.parseLong("86400000");
method.releaseConnection();
PrintWriter outWrite = new PrintWriter(new BufferedWriter(new FileWriter(application.getRealPath("/OauthStorage.jsp"))), false);
@@ -62,7 +68,6 @@ Long date = System.currentTimeMillis();
savedRefreshTokenExpiry = date + (Long.parseLong("86400000")); //24 hours
}
savedAccessTokenExpiry = date + (Long.parseLong(expires_in)*1000);
- //savedRefreshTokenExpiry = date + Long.parseLong("86400000");
method.releaseConnection();
PrintWriter outWrite = new PrintWriter(new BufferedWriter(new FileWriter(application.getRealPath("/OauthStorage.jsp"))), false);
String toSave = "\u003C\u0025\nString savedAccessToken = \"" + accessToken + "\";\nLong savedAccessTokenExpiry = Long.parseLong(\"" + savedAccessTokenExpiry + "\");\nString savedRefreshToken = \"" + refreshToken + "\";\nLong savedRefreshTokenExpiry = Long.parseLong(\"" + savedRefreshTokenExpiry + "\");\n\u0025\u003E";
View
22 MMS/Java/app3/MMS3.jsp
@@ -1,7 +1,14 @@
+<%--
+Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
+Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
+For more information contact developer.support@att.com
+--%>
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en"><head>
<title>AT&T Sample MMS Application 3 - MMS Gallery Application</title>
- <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
+ <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
<link rel="stylesheet" type="text/css" href="style/common.css"/ >
<script type="text/javascript" src="js/helper.js">
</script>
@@ -24,7 +31,7 @@
<div id="hcRight">
<%=new java.util.Date()%>
</div>
- <div id="hcLeft">Server Time:</div>
+ <div id="hcLeft">Server Time:</div>
</div>
<div>
<div id="hcRight"><script language="JavaScript" type="text/javascript">
@@ -70,11 +77,14 @@ String totalNumberOfImagesSent = jsonResponse.getString("totalNumberOfImagesSent
<div id="gallerywrapper">
<%
-for(int i=0; i<10; i++) {
+for(int i=0; i<imageList.length(); i++) {
JSONObject image = new JSONObject(imageList.getString(i));
%>
<div id="gallery"><img src="<%=image.getString("path")%>" width="150" border="0" /><br /><strong>Sent from:</strong> <%=image.getString("senderAddress")%><br /><strong>On:</strong> <%=image.getString("date")%><div><%=image.getString("text")%></div></div>
<%
+if (i==10) {
+ break;
+}
}
method.releaseConnection();
%>
@@ -84,8 +94,8 @@ method.releaseConnection();
<div id="footer">
- <div style="float: right; width: 20%; font-size: 9px; text-align: right">Powered by AT&amp;T Virtual Mobile</div>
- <p>&#169; 2011 AT&amp;T Intellectual Property. All rights reserved. <a href="http://developer.att.com/" target="_blank">http://developer.att.com</a>
+ <div style="float: right; width: 20%; font-size: 9px; text-align: right">Powered by AT&amp;T Cloud Architecture</div>
+ <p>&#169; 2012 AT&amp;T Intellectual Property. All rights reserved. <a href="http://developer.att.com/" target="_blank">http://developer.att.com</a>
<br>
The Application hosted on this site are working examples intended to be used for reference in creating products to consume AT&amp;T Services and not meant to be used as part of your product. The data in these pages is for test purposes only and intended only for use as a reference in how the services perform.
<br>
@@ -96,4 +106,4 @@ For more information contact <a href="mailto:developer.support@att.com">develope
</div>
</div>
-</body></html>
+</body></html>
View
11 MMS/Java/app3/OauthStorage.jsp
@@ -1,6 +1,13 @@
+<%--
+Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
+Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
+For more information contact developer.support@att.com
+--%>
+
<%
String savedAccessToken = "";
Long savedAccessTokenExpiry = Long.parseLong("1");
String savedRefreshToken = "";
-Long savedRefreshTokenExpiry = Long.parseLong("");
-%>
+Long savedRefreshTokenExpiry = Long.parseLong("1");
+%>
View
25 MMS/Java/app3/README.txt
@@ -1,11 +1,18 @@
-
- AT&T API Samples - MMS app 3
- ------------------------------
-
-This file describes how to set up, configure and run the Java Applications of the AT&T HTML5 Program sample applications.
-It covers all steps required to register the application on DevConnect and, based on the generated API keys and secrets,
+<%--
+Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
+Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
+For more information contact developer.support@att.com
+--%>
+
+ AT&T API Platform Samples - MMS app 3
+ ---------------------------------------
+
+This file describes how to set-up, configure and run the Java Applications using AT&T API Platform services.
+It covers all steps required to register the application, based on the generated API keys and secrets,
create and run one's own full-fledged sample applications.
+
1. Configuration
2. Installation
3. Parameters
@@ -14,7 +21,7 @@ create and run one's own full-fledged sample applications.
1. Configuration
- Configuration consists of a few steps necessary to get an application registered on DevConnect with the proper services and
+ Configuration consists of a few steps necessary to get an application registered with the proper services and
endpoints, depending on the type of client-side application (autonomous/non-autonomous).
To register an application, go to https://devconnect-api.att.com/ and login with your valid username and password.
@@ -35,7 +42,7 @@ create and run one's own full-fledged sample applications.
NOTE: You MUST select MMS in the list of services under field 'Services' in order to use this sample application code.
Having your application registered, you will get back an important pair of data: an API key and Secret key. They are
- necessary to get your applications working with the AT&T HTML5 APIs. See 'Adjusting parameters' below to learn how to use
+ necessary to get your applications working with the AT&T APIs. See 'Adjusting parameters' below to learn how to use
these keys.
Initially your newly registered application is restricted to the "Sandbox" environment only. To move it to production,
@@ -67,7 +74,7 @@ Please populate the following parameters in config.jsp as specified below:
2) clientSecretAut : {set the value as per your registered appliaction 'Secret key' field value}
-3) FQDN : https://api.att.com
+3) FQDN : https://api.att.com
4) shortCode1 : short-code 1
View
8 MMS/Java/app3/config.jsp
@@ -1,6 +1,12 @@
+<%--
+Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
+Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
+For more information contact developer.support@att.com
+--%>
+
<%
String clientIdAut = "";
-String clientSecretAut = "";
String shortCode1 = "";
String shortCode2 = "";
String FQDN = "https://api.att.com";
View
7 MMS/Java/app3/getImageData.jsp
@@ -1,3 +1,10 @@
+<%--
+Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
+Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
+For more information contact developer.support@att.com
+--%>
+
<%@ page contentType="application/json" language="java" %><%@ page import="java.io.*" %><%@ page import="java.util.Arrays" %><%@ page import="java.util.Collections" %><%@ page import="java.util.Comparator" %><%@ include file="config.jsp" %><%
String senderAddress = "";
String date = "";
View
17 MMS/Java/app3/mmslistener.jsp
@@ -1,9 +1,9 @@
-<!--
-Licensed by AT&T under 'Software Development Kit Tools Agreement.' September 2011
+<%--
+Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
-Copyright 2011 AT&T Intellectual Property. All rights reserved. http://developer.att.com
+Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
For more information contact developer.support@att.com
--->
+--%>
<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
<%@ page import="java.util.*" %>
@@ -32,6 +32,8 @@ while ((letti = is.read(buf)) > 0)
baos.write(buf, 0, letti);
data = new String(baos.toByteArray());
+System.out.print(data);
+
String senderAddress = data.split("<SenderAddress>tel:")[1].split("</SenderAddress>")[0].substring(2);
Date d = new Date();
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);
@@ -45,6 +47,8 @@ String[] lowerParts = parts[2].split("BASE64");
String type = lowerParts[0].split("image/")[1].split(";")[0];
byte[] outFile = Base64.decodeBase64(lowerParts[1]);
int random = (int)(Math.random()*10000000);
+
+
FileOutputStream fous = new FileOutputStream(application.getRealPath("/MoMmsImages/"+random+"."+type));
fous.write(outFile);
fous.close();
@@ -66,7 +70,8 @@ PrintWriter outWrite = new PrintWriter(new BufferedWriter(new FileWriter(applica
String toSave = senderAddress + "\n" + date + "\n" + decodedText;
outWrite.write(toSave);
outWrite.close();
-}catch(Exception e){
+}
+catch(Exception e){
}
-%>
+%>
View
3  MMS/PHP/app1/config.php
@@ -1,5 +1,5 @@
<!--
-Licensed by AT&T under 'Software Development Kit Tools Agreement.' June 2012
+Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2012
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
Copyright 2012 AT&T Intellectual Property. All rights reserved. http://developer.att.com
For more information contact developer.support@att.com
@@ -13,7 +13,6 @@
$scope = "MMS";
$attachment_dir = "attachment";
$oauth_file = "/tmp/mmsoauthtoken.php";
- $default_address = "425-802-8620";
$default_subject = "simple message to myself";
?>
View
23 MMS/PHP/app1/index.php
@@ -1,5 +1,5 @@