javax.xml.rpc.handler.Handler Java Examples
The following examples show how to use
javax.xml.rpc.handler.Handler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServiceRefFactory.java From Tomcat8-Source-Read with MIT License | 6 votes |
private void initHandlerChain(QName portName, HandlerRegistry handlerRegistry, HandlerInfo handlerInfo, List<String> soaprolesToAdd) { HandlerChain handlerChain = (HandlerChain) handlerRegistry.getHandlerChain(portName); @SuppressWarnings("unchecked") // Can't change the API Iterator<Handler> iter = handlerChain.iterator(); while (iter.hasNext()) { Handler handler = iter.next(); handler.init(handlerInfo); } String[] soaprolesRegistered = handlerChain.getRoles(); String [] soaproles = new String[soaprolesRegistered.length + soaprolesToAdd.size()]; int i; for (i = 0;i < soaprolesRegistered.length; i++) { soaproles[i] = soaprolesRegistered[i]; } for (int j = 0; j < soaprolesToAdd.size(); j++) { soaproles[i+j] = soaprolesToAdd.get(j); } handlerChain.setRoles(soaproles); handlerRegistry.setHandlerChain(portName, handlerChain); }
Example #2
Source File: ServiceRefFactory.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
private void initHandlerChain(QName portName, HandlerRegistry handlerRegistry, HandlerInfo handlerInfo, ArrayList<String> soaprolesToAdd) { HandlerChain handlerChain = (HandlerChain) handlerRegistry.getHandlerChain(portName); @SuppressWarnings("unchecked") // Can't change the API Iterator<Handler> iter = handlerChain.iterator(); while (iter.hasNext()) { Handler handler = iter.next(); handler.init(handlerInfo); } String[] soaprolesRegistered = handlerChain.getRoles(); String [] soaproles = new String[soaprolesRegistered.length + soaprolesToAdd.size()]; int i; for (i = 0;i < soaprolesRegistered.length; i++) soaproles[i] = soaprolesRegistered[i]; for (int j = 0; j < soaprolesToAdd.size(); j++) soaproles[i+j] = soaprolesToAdd.get(j); handlerChain.setRoles(soaproles); handlerRegistry.setHandlerChain(portName, handlerChain); }
Example #3
Source File: ServiceRefFactory.java From tomcatsrc with Apache License 2.0 | 6 votes |
private void initHandlerChain(QName portName, HandlerRegistry handlerRegistry, HandlerInfo handlerInfo, ArrayList<String> soaprolesToAdd) { HandlerChain handlerChain = (HandlerChain) handlerRegistry.getHandlerChain(portName); @SuppressWarnings("unchecked") // Can't change the API Iterator<Handler> iter = handlerChain.iterator(); while (iter.hasNext()) { Handler handler = iter.next(); handler.init(handlerInfo); } String[] soaprolesRegistered = handlerChain.getRoles(); String [] soaproles = new String[soaprolesRegistered.length + soaprolesToAdd.size()]; int i; for (i = 0;i < soaprolesRegistered.length; i++) soaproles[i] = soaprolesRegistered[i]; for (int j = 0; j < soaprolesToAdd.size(); j++) soaproles[i+j] = soaprolesToAdd.get(j); handlerChain.setRoles(soaproles); handlerRegistry.setHandlerChain(portName, handlerChain); }
Example #4
Source File: SimpleClient.java From jplag with GNU General Public License v3.0 | 6 votes |
protected JPlagTyp_Stub getJPlagStub() { if (stub == null) { stub = (JPlagTyp_Stub) (new JPlagService_Impl() .getJPlagServicePort()); HandlerChain handlerchain = stub._getHandlerChain(); @SuppressWarnings("unchecked") Iterator<Handler> handlers = handlerchain.iterator(); while (handlers.hasNext()) { Handler handler = handlers.next(); if (handler instanceof JPlagClientAccessHandler) { accessHandler = ((JPlagClientAccessHandler) handler); break; } } } if (accessHandler != null) { accessHandler.setUserPassObjects(atujplag.getUsername(), atujplag.getPassword()); } return stub; }
Example #5
Source File: SubmittedClient.java From jplag with GNU General Public License v3.0 | 6 votes |
private JPlagTyp_Stub generateStub() { if (this.stub == null) { stub = (JPlagTyp_Stub) (new JPlagService_Impl() .getJPlagServicePort()); HandlerChain handlerchain = stub._getHandlerChain(); @SuppressWarnings("unchecked") Iterator<Handler> handlers = handlerchain.iterator(); while (handlers.hasNext()) { Handler handler = handlers.next(); if (handler instanceof JPlagClientAccessHandler) { this.accessHandler = ((JPlagClientAccessHandler) handler); break; } } } if (accessHandler != null) { accessHandler.setUserPassObjects(atujplag.getUsername(), atujplag.getPassword()); } return this.stub; }
Example #6
Source File: AdminTool.java From jplag with GNU General Public License v3.0 | 6 votes |
/** * Returns a singleton JPlag stub * * @return The JPlag stub object */ public JPlagTyp_Stub getJPlagStub() { if (stub == null) { stub = (JPlagTyp_Stub) (new JPlagService_Impl().getJPlagServicePort()); HandlerChain handlerchain = stub._getHandlerChain(); @SuppressWarnings("unchecked") Iterator<Handler> handlers = handlerchain.iterator(); while (handlers.hasNext()) { Handler handler = handlers.next(); if (handler instanceof JPlagClientAccessHandler) { accessHandler = ((JPlagClientAccessHandler) handler); break; } } } return stub; }
Example #7
Source File: JPlagBean.java From jplag with GNU General Public License v3.0 | 6 votes |
public JPlagBean() { // Setup SSL stuff to allow message encryption // System.setProperty("javax.net.ssl.trustStorePassword", "gulpie!"); // System.setProperty("javax.net.ssl.trustStore", System.getProperty("catalina.home") + File.separator + "server.trust"); // System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); // java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); stub = (JPlagTyp_Stub) (new JPlagService_Impl().getJPlagServicePort()); // Set the server page login data HandlerChain handlerchain = stub._getHandlerChain(); @SuppressWarnings("unchecked") Iterator<Handler> handlers = handlerchain.iterator(); while (handlers.hasNext()) { Handler handler = handlers.next(); if (handler instanceof JPlagClientAccessHandler) { ((JPlagClientAccessHandler) handler).setUserPassObjects("JPlagJSP", "#Ca+#h8n4un!"); return; } } throw new RuntimeException("JPlagBean(): Unable to find client access" + " handler!"); }
Example #8
Source File: JplagSwingClient.java From jplag with GNU General Public License v3.0 | 6 votes |
public JPlagTyp_Stub getJplagStub() { if (stub == null) { stub = (JPlagTyp_Stub) (new JPlagService_Impl().getJPlagServicePort()); HandlerChain handlerchain = stub._getHandlerChain(); @SuppressWarnings("unchecked") Iterator<Handler> handlers = handlerchain.iterator(); while (handlers.hasNext()) { Handler handler = handlers.next(); if (handler instanceof JPlagClientAccessHandler) { accessHandler = ((JPlagClientAccessHandler) handler); break; } } } if (accessHandler != null) { accessHandler.setUserPassObjects(getJUsernameField().getText(), String.valueOf(getJPasswordField().getPassword())); } return stub; }
Example #9
Source File: HandlerChainImpl.java From tomee with Apache License 2.0 | 6 votes |
public boolean handleRequest(MessageContext context) { MessageSnapshot snapshot = new MessageSnapshot(context); try { for (int i = 0; i < size(); i++) { Handler currentHandler = (Handler) get(i); invokedHandlers.addFirst(currentHandler); try { if (!currentHandler.handleRequest(context)) { return false; } } catch (SOAPFaultException e) { throw e; } } } finally { saveChanges(context); } if (!snapshot.equals(context)) { throw new IllegalStateException("The soap message operation or arguments were illegally modified by the HandlerChain"); } return true; }
Example #10
Source File: HandlerChainImpl.java From tomee with Apache License 2.0 | 6 votes |
public boolean handleResponse(MessageContext context) { MessageSnapshot snapshot = new MessageSnapshot(context); try { for (Iterator iterator = invokedHandlers.iterator(); iterator.hasNext(); ) { Handler handler = (Handler) iterator.next(); if (!handler.handleResponse(context)) { return false; } } } finally { saveChanges(context); } if (!snapshot.equals(context)) { throw new IllegalStateException("The soap message operation or arguments were illegally modified by the HandlerChain"); } return true; }
Example #11
Source File: HandlerChainImpl.java From tomee with Apache License 2.0 | 6 votes |
public boolean handleFault(MessageContext context) { MessageSnapshot snapshot = new MessageSnapshot(context); try { for (Iterator iterator = invokedHandlers.iterator(); iterator.hasNext(); ) { Handler handler = (Handler) iterator.next(); if (!handler.handleFault(context)) { return false; } } } finally { saveChanges(context); } if (!snapshot.equals(context)) { throw new IllegalStateException("The soap message operation or arguments were illegally modified by the HandlerChain"); } return true; }
Example #12
Source File: HandlerChainImpl.java From tomee with Apache License 2.0 | 5 votes |
@SuppressWarnings({"unchecked"}) public HandlerChainImpl(List<HandlerInfo> handlerInfos, String[] roles) { this.roles = roles; for (int i = 0; i < handlerInfos.size(); i++) { HandlerInfo handlerInfo = handlerInfos.get(i); try { Handler handler = (Handler) handlerInfo.getHandlerClass().newInstance(); handler.init(handlerInfo); add(handler); } catch (Exception e) { throw new JAXRPCException("Unable to initialize handler class: " + handlerInfo.getHandlerClass().getName(), e); } } }
Example #13
Source File: HandlerChainImpl.java From tomee with Apache License 2.0 | 5 votes |
public void destroy() { for (Iterator iterator = invokedHandlers.iterator(); iterator.hasNext(); ) { Handler handler = (Handler) iterator.next(); handler.destroy(); } invokedHandlers.clear(); clear(); }
Example #14
Source File: JplagClient.java From jplag with GNU General Public License v3.0 | 4 votes |
public static void main(String[] args) { if (args.length != 2) { System.out.println("jplan CLI needs two parameters: username and password!"); System.exit(1); } try { JplagClient jpClient = new JplagClient(); jpClient.stub = (JPlagTyp_Stub) (new JPlagService_Impl().getJPlagServicePort()); HandlerChain handlerchain = jpClient.stub._getHandlerChain(); @SuppressWarnings("rawtypes") Iterator handlers = handlerchain.iterator(); while (handlers.hasNext()) { Handler handler = (Handler) handlers.next(); if (handler instanceof JPlagClientAccessHandler) { jpClient.accessHandler = ((JPlagClientAccessHandler) handler); break; } } if (jpClient.accessHandler == null) { System.out.println("Unable to find access handler!"); } else { jpClient.accessHandler.setUserPassObjects(args[0], args[1]); } ServerInfo serverInfo = jpClient.invoke_getServerInfo(); String lstr = ""; LanguageInfo[] langs = serverInfo.getLanguageInfos(); for (int i = 0; i < langs.length; i++) { lstr += "\nLanguage: " + langs[i].getName() + "\nSuffixes: "; String[] suf = langs[i].getSuffixes(); for (int j = 0; j < suf.length; j++) lstr += suf[j] + ((j < suf.length - 1) ? "," : ""); lstr += "\nDefault minimum token length: " + langs[i].getDefMinMatchLen() + "\n"; } String str = ""; Submission[] subs = serverInfo.getSubmissions(); for (int i = 0; i < subs.length; i++) { str += "Submission ID: " + subs[i].getSubmissionID() + " Title: " + subs[i].getTitle() + " Date: " + subs[i].getDate() + "\n"; } System.out.println("Left submission slots: " + serverInfo.getUserInfo().getLeftSubmissionSlots()); System.out.println("Account end date: " + serverInfo.getUserInfo().getExpires()); System.out.println("List of languages:\n" + lstr + "\nList of submissions on server:\n" + str); if (args.length == 2) { String containerid = jpClient.invoke_compareSource(args); Status status; System.out.println("Waiting for server to be done..."); do { Thread.sleep(4000); status = jpClient.stub.getStatus(containerid); System.out.println("State=" + status.getState() + " Progress=" + status.getProgress()); // System.out.flush(); } while (status.getState() >= WAITING_IN_QUEUE && status.getState() < COMPARE_SOURCE_DONE); if (status.getState() == BAD_USER_ID) { System.out.println("ARGH! Where did my container go?!? " + status.getReport()); } else if (status.getState() == UNKOWN_ERROR_OCCURED || status.getState() == BAD_LANGUAGE_ERROR || status.getState() == NO_ENOUGH_SUBMISSIONS_ERROR) { System.out.println("Error occurred: " + status.getReport()); } else { jpClient.extractPart(jpClient.stub.getResult(containerid), args[1]); } } } catch (Exception ex) { if (ex instanceof JPlagException) { JPlagException jex = (JPlagException) ex; System.out.println(jex.getExceptionType()); System.out.println(jex.getDescription()); System.out.println(jex.getRepair()); } ex.printStackTrace(); } }