Skip to content

Commit 7057394

Browse files
author
Reza Rahman
committed
Cleanup
1 parent 8a84a1c commit 7057394

4 files changed

Lines changed: 161 additions & 38 deletions

File tree

actionbazaar/src/main/java/com/actionbazaar/interfaces/rest/RestConfiguration.java

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1+
/*
2+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3+
*
4+
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
5+
*
6+
* The contents of this file are subject to the terms of either the GNU
7+
* General Public License Version 2 only ("GPL") or the Common Development
8+
* and Distribution License("CDDL") (collectively, the "License"). You
9+
* may not use this file except in compliance with the License. You can
10+
* obtain a copy of the License at
11+
* http://glassfish.java.net/public/CDDL+GPL_1_1.html
12+
* or packager/legal/LICENSE.txt. See the License for the specific
13+
* language governing permissions and limitations under the License.
14+
*
15+
* When distributing the software, include this License Header Notice in each
16+
* file and include the License file at packager/legal/LICENSE.txt.
17+
*
18+
* GPL Classpath Exception:
19+
* Oracle designates this particular file as subject to the "Classpath"
20+
* exception as provided by Oracle in the GPL Version 2 section of the License
21+
* file that accompanied this code.
22+
*
23+
* Modifications:
24+
* If applicable, add the following below the License Header, with the fields
25+
* enclosed by brackets [] replaced by your own identifying information:
26+
* "Portions Copyright [year] [name of copyright owner]"
27+
*
28+
* Contributor(s):
29+
* If you wish your version of this file to be governed by only the CDDL or
30+
* only the GPL Version 2, indicate your decision by adding "[Contributor]
31+
* elects to include this software in this distribution under the [CDDL or GPL
32+
* Version 2] license." If you don't indicate a single choice of license, a
33+
* recipient has the option to distribute your version of this file under
34+
* either the CDDL, the GPL Version 2 or to extend the choice of license to
35+
* its licensees as provided above. However, if you add GPL Version 2 code
36+
* and therefore, elected the GPL Version 2 license, then the option applies
37+
* only if the new code is made subject to such option by the copyright
38+
* holder.
39+
*/
140
package com.actionbazaar.interfaces.rest;
241

342
import javax.ws.rs.ApplicationPath;
@@ -13,4 +52,4 @@ public RestConfiguration() {
1352
// Resource
1453
packages(new String[]{BidRestService.class.getPackage().getName()}); // removed.
1554
}
16-
}
55+
}

actionbazaar/src/main/java/com/actionbazaar/interfaces/socket/ChatMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,4 @@ public void destroy() {
111111
public String toString() {
112112
return "ChatMessage{" + "user=" + user + ", message=" + message + '}';
113113
}
114-
}
114+
}

actionbazaar/src/main/java/com/actionbazaar/interfaces/web/AddBid.java

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1+
/*
2+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3+
*
4+
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
5+
*
6+
* The contents of this file are subject to the terms of either the GNU
7+
* General Public License Version 2 only ("GPL") or the Common Development
8+
* and Distribution License("CDDL") (collectively, the "License"). You
9+
* may not use this file except in compliance with the License. You can
10+
* obtain a copy of the License at
11+
* http://glassfish.java.net/public/CDDL+GPL_1_1.html
12+
* or packager/legal/LICENSE.txt. See the License for the specific
13+
* language governing permissions and limitations under the License.
14+
*
15+
* When distributing the software, include this License Header Notice in each
16+
* file and include the License file at packager/legal/LICENSE.txt.
17+
*
18+
* GPL Classpath Exception:
19+
* Oracle designates this particular file as subject to the "Classpath"
20+
* exception as provided by Oracle in the GPL Version 2 section of the License
21+
* file that accompanied this code.
22+
*
23+
* Modifications:
24+
* If applicable, add the following below the License Header, with the fields
25+
* enclosed by brackets [] replaced by your own identifying information:
26+
* "Portions Copyright [year] [name of copyright owner]"
27+
*
28+
* Contributor(s):
29+
* If you wish your version of this file to be governed by only the CDDL or
30+
* only the GPL Version 2, indicate your decision by adding "[Contributor]
31+
* elects to include this software in this distribution under the [CDDL or GPL
32+
* Version 2] license." If you don't indicate a single choice of license, a
33+
* recipient has the option to distribute your version of this file under
34+
* either the CDDL, the GPL Version 2 or to extend the choice of license to
35+
* its licensees as provided above. However, if you add GPL Version 2 code
36+
* and therefore, elected the GPL Version 2 license, then the option applies
37+
* only if the new code is made subject to such option by the copyright
38+
* holder.
39+
*/
140
package com.actionbazaar.interfaces.web;
241

342
import com.actionbazaar.application.BidService;
@@ -27,4 +66,4 @@ public String onAdd() {
2766

2867
return "confirm_add_bid.jsf";
2968
}
30-
}
69+
}
Lines changed: 80 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1+
/*
2+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3+
*
4+
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
5+
*
6+
* The contents of this file are subject to the terms of either the GNU
7+
* General Public License Version 2 only ("GPL") or the Common Development
8+
* and Distribution License("CDDL") (collectively, the "License"). You
9+
* may not use this file except in compliance with the License. You can
10+
* obtain a copy of the License at
11+
* http://glassfish.java.net/public/CDDL+GPL_1_1.html
12+
* or packager/legal/LICENSE.txt. See the License for the specific
13+
* language governing permissions and limitations under the License.
14+
*
15+
* When distributing the software, include this License Header Notice in each
16+
* file and include the License file at packager/legal/LICENSE.txt.
17+
*
18+
* GPL Classpath Exception:
19+
* Oracle designates this particular file as subject to the "Classpath"
20+
* exception as provided by Oracle in the GPL Version 2 section of the License
21+
* file that accompanied this code.
22+
*
23+
* Modifications:
24+
* If applicable, add the following below the License Header, with the fields
25+
* enclosed by brackets [] replaced by your own identifying information:
26+
* "Portions Copyright [year] [name of copyright owner]"
27+
*
28+
* Contributor(s):
29+
* If you wish your version of this file to be governed by only the CDDL or
30+
* only the GPL Version 2, indicate your decision by adding "[Contributor]
31+
* elects to include this software in this distribution under the [CDDL or GPL
32+
* Version 2] license." If you don't indicate a single choice of license, a
33+
* recipient has the option to distribute your version of this file under
34+
* either the CDDL, the GPL Version 2 or to extend the choice of license to
35+
* its licensees as provided above. However, if you add GPL Version 2 code
36+
* and therefore, elected the GPL Version 2 license, then the option applies
37+
* only if the new code is made subject to such option by the copyright
38+
* holder.
39+
*/
140
package com.actionbazaar.interfaces.web;
241

342
import java.io.IOException;
@@ -11,40 +50,46 @@
1150
import javax.servlet.annotation.WebServlet;
1251
import javax.servlet.http.HttpServlet;
1352

14-
@WebServlet(name = "AlertServlet", urlPatterns = { "/alerts" })
53+
@WebServlet(name = "AlertServlet", urlPatterns = {"/alerts"})
1554
public class AlertServlet extends HttpServlet {
16-
private static final long serialVersionUID = 1L;
17-
18-
@Override
19-
public void service(ServletRequest request, ServletResponse response)
20-
throws IOException, ServletException {
21-
22-
response.setContentType("application/json");
23-
24-
PrintWriter out = response.getWriter();
25-
26-
long userId = Long.parseLong(request.getParameter("user_id"));
27-
28-
try (JsonGenerator generator = Json.createGenerator(out)) {
29-
generator
30-
.writeStartObject()
31-
.write("greeting", "Welcome, will sending available alerts")
32-
.writeStartArray("alerts");
33-
34-
String[] alerts = { "Fraud alert!", "Outbid alert!",
35-
"Item available alert!", "Fees due alert!",
36-
"Payment failure alert!" };
37-
38-
for (int i = 0; i < alerts.length; i++) {
39-
generator.writeStartObject().write("user", userId)
40-
.write("text", alerts[i]).writeEnd();
41-
}
42-
43-
generator
44-
.writeEnd()
45-
.write("goodbye", "No more alerts for now, timing out")
46-
.writeEnd()
47-
.close();
48-
}
49-
}
55+
56+
private static final long serialVersionUID = 1L;
57+
58+
@Override
59+
public void service(ServletRequest request, ServletResponse response)
60+
throws IOException, ServletException {
61+
62+
response.setContentType("application/json");
63+
64+
PrintWriter out = response.getWriter();
65+
66+
long userId = Long.parseLong(request.getParameter("user_id"));
67+
68+
try (JsonGenerator generator = Json.createGenerator(out)) {
69+
generator.writeStartObject();
70+
71+
generator.write("greeting", "Welcome, will sending available alerts");
72+
73+
generator.writeStartArray("alerts");
74+
75+
String[] alerts = {"Fraud alert!", "Outbid alert!",
76+
"Item available alert!", "Fees due alert!",
77+
"Payment failure alert!"};
78+
79+
for (String alert : alerts) {
80+
generator
81+
.writeStartObject()
82+
.write("user", userId)
83+
.write("text", alert)
84+
.writeEnd();
85+
}
86+
87+
generator.writeEnd();
88+
89+
generator.write("goodbye", "No more alerts for now, timing out");
90+
91+
generator.writeEnd();
92+
generator.close();
93+
}
94+
}
5095
}

0 commit comments

Comments
 (0)