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

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
35 [EMF] EMF Tutorial EMF 튜터리얼 file 졸리운_곰 2023.08.23 283
34 Eclipse RAP Tutorial for Beginners - Workbench Application (OLD) file 졸리운_곰 2021.01.30 323
33 Learn Eclipse GMF in 15 minutes file 졸리운_곰 2019.11.27 253
32 [Eclipse] GEF entry series (10, an implementation of the form) file 졸리운_곰 2019.11.25 212
31 GEF Programmer Guide 번역 졸리운_곰 2019.11.25 227
30 Learn Eclipse GMF in 15 minutes file 졸리운_곰 2019.11.20 224
29 RCP 에디터 정리 졸리운_곰 2019.11.20 333
28 다른 그림과 관련하여 GEF 편집기 레이아웃에서 그림의 위치 제한 조건을 동적으로 계산 Dynamically calculating the position constraints for a figure in a GEF editor layout in relation to another figure file 졸리운_곰 2019.11.20 277
27 RCP 등에서 .mf 파일로 다른 프로젝트 익스포트 포함시 라이브러리(메소드)를 찾지 못할 때, Eclipse RCP - cant resolve importing libraries in final build file 졸리운_곰 2019.10.15 410
26 ESE2006-EclipseModelingSymposium15_GMF.pdf file 졸리운_곰 2019.09.21 302
25 GMF_Creation_Review.pdf file 졸리운_곰 2019.09.21 366
24 Eclipse EMF and GMF Tutorial file 졸리운_곰 2019.09.21 222
23 GMF Tutorial/ko file 졸리운_곰 2019.09.20 347
22 Model Driven Architecture approach to domain of graphical editors file 졸리운_곰 2019.09.20 268
21 Single_Sourcing_RAP_RCP_en.pdf file 졸리운_곰 2019.05.15 311
20 Rich client platform 설명 및 배우기 참고 졸리운_곰 2019.05.15 309
19 Rich Ajax Platform, Part 1: 소개 file 졸리운_곰 2019.05.15 320
18 또 하나의 크로스 플랫폼: Eclipse RAP file 졸리운_곰 2019.05.15 319
17 Eclipse 4 RCP 튜토리얼(완료) file 졸리운_곰 2019.05.14 977
16 Updating UI in Eclipse RCP 졸리운_곰 2015.11.07 408
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED