wordpress-java-integration  자바와 워드프레스 통합

 

wordpress-java

  • Last Published: 2016-12-25 |
  •  
  • Version: 0.6.5

Introduction

This is a Java client library to interact with the xmlrpc interface of wordpress. It currently supports all functionality exposed by the XML-RPC Wordpress API. You can use it to manipulate contents, comments, media and users of a Wordpress blog.

A command line interface is also provided, making it possible to access the XML-RPC API in scripts.

Usage

There are two interfaces for wordpress-java:

Java API

Include wordpress-java dependency in your project as explained in here.

Have a look at this short example, for starters:

Wordpress wp = new Wordpress(username, password, xmlRpcUrl);
FilterPost filter = new FilterPost();
filter.setNumber(10);
List<Post> recentPosts = wp.getPosts(filter);
System.out.println("Here are the ten recent posts:");
for (Post page : recentPosts) {
  System.out.println(page.getPost_id() + ":" + page.getPost_title());
}
FilterPost filter2 = new FilterPost();
filter2.setPost_type("page");
wp.getPosts(filter2);
List<Post> pages = wp.getPosts(filter2);
System.out.println("Here are the pages:");
for (Post pageDefinition : pages) {
  System.out.println(pageDefinition.getPost_title());
}
System.out.println("Posting a test (draft) page...");
Post recentPost = new Post();
recentPost.setPost_title("Test Page");
recentPost.setPost_content("Test description");
recentPost.setPost_status("draft");
Integer result = wp.newPost(recentPost);
System.out.println("new post page id: " + result);

For all available functionality, check out the javadocsJunit tests can also help as a reference.

Command Line Interface

Command line interface can be installed as explained in the Installation section, or you can directly execute the jar:

java -jar target/jwordpress-<version>-cli.jar --user <user> --pass <pass> --url <xmlrpcurl> COMMAND

For example, here is how to get a list of users in the Wordpress installation:

$ java -jar target/jwordpress-0.6-cli.jar --user admin --pass admin --url http://wordpressjava-test.local/xmlrpc.php -a
User_id:User_login:display_name
admin:1:admin
testuser:2:testuser

You can get a list of all options using -? option:

$ java -jar target/jwordpress-0.6-cli.jar --user admin --pass admin --url http://wordpressjava-test.local/xmlrpc.php -?
usage:
 -?,--help                    Print usage information
 -a,--authors                 Get author list
 -c,--categories              Get category list
 -ca,--newcomment <arg>       New comment from file
 -cc,--commentcount <arg>     Get comment count for a post (-1 for all
                              posts)
 -cd,--deletecomment <arg>    Delete comment
 -ce,--editcomment <arg>      Edit comment from file
 -cg,--getcomment <arg>       Get comment
 -cm,--commentnumber <arg>    Comment # (for --getcomments)
 -cn,--newcategory <arg>      New category (uses --slug and --parentid)
 -co,--commentoffset <arg>    Comment offset # (for --getcomments)
 -cr,--deletecategory <arg>   Delete category <category_id>
 -cs,--commentstatus <arg>    Comment status (for --getcomments)
 -ct,--getcomments <arg>      Get comments for the post
 -h,--url <arg>               Specify the url to xmlrpc.php
 -mn,--newmedia <arg>         New media file (uses --overwrite)
 -od,--deletepost <arg>       Delete post
 -oe,--editpost <arg>         Edit post (needs --postid)
 -oi,--postid <arg>           Post id for posts
 -on,--newpost <arg>          New post from file <arg>
 -or,--recentposts <arg>      Get recent posts
 -os,--getpost <arg>          Get post
 -ov,--overwrite              Allow overwrite in uploading new media
 -p,--pass <arg>              Password
 -pi,--parentid <arg>         Parent id for categories
 -s,--slug <arg>              Slug for categories
 -so,--supportedstatus        Print supported post status values
 -u,--user <arg>              User name
 -us,--userinfo               Get user information

If you don't prefer entering --user--pass and --url options for every command, have a look at How to Save Options in Preferences wiki entry.

Contributing

All your contributions are welcome. Please create pull requests for code and documentation changes at Github. You can also report issues and concerns at the Issues section of Github.

If you are using wordpress-java in your product or project, please let me know. I would love to list it here.

Help

You can ask your questions by creating an issue at the Issues section of Github. Remember to tag it as question, just for tidiness.

Please also have a look at the Wiki pages for a few tricks on using wordpress-java.

Installation

Requirements

If you download the distribution package, available at here, you need a working java runtime environment for the command line interface.

경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
어린이용이며, 설치가 필요없는 브라우저 게임입니다.
https://s1004games.com

You can use Maven or a similar tool to get all dependencies of the library for developing applications using the API.

Installation

In order to use the API in your project, include wordpress-java dependency in your project as explained in here.

Command line interface can be installed using the files in the jwordpress-version-cliapi.zip archive. Copy jwordpress and jwordpress*jar files to a directory on your path and execute jwordpress.

Configuration

There is no mandatory configuration for things to run, just the username, password and the xmlrpc url of the Wordpress installation. Latest versions of Wordpress enables xmlrpc by default, but if there are problems connecting to the site, check your Wordpress settings.

Credits

I (Can Bican) designed and coded most of the API.

  • Fred Potter contributed to functionality related to comments.
  • Alok Saldanha provided patches for custom fields.
  • Jorge Valdivia added the missing featured image support.
  • Commandoser (github username) provided patches for enabling correct mime types.
  • Aliaksei Zhuk fixed the problem of passing incorrect data to editPost().
  • Bruno Candido Volpato da Cunha changed uploadFile() to pass the file name to the server.

Please let me know if I am missing any code contributions.

Contact

For project related issues and questions, please use Github project facilities. If you wish to contact me for other purposes, please contact me at my-name at my-surname.net.

License

Wordpress-Java is licensed under the terms of either the MIT license or the GNU General Public License (GPL) Version 3.

You don’t have to do anything special to choose one license or the other and you don’t have to notify anyone which license you are using. You are free to use a wordpress-java in commercial projects as long as the copyright header is left intact.

See the file COPYING-GPL for the GNU General Public License and COPYING-MIT for the MIT license.


Copyright © 2012–2016 Can Bican. All rights reserved.

 

[출처] http://bican.net/wordpress-java/

[코드레파지토리] https://github.com/canbican/wordpress-java

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
27 [java][maven] jar 파일 의존성 한번에 다운로드 maven 사용 졸리운_곰 2023.08.24 13
26 Prometheus + Grafana로 Java 애플리케이션 모니터링하기 file 졸리운_곰 2020.12.17 79
25 Blockchain Implementation With Java Code file 졸리운_곰 2019.06.16 108
24 Java 코드로 이해하는 블록체인(Blockchain) 졸리운_곰 2019.06.16 127
23 순수 Java Application 코드로 Restful api 호출 졸리운_곰 2018.10.10 245
22 WebDAV 구현을 위한 환경 설정 file 졸리운_곰 2017.09.24 74
21 [Java] Apache Commons HttpClient로 SSL 통신하기 졸리운_곰 2017.03.27 545
20 JSoup를 이용한 HTML 파싱 졸리운_곰 2017.03.04 100
19 jsoup을 활용해서 Java에서 HTML 파싱하는 방법 정리 file 졸리운_곰 2017.03.04 157
18 NSA의 Dataflow 엔진 Apache NiFi 소개와 설치 file 졸리운_곰 2017.01.23 463
» wordpress-java-integration 자바와 워드프레스 통합 졸리운_곰 2016.12.30 166
16 Create New Posts in Wordpress using Java and XMLRpc 졸리운_곰 2016.11.14 69
15 자바로 POST 방식으로 통신하기, java httppost 클래스를 활용한 예제 졸리운_곰 2016.11.14 444
14 [Java]아파치 HttpClient사용하기 file 졸리운_곰 2016.11.14 104
13 Building a Search Engine With Nutch Solr And Hadoop file 졸리운_곰 2016.04.21 219
12 Nutch and Hadoop Tutorial file 졸리운_곰 2016.04.21 209
11 Latest step by Step Installation guide for dummies: Nutch 0. file 졸리운_곰 2016.04.21 131
10 Nutch 초간단 빌드와 실행 졸리운_곰 2016.04.21 457
9 Nutch로 알아보는 Crawling 구조 - Joinc 졸리운_곰 2016.04.21 352
8 A tiny bittorrent library Java: 자바로 만든 작은 bittorrent 라이브러리 file 졸리운_곰 2016.04.20 242
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED