Author: agilliland
Date: Wed May 23 19:13:21 2007
New Revision: 541137
URL: http://svn.apache.org/viewvc?view=rev&rev=541137
Log:
code reformatting.
Modified:
roller/trunk/src/org/apache/roller/ui/authoring/ajax/CommentDataServlet.java
roller/trunk/src/org/apache/roller/ui/authoring/ajax/UserDataServlet.java
Modified:
roller/trunk/src/org/apache/roller/ui/authoring/ajax/CommentDataServlet.java
URL:
http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/ui/authoring/ajax/CommentDataServlet.java?view=diff&rev=541137&r1=541136&r2=541137
==============================================================================
---
roller/trunk/src/org/apache/roller/ui/authoring/ajax/CommentDataServlet.java
(original)
+++
roller/trunk/src/org/apache/roller/ui/authoring/ajax/CommentDataServlet.java
Wed May 23 19:13:21 2007
@@ -1,53 +1,48 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. The ASF licenses this file to You
-* under the Apache License, Version 2.0 (the "License"); you may not
-* use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License. For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
package org.apache.roller.ui.authoring.ajax;
import java.io.IOException;
-import java.util.Iterator;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.WordUtils;
-
-import org.apache.roller.RollerException;
import org.apache.roller.business.Roller;
import org.apache.roller.business.RollerFactory;
import org.apache.roller.business.WeblogManager;
import org.apache.roller.pojos.CommentData;
-import org.apache.roller.pojos.UserData;
import org.apache.roller.util.Utilities;
+
/**
- * Return comment id and content in JavaScript Object Notation (JSON) format.
- * For example comment with id "3454545346" and content "hi there" will be
+ * Return comment id and content in JavaScript Object Notation (JSON) format.
+ * For example comment with id "3454545346" and content "hi there" will be
* represented as: {id : "3454545346", content : "hi there"}
- *
- * @web.servlet name="CommentDataServlet"
- * @web.servlet-mapping url-pattern="/roller-ui/authoring/commentdata/*"
*/
public class CommentDataServlet extends HttpServlet {
-
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
-
+
+ public void doGet(HttpServletRequest request,
+ HttpServletResponse response)
+ throws ServletException, IOException {
+
Roller roller = RollerFactory.getRoller();
try {
WeblogManager wmgr = roller.getWeblogManager();
@@ -55,9 +50,9 @@
String content = Utilities.escapeHTML(c.getContent());
content = WordUtils.wrap(content, 72);
content = StringEscapeUtils.escapeJavaScript(content);
- String json = "{ id: \"" + c.getId() + "\"," + "content: \"" +
content + "\" }";
+ String json = "{ id: \"" + c.getId() + "\"," + "content: \"" +
content + "\" }";
response.setContentType("text/html; charset=utf-8");
- response.getWriter().print(json);
+ response.getWriter().print(json);
response.flushBuffer();
response.getWriter().flush();
response.getWriter().close();
@@ -65,4 +60,5 @@
throw new ServletException(e.getMessage());
}
}
+
}
Modified:
roller/trunk/src/org/apache/roller/ui/authoring/ajax/UserDataServlet.java
URL:
http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/ui/authoring/ajax/UserDataServlet.java?view=diff&rev=541137&r1=541136&r2=541137
==============================================================================
--- roller/trunk/src/org/apache/roller/ui/authoring/ajax/UserDataServlet.java
(original)
+++ roller/trunk/src/org/apache/roller/ui/authoring/ajax/UserDataServlet.java
Wed May 23 19:13:21 2007
@@ -1,37 +1,37 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. The ASF licenses this file to You
-* under the Apache License, Version 2.0 (the "License"); you may not
-* use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License. For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
package org.apache.roller.ui.authoring.ajax;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
import org.apache.roller.RollerException;
import org.apache.roller.business.Roller;
import org.apache.roller.business.RollerFactory;
import org.apache.roller.business.UserManager;
import org.apache.roller.pojos.UserData;
+
/**
* Return list of users matching a startsWith strings. <br />
* Accepts request params (none required):<br />
@@ -44,15 +44,14 @@
* username1, emailaddress1 <br/>
* username2, emailaddress2 <br/>
* usernameN, emailaddressN <br/>
- *
- * @web.servlet name="UserDataServlet"
- * @web.servlet-mapping url-pattern="/roller-ui/authoring/userdata/*"
- * @author David M Johnson
*/
public class UserDataServlet extends HttpServlet {
- private final int MAX_LENGTH = 50;
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
+
+ private final int MAX_LENGTH = 50;
+
+ public void doGet(HttpServletRequest request,
+ HttpServletResponse response)
+ throws ServletException, IOException {
String startsWith = request.getParameter("startsWith");
Boolean enabledOnly = null;
@@ -61,20 +60,20 @@
if ("true".equals(request.getParameter("enabled"))) enabledOnly =
Boolean.TRUE;
if ("false".equals(request.getParameter("enabled"))) enabledOnly =
Boolean.FALSE;
try { offset = Integer.parseInt(request.getParameter("offset"));
- } catch (Throwable ignored) {}
+ } catch (Throwable ignored) {}
try { length = Integer.parseInt(request.getParameter("length"));
} catch (Throwable ignored) {}
Roller roller = RollerFactory.getRoller();
try {
UserManager umgr = roller.getUserManager();
- List users =
- umgr.getUsersStartingWith(startsWith, enabledOnly, offset,
length);
+ List users =
+ umgr.getUsersStartingWith(startsWith, enabledOnly, offset,
length);
Iterator userIter = users.iterator();
while (userIter.hasNext()) {
UserData user = (UserData)userIter.next();
- response.getWriter().print(user.getUserName());
- response.getWriter().print(",");
+ response.getWriter().print(user.getUserName());
+ response.getWriter().print(",");
response.getWriter().println(user.getEmailAddress());
}
response.flushBuffer();
@@ -82,4 +81,5 @@
throw new ServletException(e.getMessage());
}
}
+
}