input stringlengths 10 828 | output stringlengths 5 107 |
|---|---|
public void add category category category persistence manager pm pmf get get persistence manager try pm make persistent category finally pm close | title add category |
public void del category string category name persistence manager pm pmf get get persistence manager query query pm new query category class query set filter name name param query declare parameters string name param list category resultes list category query execute category name if resultes iterator has next pm delete persistent resultes get 0 | title del category |
public category get category string category name persistence manager pm pmf get get persistence manager query query pm new query category class query set filter name name param query declare parameters string name param list category resultes list category query execute category name if resultes iterator has next return resultes get 0 else return null | title get category |
public void upd category category category persistence manager pm pmf get get persistence manager try category t pm get object by id category class category get name t set counter category get counter finally pm close | title upd category |
protected void do get http servlet request req http servlet response resp do post req resp | forwards to do post req resp |
protected void do put http servlet request req http servlet response resp do post req resp | forwards to do post req resp |
protected void do delete http servlet request req http servlet response resp do post req resp | forwards to do post req resp |
protected void do options http servlet request req http servlet response resp do post req resp | forwards to do post req resp |
protected void do head http servlet request req http servlet response resp do post req resp | forwards to do post req resp |
protected string get controller package http servlet request servlet request return get init parameter package | gets the controller package name |
protected configuration get controller configuration http servlet request servlet request return new configuration | gets the controller configuration |
protected response get controller response http servlet response servlet response return new http servlet response impl servlet response | gets the controller response from a servlet response |
public client response perform request client request client request request request new basic request impl client request get http method client request get url info part client request get headers client request get parameters client request get request body byte array output stream output stream new byte array output stream response response new basic response impl output stream try this controller perform request response catch controller exception e throw new runtime exception e return new client response response get status code get code response get headers new byte array input stream output stream to byte array | performs a local request by delegating the client request to the used |
public client response perform request client request client request http client http client new default http client try http request base http request get http request client request http response http response http client execute http request return get client response http response catch ioexception e throw new runtime exception failed to perform http request e catch urisyntax exception e throw new runtime exception invalid uri e | performs an http request from the data provided by the given client |
protected http params get request parameters map string string parameters basic http params http parameters new basic http params for string param name parameters key set string param values parameters get param name if param values length 0 http parameters set parameter param name param values 0 return http parameters | gets the http parameters from the provided parameter map |
public input stream get body input stream return body handler get body input stream | gets the http response body input stream |
protected client response get client response http response http response throws ioexception http entity entity http response get entity input stream input stream entity null null entity get content return new client response http response get status line get status code get response headers http response get all headers input stream | gets the client response from the provided http response |
public string get body content string charset get content charset return body handler get body content charset | gets the http response body string |
public object get body object consumer consumer class clazz throws controller exception string media type get content media type string charset get content charset return body handler get body object consumer clazz media type charset | gets the http response body as an object of the given class |
public string get content media type return header handler get content media type media type text xml | gets the response bodys media type from the |
public string get content charset return header handler get content charset charset utf8 | gets the response bodys charset encoding from the |
public string get url info part return url info part | gets the request url info part |
public string get authorization user return header handler get authorization user | gets the user from the authorization header |
public input stream get request body return request body | gets the http request body |
public string get authorization password return header handler get authorization password | gets the password from the authorization header |
public void set authorization string username string password string header value header utils get basic authorization header username password set header http header authorization header value | sets the http request authorization header |
public void set body string body content string media type set body body content media type charset utf8 | sets the request body for this request and specifies the media type |
public void set body string body content string media type string charset input stream body input stream try body input stream new byte array input stream body content get bytes charset catch unsupported encoding exception e throw new runtime exception e set body body input stream media type charset | sets the request body for this request and specifies the media type |
public void set body object object producer producer string media type throws controller exception set body object producer media type charset utf8 | sets the request body for this request and specifies the media type |
public void produce object object writer writer string accepted throws controller exception method producer method annotation utils get producer method this accepted try producer method invoke this object writer catch invocation target exception e throwable cause e get cause if cause instanceof controller exception throw controller exception cause throw new controller exception the producer method failed during execution producer method cause catch illegal access exception e throw new controller exception the producer method could not be invoked producer method e | serializes the given object to the most suitable media type in the enumeration |
public string get best matching media type string accepted throws controller exception return annotation utils get best matching media type this produces class accepted | gets the media type best matching the comma separated string of |
public void set body object object producer producer string media type string charset throws controller exception byte array output stream output stream new byte array output stream output stream writer writer null try writer new output stream writer output stream charset catch unsupported encoding exception e throw new controller exception body content charset is not supported e producer produce object writer media type input stream body input stream new byte array input stream output stream to byte array set body body input stream media type charset | sets the request body for this request and specifies the media type |
public void set header string header name string header value string header values new string header value set header header name header values | sets the header with the given header name to the specified |
public void set header string header name string header values headers put header name header values | sets the header with the given header name to the specified |
public void set parameter string parameter name string parameter value string parameter values new string parameter value set parameter parameter name parameter values | sets the parameter with the given parameter name to the specified |
public void set parameter string parameter name string parameter values parameters put parameter name parameter values | sets the parameter with the given parameter name to the specified |
private controller string package path configuration config logger debug starting controller initialization package path this resource manager resource manager get instance package path this documentation manager documentation manager get instance package path this config config logger debug finished controller initialization package path | constructs a controller being responsible for the package path and configuration |
public http status code get http status code int code return look up map get code | gets the http status code enum for the given status code |
protected phase get phase after allocation the authentication phase is skipped if no authentication handler is given or the resource method is annotated as public if setup get configuration get authentication handler null annotation utils is public state get resource method return get phase after authentication return new authentication phase state setup | gets the phase following an allocation phase |
protected phase get phase after authentication return new invocation phase state setup | gets the phase following an authentication phase |
protected phase get phase after invocation return new production phase state setup | gets the phase following an invocation phase |
protected phase get phase after documentation return new production phase state setup | gets the phase following a documentation phase |
protected phase get phase after production the production phase is the last phase of the flow return null | gets the phase following a production phase |
public method get resource method string http method string path class resource class resource node resource node resource tree find resource node path if resource node null return null for method resource method resource node get resource methods if http method equals ignore case annotation utils get http method resource method return class utils get first implementation resource class resource method return null | gets the resource method corresponding to the http method |
protected wadl resource get resource string path configuration configuration resource node resource node resource tree find resource node path if resource node null return null class resource class resource node get resource class list method resource methods resource node get resource methods wadl resource resource new wadl resource resource set path resource node get path if resource class null resource methods null resource methods size 0 resource set params get resource params resource class resource methods get 0 resource set methods get methods resource methods configuration resource set resources get sub resources path return resource | p gets a resource from a resource path and |
public void set default consumer class default consumer set property property default consumer default consumer get name | p sets the class of the default consumer |
public void set default producer class default producer set property property default producer default producer get name | sets the class of the default producer |
protected wadl request get request method resource method configuration configuration wadl request request new wadl request request set params get request params resource method request set representations get request representations resource method configuration return request | gets the request for a resource java method and a controller configuration |
public parameter handler get parameter handler return parameter handler | gets the parameter handler |
public void set phase flow class phase flow set property property phase flow phase flow get name | sets the class of the phase flow defining the controllers phase execution logic |
public header handler get header handler return header handler | gets the header handler |
public void set authentication handler class authentication handler set property property authentication handler authentication handler get name | sets the class of the authentication handler |
public method get resource method return resource method | gets the resource method |
public body handler get body handler return body handler | gets the body handler |
public void set resource method method resource method this resource method resource method | sets the resource method |
protected string default values as string string default values string default value if default values null return null if default values length 1 return default values 0 default value for string value default values default value value default value default value substring 0 default value length 2 default value return default value | converts a list of default values into a human readable string |
public void set xml deserialization properties map string string xml deserialization properties set properties property xml deserialization xml deserialization properties | sets the xml deserialization properties |
public void set resource class class resource class this resource class resource class | sets the resource class |
public property handler get property handler return property handler | gets the property handler |
public void set json deserialization properties map string string json deserialization properties set properties property json deserialization json deserialization properties | sets the json deserialization properties |
public string get accepted media type throws controller exception string meta data part get request url meta part if meta data part contains xml return media type text xml else if meta data part contains json return media type text json else return header handler get header value http header accept media type text xml | gets the media type for result serialization |
public http status code get status return status | gets the http status code |
public void set status http status code status this status status | sets the http status code |
public string get accepted charset throws controller exception return header handler get header value http header accept charset charset utf8 | gets the encoding charset for result serialization |
public void set xml serialization properties map string string xml serialization properties set properties property xml serialization xml serialization properties | sets the xml serialization properties |
public date get invocation start return invocation start | gets the invocation start date |
public void set invocation start date invocation start this invocation start invocation start | sets the invocation start date |
public date get invocation end return invocation end | gets the invocation end date |
public resource node find resource node string path path uri utils standard uri path string path parts uri utils split path path return root find resource node path parts | finds the resource node matching the given real path |
public string get http method string meta data part get request url meta part if meta data part contains get return http method get else if meta data part contains post return http method post else if meta data part contains put return http method put else if meta data part contains delete return http method delete else if meta data part contains head return http method head else if meta data part contains options return http method options else if meta data part contains trace return http method trace return request get http method to upper case | gets the http method for result serialization |
public void set json serialization properties map string string json serialization properties set properties property json serialization json serialization properties | sets the json serialization properties |
public void set invocation end date invocation end this invocation end invocation end | sets the invocation end date |
private void add resource method class resource class method resource method string path annotation utils get path from class resource class string path for method annotation utils get path from method resource method if path for method null path path path for method string path parts uri utils split path path root add resource method path parts 0 resource class resource method | adds a resource method for a resource class to the tree |
public documentation manager get documentation manager return documentation manager | gets the documentation manager |
public string get path part return path part | gets the path part |
public string get request url resource part string path info get request url info part if path info contains path info path info substring 0 path info index of return uri utils standard uri path info | gets the request url resource path by removing the |
public string get request url meta part string path info get request url info part if path info contains return return path info substring path info index of 1 path info length | gets the request url meta part |
public string get request url info part return request get url info part | gets the request url info part |
private resource node find sub node from virtual path part string path part look up the node in the hash map first resource node simple node trivial patten sub nodes get path part if simple node null return simple node if the path part is not in the hash map then it might be the same reg ex as a none trivial path part for resource node pattern node none trivial pattern sub nodes if pattern node get path part equals path part return pattern node return null | finds a sub node having the specified virtual path part |
public input stream get request body input stream return request get body input stream | gets the body input stream |
public resource node find resource node string path parts if level path parts length 1 return this else int next level level 1 resource node next node find sub node path parts next level if next node null return null return next node find resource node path parts | finds the sub node matching the last node of a path represented |
public output stream get response body output stream return response get body output stream | gets the output stream for streaming the serialized response body |
private resource node find sub node string path part look up the node in the hash map first resource node simple node trivial patten sub nodes get path part if simple node null return simple node if the path part is not in the hash map then it might match a pattern for resource node pattern node none trivial pattern sub nodes if pattern node get pattern matcher path part matches return pattern node return null | finds a direct sub node matching the given real path part |
private string get path from path parts string path parts string path for int i 0 i level i path path parts i return uri utils standard uri path | gets the complete path from a path part concatenating the parts |
private void load properties | loads the properties from the properties file |
public void set property string property name string property value properties set property property name property value remove class property name remove maps property name | sets a property of the given name to the given value |
public void set properties string property name prefix map string string properties for string key properties key set set property property name prefix key properties get key | sets the properties in the given property map and puts the given |
protected void remove class string property name classes remove property name | removes the class associated to the given property name |
public t nullify actual references t object for field field class manager get actual references field set accessible true try field set object null catch illegal access exception e throw new runtime exception e return object | nullify all references of the given object ignoring references |
protected void remove maps string property name string property name parts property name split string current prefix for string part property name parts if current prefix is empty current prefix current prefix part maps remove current prefix | removes all maps associated to all possible prefixes |
public essential http server string base url string package path throws ioexception url url new url base url string address url get host int port url get port string context url get path inet socket address socket new inet socket address address port essential http handler handler new essential http handler context package path server http server create socket 0 server create context context handler server set executor executors new cached thread pool | creates a lightweight http server |
public void start server start system out println essential http server started server get address | starts the server |
public void stop server stop 0 system out println essential http server stopped | stops the server |
public void delete entity class t clazz integer id throws controller exception t entity em find clazz id require existence entity em get transaction begin em remove entity em get transaction commit | deletes an entity of the given class with the specified id |
protected string camel case to under score string input return pattern compile a z matcher input replace all 0 to lower case | p converts a camel cased name into an underscored name |
public t read entity class t clazz integer id throws controller exception t entity em find clazz id require existence entity em detach entity return reference manager get instance clazz nullify actual references entity | reads an entity of the given class with the specified id by |
protected void require existence t entity throws controller exception if entity null throw new controller exception entity not found http status code not found | requires the existence of an entity |
public in memory db get in memory db string database name return get in memory db database name in memory db default initial timeout in memory db default timeout check interval | gets an in memory database with the given name |
public entity manager factory get entity manager factory time to timeout timeout return entity manager factory | gets the entity manager factory creating entity managers |
protected boolean wait for creation completed synchronized creation completed if database created return true try if get state equals state new start creation completed wait return false else creation completed wait return false catch interrupted exception e throw new runtime exception e | the first process calling this method will trigger the creation |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.